A Bash script for wget and Tor.

Need help with C, C++, perl, python, etc?

A Bash script for wget and Tor.

Postby hack3rcon » 2020-02-23 05:30

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.
hack3rcon
 
Posts: 421
Joined: 2015-02-16 09:54

Re: A Bash script for wget and Tor.

Postby arzgi » 2020-02-23 12:54

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
arzgi
 
Posts: 639
Joined: 2008-02-21 17:03
Location: Finland

Re: A Bash script for wget and Tor.

Postby hack3rcon » 2020-02-25 08:40

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: 421
Joined: 2015-02-16 09:54

Re: A Bash script for wget and Tor.

Postby hack3rcon » 2020-03-10 13:42

Any idea?
hack3rcon
 
Posts: 421
Joined: 2015-02-16 09:54

Re: A Bash script for wget and Tor.

Postby reinob » 2020-03-10 16:07

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).
reinob
 
Posts: 809
Joined: 2014-06-30 11:42

Re: A Bash script for wget and Tor.

Postby hack3rcon » 2020-03-11 06:27

Thank you, but first of all, Tor should be configured: https://gist.github.com/DusanMadar/8d11026b7ce0bce6a67f7dd87b999f6b
hack3rcon
 
Posts: 421
Joined: 2015-02-16 09:54


Return to Programming

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable