Created
January 23, 2015 09:01
-
-
Save albang/8ee4aa80c8703d1e6715 to your computer and use it in GitHub Desktop.
[Quick and dirty] Script shell pour lancer un tunnel ssh et lancer firefox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #Sec_my_internet.sh | |
| #20150123: Script creation | |
| #version=0.1 | |
| proxy_ip="" | |
| echo "Securisation de la connexion:" | |
| port_redirection=$(netstat -laputen 2> /dev/null |grep ssh |grep LISTEN |grep "tcp "|wc -l) | |
| echo "Connexion au server:" | |
| if [[ $port_redirection -ne 1 ]] | |
| then | |
| ssh -N -D 2000 $proxy_ip & | |
| fi | |
| echo "test de l'ip" | |
| public_ip=$(curl --proxy socks5h://localhost:2000 http://ifconfig.me/ 2>/dev/null) | |
| if [[ $public_ip == "$proxy_ip" ]] | |
| then | |
| echo "lancement de firefox:" | |
| firefox -p insecure 1>&2> /dev/null | |
| else | |
| echo "FAIL :" | |
| echo $public_ip | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment