Showing posts with label hide ip for bash commands. Show all posts
Showing posts with label hide ip for bash commands. Show all posts

Monday, May 21, 2018

Run bash command with different external IP address

To run bash commands like nmap, mysql, psql, you need to hide your external IP address, if you do not want your external IP should be logged on remote server.

I am pretending you are already using http proxy or sock proxy.

To do this, open terminal and run following commands.

export http_proxy=ip-address:port-number
export https_proxy=ip-address:port-number


Example :
export http_proxy=35.192.xx.xx:3128
export https_proxy=35.192.xx.xx:3128

If you have installed Tor in ubuntu/centos/fedora and it is running on 9050 port, run command to export sock proxy.
 
export http_proxy=127.0.0.1:9050
export https_proxy=127.0.0.1:9050

Now if you run commands like mysqldump or pg_dump or mysql or psql, it will not log your IP address in remote server log.

Solution : II

If you are using tor, you can use torsocks command before these commands to hide your IP

torsocks mysql -h 39.xx.xx.xx -u root -p
The remote server ip 39.xx.xx.xx, will not log your external IP in its log, it will log the tor ip which you are currently using as a sock proxy.