Achso: Keine Konkurenten anklicken!
Rechenkraft hat jetzt eine eigene Stadt!
-
nico
- Vereinsmitglied

- Beiträge: 2211
- Registriert: 22.12.2002 13:22
- Wohnort: C-Town
-
Xentar
- Task-Killer

- Beiträge: 707
- Registriert: 26.05.2002 14:19
- Wohnort: Velbert
-
laguna
- TuX-omane

- Beiträge: 2789
- Registriert: 08.10.2003 09:36
- Wohnort: Ettingshausen
-
nico
- Vereinsmitglied

- Beiträge: 2211
- Registriert: 22.12.2002 13:22
- Wohnort: C-Town
-
achims311
- CPU-Load-Pusher

- Beiträge: 289
- Registriert: 30.10.2007 13:38
- Wohnort: Strassen
Klar geht auch.
1. bash script
2. expect script
quelle: http://ubuntuforums.org/showthread.php?t=558051(nur ein wenig von mir geändert, so das es auch klappt 
neuere tor versionen sollen auch das hier http://ge.mine.nu/tor-ctrl.html gleich mitbringen
1. bash script
Code: Alles auswählen
#!/bin/bash
# Script will exit after 20 seconds
set timeout 20
# Move into Tor data directory
for dir in /var/lib/tor $HOME/.tor
do
if [ -f ${dir}/control_auth_cookie ]
then
cookiefile=${dir}/control_auth_cookie
fi
done
echo "using cookie file: \"${cookiefile}\""
# Set variables:
#-------------------------------------------------------------------------------------------
# Set hexdecimal dump of "control_auth_cookie" as variable "HEX_COOKIE"
#hexCookie=$(echo $(hexdump -e '32/1 "%02x""\n"' $cookiefile | sed -e 's/^.......//') | sed -e 's/ //g')
hexCookie=$(hexdump -e '32/1 "%02x""\n"' $cookiefile)
# Set variable for the address Tor listlens on
torAddy='localhost'
# Set variable for the port Tor listlens on (Control Port)
torPort='9051'
# Set variable for the signal to be used (default is NEWNYM)
signal='NEWNYM'
#-------------------------------------------------------------------------------------------
# Run expect and use it to run the script "expect-telnet-signal.exp"
expect -f expect-telnet-signal.exp $hexCookie $torAddy $torPort $signal
Code: Alles auswählen
#!/usr/bin/expect -f
# set to 1 to force conservative mode
set force_conservative 1
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}
# Script will timeout after 60 seconds
set timeout 20
# First argument is assigned to the variable hexCookie
set hexCookie [lindex $argv 0]
# Second argument is assigned to the variable torAddy
set torAddy [lindex $argv 1]
# Third argument is assigned to the variable torPort
set torPort [lindex $argv 2]
# Fourth argument is assigned to the variable signal
set signal [lindex $argv 3]
# Expect will launch a telnet session to Tor via. Spawn
spawn telnet $torAddy $torPort
match_max 4000
# Response expected by Expect
expect -exact "Trying 127.0.0.1...\r
Connected to localhost.\r
Escape character is '^\]'.\r
"
# Authenticate use of Tor control port by sending contents of Tor "magic cookie" in hexidecimal format to Tor
send -- "AUTHENTICATE $hexCookie\r"
expect -exact "AUTHENTICATE $hexCookie\r
250 OK\r
"
#send -- ""
#expect -exact "
# Send a signal to Tor
send -- "signal $signal\r"
expect -exact "signal $signal\r
250 OK\r
"
# Close telnet and expect session
send -- "quit\r"
expect eof
neuere tor versionen sollen auch das hier http://ge.mine.nu/tor-ctrl.html gleich mitbringen
-
nico
- Vereinsmitglied

- Beiträge: 2211
- Registriert: 22.12.2002 13:22
- Wohnort: C-Town
-
achims311
- CPU-Load-Pusher

- Beiträge: 289
- Registriert: 30.10.2007 13:38
- Wohnort: Strassen
-
achims311
- CPU-Load-Pusher

- Beiträge: 289
- Registriert: 30.10.2007 13:38
- Wohnort: Strassen
-
M. Franckenstein
- Vereinsmitglied

- Beiträge: 5933
- Registriert: 23.07.2001 01:00
- Wohnort: Oldenburg
-
achims311
- CPU-Load-Pusher

- Beiträge: 289
- Registriert: 30.10.2007 13:38
- Wohnort: Strassen


