TorGhost – channel all traffic through tor network in kali linux

Tor is one of the best freely available network to protect your identity. Its considered safe because of its highly cryptographic data transfer methods. I’m not going to explain working of tor in detail, if you are interested pls read my previous blog on How to change tor exit node manually. You can switch between exit nodes every 10 seconds manually. Here  i have made a new script TorGhost for your ease.

Two main features of TorGhost

1. Routes all traffic

TorGhost can route all the network traffic through tor network i.e. every single application that tries to connect internet will go through tor network. No single ping will be leaked out, thus protecting your identity. Normally most of us use proxychain or similar application to route the traffic for a specific app. The problem is some application tends ignore proxy for much faster connection which can leak out sensitive information thus revealing your original identity or location. TorGhost can prevent you from this worst scenario. TorGhost set up a certain rules in iptables to route all outgoing connection though a certain proxy port. It also reject some sensitive incoming and outgoing request which may leak your original ip address.


2. DNS leak protection

DNS leak one of the serious issue in network security that most of us don’t know. Government organisations hunts down most of the hackers using this vulnerability. No matter how safe you encrypt dns leak is a serious issue. for more info:  What is DNS leak and how it affects your anonymity . TorGhost have a solution for that too. It can use a remote and anonymous DNS server to resolve hostname unlike other unsafe applications that uses dns provided by your ISP.



Video Demo


Download and Install TorGhost

Open the terminal and follow the commands.

# git clone
# cd torghost

chmod installer and install torghost

# chmod +x
# ./

Everything is ready. Now just open the terminal and type “torghost

To start torghost type the following command

# torghost start

To stop torghost type the following command

# torghost stop

After this you no longer have to setup manual proxy for each applications such as browsers. Any doubts or questions? post it on the comment section below. If you like this blog give me a like on facebook and add me on google plus. Subscribe my youtube channel for video tutorials.

susmith HCK

susmith HCK

I’m a computer enthusiast basically and i love to write blogs on tech issues and cyber security. I started penetration testing at the age of 16 and i would like to explore security vulnerabilities and latest tech news and wanna share with you. If you like all these stuffs add me on Facebook and Google plus.

You may also like...

23 Responses

  1. Me says:

    Hi, thanks for sharing.

    However, I have an issue trying to make torghost work: it is stuck at “Fetching IP”. Is there a fix for this problem ?

  2. darky says:


    This is good, I check it thru website leak test and it pass. But I want to make sure that in terminal commands everything pass to it. Can you give me some advise where I can see that traffic really goes to it. Thanks so much.

  3. zolarious says:

    mine is stuck on “Fetching current IP” no matter how long I leave it, it doesn’t acquire and IP
    is there any solution?

    • “Fetching the ip” actually means its searching a third party server for public IP even though if it fails you have already got an ip, you can check it with your browser. little bug fix needed in the code ill do it soon.

      • zolarious says:

        I think some how tor is blocked by my isp ( saudi arabia) as it’s not working on windows either, and I have also tried toriptables2 script and also it wasn’t able to get an ip address.
        I am trying to figure out how to install a cutome tor bridge to check of that will solve the issue

  4. zolarious says:

    I found what was wrong with mine
    I was trying to run it from a live usb kali linux, which most of it’s packages including tor needed to be updated
    so I have switched to persistent mode updated all the packages
    simply by writing these commands in terminal
    apt-get update
    apt-get upgrade
    apt-get dist-upgrade
    then installed tor by this command:
    apt-get install tor
    then downloaded torghost, installed it and voi la tor is working, torghost is working too.

  5. kirib says:

    Installing tor bundle
    E: Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable)
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
    =====> Installing TorGhost
    =====> Done
    =====> Open terminal and type ‘torghost’ for usage

    I have this problem when installed torghost, can you give solution?

    • thegargol says:

      maybe you can rname archives lock in apt-get folder with :
      mv /var/lib/dpkg/lock /var/lib/dpkg/lock_bak


  6. Dsiak says:

    Successful in a persistent kali 19/02/2017

    this is sun g00d script boi, gratz thxvm ~s2

  7. vagrant_ says:

    Same can be achieved simply by running tor normally and setting a Manual Proxy with socks set to localhost ( on port 9150.

    Now all your traffic should be directed through tor services.


    please advise if this is a dumb method. It seems to work perfectly for me.

  8. run3r says:

    I instaled in ubuntu 16.04, probably I make a disaster. Now my firefox doesnt work. I use kali linux but I want to try this script in ubuntu.

    Thanks for your work!!

  9. N0m0Fud says:

    This only routes IPv4 traffic through Tor. Might be worth a look to include IPv6 traffic as well.

  10. nokog says:

    This seems to require sudo to run, on Debian Jessie.

  11. Mister says:

    I’ve sshd into my server and started torghost, but now I can’t connect back to it. Is there any workaround for this?

  12. HECTOR BARAJAS says:

    Hangs on fetching IP for the longest time. Updated, upgraded, nothing seems to work. Torghost isnt working for me

  13. kieon says:

    Nice i learn some thing today

  14. hexyn says:

    how to uninstall torghost

    i m intalling torghost then nothing is change and my browser is not connected to internet when i install it

  15. nima says:

    thanks a lot for making this awesome script. I was using it some days ago and it worked awesome but from last night it keeps showing this lines and I can’t use it anymore. What should I do? please explain them in way understandable to a script kiddie :))

    [18:19:07] Torrc file already configured
    [18:19:07] DNS resolv.conf file already configured
    Failed to start tor.service: Unit tor.service not found.
    [18:19:07] Starting tor service.. [done]
    sh: 3: ‘debian-tor’:: not found
    iptables v1.6.1: owner: Bad value for “–uid-owner” option: “-j”
    Try `iptables -h’ or ‘iptables –help’ for more information.
    iptables v1.6.1: owner: Bad value for “–uid-owner” option: “-j”
    Try `iptables -h’ or ‘iptables –help’ for more information.
    [18:19:07] setting up iptables rules [done]
    [18:19:07] Fetching current IP…
    [18:19:07] CURRENT IP :

  16. Fyr says:

    Running Torghost successfully on Kali Linux 18.1 HDD install.
    Have now tried to run on KaliLinux LivePersistence and get this output:

    [13:03:22] Torrc file already configured
    [13:03:22] Configuring DNS resolv.conf file.. [done]
    Failed to start tor.service: Unit tor.service not found.
    [13:03:22] Starting tor service.. [done]
    sh: 3: ‘debian-tor’:: not found
    iptables v1.6.1: owner: Bad value for “–uid-owner” option: “-j”
    Try `iptables -h’ or ‘iptables –help’ for more information.
    iptables v1.6.1: owner: Bad value for “–uid-owner” option: “-j”
    Try `iptables -h’ or ‘iptables –help’ for more information.
    [13:03:23] setting up iptables rules [done]
    [13:03:23] Fetching current IP…
    [13:03:23] CURRENT IP :

    Your comment will be appreciated

Leave a Reply

Your email address will not be published. Required fields are marked *