Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

A Bash script for wget and Tor.

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
hack3rcon
Posts: 746
Joined: 2015-02-16 09:54
Has thanked: 48 times

A Bash script for wget and Tor.

#1 Post by hack3rcon »

Hello,
I want to change below Bash script for using Tor and send request to a website with new IP address:

Code: Select all

for i in {1..5}; do wget "URL" -O /dev/null; sleep 5; done
But, How can I understand that the Tor new identity established? If I use

Code: Select all

# service tor restart
Then how can I sure Tor got the new IP addresses and then "wget" sending new request to the website with that new IP address?

Thank you.

arzgi
Posts: 1185
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 31 times

Re: A Bash script for wget and Tor.

#2 Post by arzgi »

hack3rcon wrote: Then how can I sure Tor got the new IP addresses

Code: Select all

$ ip -br a

# service tor restart

$ ip -br a
EDIT:

If you need just an IP address, you can filter above command using for example sed.

EDIT2:

No need for filter.

Code: Select all

hostname -i

hack3rcon
Posts: 746
Joined: 2015-02-16 09:54
Has thanked: 48 times

Re: A Bash script for wget and Tor.

#3 Post by hack3rcon »

When I restart the Tor service then it need sometimes to connecting to a Tor node. How can I sure the Tor connection is established and then the next command execute?

hack3rcon
Posts: 746
Joined: 2015-02-16 09:54
Has thanked: 48 times

Re: A Bash script for wget and Tor.

#4 Post by hack3rcon »

Any idea?

reinob
Posts: 1189
Joined: 2014-06-30 11:42
Has thanked: 97 times
Been thanked: 47 times

Re: A Bash script for wget and Tor.

#5 Post by reinob »

hack3rcon wrote:Any idea?
If you just want to create a new circuit you don't need to (and you should not) restart tor.
Just tell it to renew:

Code: Select all

$ printf "AUTHENTICATE \"\"\r\nSIGNAL NEWNYM\r\n" | nc 127.0.0.1 9051
(if your ControlPort is not 9051, then adjust accordingly).

hack3rcon
Posts: 746
Joined: 2015-02-16 09:54
Has thanked: 48 times

Re: A Bash script for wget and Tor.

#6 Post by hack3rcon »

Thank you, but first of all, Tor should be configured: https://gist.github.com/DusanMadar/8d11 ... d87b999f6b

Post Reply