It's me :)Thireus' Website
linkedin | CV | PGP key | about | search | register | --:--:--
Take the blue pill!
User:  Pass: 
How To Get Socks Proxy + SSH Tunneling To Work On A Jailbroken iPhone/iPod Touch/iPad PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Thireus   
Wednesday, 28 April 2010 22:49

This article is not for noobs, I'm not gonna explain how things work. I'm just providing all the required files to have a socks proxified connexion with a jailbroken iPhone/iPod Touch/iPad.

If you are not good at French, use Google Translate.

Download this archive: Socks_Proxy_iPhone_Thireus_Pack.zip ~ 12ko

 

You'll find in it, two folders.

 

mobile_folder --> Files need to be put into your mobile folder on your phone (home directory)

ssh :

This script needs to be edited for your own configuration. This script must be called by the Terminal application on your iDevice after every reboot of the device (I personally don't want to launch it automatically). This script will automatically connect you via ssh to your server every time the device gets connected to a Wifi network (you can also ask it to open a tunnel over 3G, please read the source code to activate it!).

black_hole_http_server.pl + null.gif :

These files are needed to get a black hole http server, this is where banned requests are sent, and they get a null.gif reply, so for example banned ads will show a null.gif image (this actually doesn't work as expected... and I really don't know why, the first time the script is launched it works well and we can see the null.gif instead of ads, but after we get a 404 image :-/. If someone knows why please contact me!)

server --> Files need to be put on your server, or on the internet

proxy_rules.pac :

This file provides the rules whether the requests are sent to the black hole or via your ssh tunnel Wink You have to make it available over the web, because this file will be called into your network settings and OS 3 doesn't allow us to use local pac files. For 3G network you have to edit your network pref plist file and enter the URL manually.

Some screenshots:

socks_proxy_1.PNGsocks_proxy_2.PNG

Note: I don't use socks over 3G anymore because every 10Mo of downloaded data the tunnel gets resetted.

Note 2: Obviously you need to install perl, ssh, etc...


Only registered users can write comments!
Comments

ThePapanoob
2012-05-11 17:20:08
-------------------------

Hey Thireus,
i want to run this without the blackhole http
so i said no in the config but it doesn't forward my traffic
any suggestions? :-/

Thireus
2012-05-11 17:34:05
-------------------------

Have a look here: http://blog.thireus.com/how-to-get-socks-proxy-ssh-tunneling-to-work-on-a-jailbroken-iphoneipod-touchipad.

This blog is no more active.

BTW I should provide a more comprehensive tool soon. Wait & see...

marciton
2011-08-04 23:11:29
-------------------------

Bonjour,
j'aimerai utiliser ce hack pour utiliser une application tel que franceTelevision tout en étant à l'étranger.
l'idée est d'avoir le proxy sur mon NAS qnap ...
est-ce dans la logique?
(j'ai monté un proxy http squid mais ça ne marche pas pour les applications ...)

Thireus
2011-08-05 01:33:03
-------------------------

Oui tout à fait, il suffit que le NAS fasse tourner un serveur ssh et que l'iPhone puisse s'y connecter et le tour est joué Wink

Attention cependant, certaines applications arrivent à détourner le proxy de l'OS Sad, mais c'est un cas assez rare. A voir si ça fonctionne avec l'application en question Wink

Tenez-moi au courant du résultat!

marciton
2011-08-17 23:54:06
-------------------------

bonjour,
j'avance pas mal,j'ai juste besoin d'une mini clarification sur les parameters qu'il faut mettre dans le script ssh:

DNS_TO_PING et DNS_TO_IP

doit on mettre des infos dns local à utiliser?
j'utilise les dns google donc là c'est pas terrible ...
le nas est derrière une box free , doit je mettre des parameters free?

j'utilise ce NAS pour faire un tunnel SSH depuis le PC donc le but est de faire là meme chose via iOS

l'autre parametre à modifier est SSH_SERVER , le reste peux rester tel quel?

Thireus
2011-08-18 00:08:13
-------------------------

DNS_TO_PING --> Soit une IP, soit un nom de domaine, de préférence le serveur où tourne sshd, vers celui chez qui on va se connecter.
DNS_TO_IP --> Il semble que je n'utilise pas cette variable. Elle ne sert à rien.

DNS_TO_PING sert à s'assurer que l'on est bien connecté à Internet et/ou que le serveur distant est accessible. Donc il vaut mieux utiliser l'adresse IP externe de la box pour votre cas.

Oui, SSH_SERVER est à modifié, le reste peut rester tel quel.

Si j'ai le temps je créerai une version améliorée de mon script, peut-être un binaire ou un packet Cydia serait plus comode. Car je l'utilise maintenant depuis plus d'un an pour mon Mac et pour mon iPhone, j'y ai d'ailleurs apporté pas mal de petites améliorations, comme le multiplexage SSH.

marciton
2011-08-20 00:30:31
-------------------------

une version simplifier serai pas mal pour certain ... ( une source pour le perl par exemple)
pour DNS_TO_PING , vu que j'utilise un DNS Dynamic je vais voir si ça foncionne.
je teste aussi sous iOS 5 pour voir si c'est compatible.

Merci de l'idée en tout cas si ça fonctionne ça me sera trés utile pendant mes voyage

si j'arrive à une version qui tourne pas de probléme pour faire le beta testeur , j'ai la chance d'avoir un iPhone que je peux dedier aux tests

update: ce qui bolquai avant pour moi est dans la ligne de connection , le port n'est pas reporté ( il manque -p $DNS_TO_PORT)

par contre maintenant je bloque sur could not request loacl port forwarding..." a suivre

sunrose2510
2011-05-04 17:57:11
-------------------------

Hello i'm newbie
Please Help me
i run ./ssh it Permission denied
how i can run ./ssh and i try i have type su root but it still Permission denied
Please hlep me !!! i have install Perl
ple help me

thank you so much

Thireus
2011-05-05 04:40:04
-------------------------

You don't need to be root to run this script.

Check file owner and permissions.

chown yourusername:yourusername FILES
chmod u+x SSH_SCRIPT

Learn more here: http://www.tuxfiles.org/linuxhelp/filepermissions.html

Thi.

sunrose2510
2011-05-05 12:25:25
-------------------------

Thanks Admin help chmod file SSH
it run but how to work ??? Help me i newbie


Jackson-Lees-iPod:/var/mobile root# ./ssh
Starting ssh script...
Is the black hole already launched?
./ssh: line 49: nc: command not found
Black Hole is already launched!
Waiting for Wifi to be alive...
./ssh: line 70: ifconfig: command not found
./ssh: line 70: ifconfig: command not found
./ssh: line 70: ifconfig: command not found
./ssh: line 70: ifconfig: command not found

Thireus
2011-05-05 18:53:02
-------------------------

I understood you are a newbie, you told it twice. But that doesn't mean I have to spend my time helping you on such basic and easy stuffs. You should learn by yourself, make google searches, turn on your brain and stop asking immediately.

Like I said: "This article is not for noobs, I'm not gonna explain how things work. I'm just providing all the required files to have a socks proxified connexion with a jailbroken iPhone/iPod Touch/iPad."

nc is netcat.

You can get both netcat and ifconfig on cydia.

http://tech.ivkin.net/wiki/IPhone_Notes

Don't take it too personally.

DualFever
2010-10-14 16:20:03
-------------------------

Can we have a noob tutorial please?

I am not able to connect to a socks proxy for my whole iphone, only a http proxy on safari.

Thireus
2010-10-22 01:28:53
-------------------------

No, sorry.

TidusBlade
2010-09-12 02:07:17
-------------------------

HOLY SHIT IT WORKS! This was the only guide I found about using SOCKS5 proxies on an iPhone and damn it went by quicker than I thought! It's always such a roundabout way to get some stuff working but at least you made it easier Razz

Thanks for the awesome post Wink

Only thing I encountered was the ssh script reporting that the nc command is not available so maybe mention that you need netcat (Assuming nc = netcat) for the script to function properly. I just commented out the nc commands and put in echo's so that the tests right after the nc command don't fail. Dirty solution lol but it works Razz Don't think it was necessary though, script worked even without nc before commenting but I hate the look of "command not found" from a script xD

EDIT: Was using an iTouch 2G if it matters.

Thireus
2010-10-22 01:28:06
-------------------------

Thanks.

But you should not use the script without netcat. netcat checks if you already have launched the black hole or if the server where you want to connect to is available. If nc fails then nothing is launched. If you delete the nc lines, then your ipod will be overloaded when your server is not available or if your black hole has already been launched.

netcat is available on Cydia, saurik provides it.

Gaaz
2010-08-20 09:51:56
-------------------------

Great article Thireus, EXACTLY what I was looking for. This is the first and only thing I've really found in regard for a way to use my private VPS on my iphone to tunnel in with ssh and browse privately on wifi/edge/3g.

I got everything setup and configured within a few minutes, works great and I'm actually very pleased. My only problem is I can ONLY get it to work over WiFi, I can't get edge to route through my VPS. It appears to start the black hole and login to my server as it does through WiFi, but it's simply not directing the traffic through there, rather it just uses the edge connection as if I had done nothing.

I've changed the SSH file to allow 3G/Edge by setting WIFI ONLY to NO. I'm curious if there's something I accidentally missed otherwise to get it to work through edge.

Thanks, I really appreciate it.

Thireus
2010-08-20 19:58:29
-------------------------

Hi Smile

Glad to see that my tutorial is useful for some people here Smile
I'm running OS 4.0.1 now and it still does work the same way :p

Now about your issue, you have to make some modifications to a filesystem called something like 'network.pref.plist', where you have to enable the use of PAC file for 3G and Edge as well as it might be already done for Wifi.
In this file you'll find all your network cards, so you just have to edit 2 cards, I'll tell you which ones to edit if you can't find them.

I'm in Copenhagen right now, I'll be back home in France tomorrow.

Gaaz
2010-08-20 20:57:31
-------------------------

That was enough for me to figure it out, thanks Thireus.

For anyone else that maybe stumble across this and are looking to get this working on edge/3g, you have to edit your /var/preferences/SystemConfiguration/preferences.plist

You have to find the ip1(edge) entry and slot this somewhere in there.


HTTPEnable
0
HTTPProxyType
2
HTTPSEnable
0
ProxyAutoConfigEnable
1
ProxyAutoConfigURLString
file:///private/var/root/proxy.pac


and place your proxy.pac file locally in /var/root/ for this example.

I was excited to see it working, and thanks once again Thireus, I'm sure there's others out there besides myself that appreciate your work here Smile

Thireus
2010-08-25 19:53:09
-------------------------

Wink

Go_L_Den
2010-05-19 06:08:25
-------------------------

Hey Thireus, I've been trying this and have been making considerable progress; however, it seems that when I install perl I don't have the IO\Socket.pm script as well as many other core library files (certain ones are in there and can't be recognized either). This is what it looks like when I run the script now:

Starting ssh script...
Is the black hole already launched?
localhost [127.0.0.1] 1234 (search-agent): Connection refused
Black Hole starting...
Black Hole should be ready now...
Waiting for Wifi to be alive...
Can't locate IO/Socket.pm in @INC (@INC contains: /usr/local/lib/perl5/5.10.0/arm-iphoneos /usr/local/lib/perl5/5.10.0 /usr/local/lib/perl5/site_perl/5.10.0/arm-iphoneos /usr/local/lib/perl5/site_perl/5.10.0 /usr/local/lib/perl5/5.10.0/arm-iphoneos /usr/local/lib/perl5/5.10.0 . .) at ./black_hole_http_server.pl line 9.
BEGIN failed--compilation aborted at ./black_hole_http_server.pl line 9.
inet 192.168.1.101 netmask 0xffffff00 broadcast 192.168.1.255
(ssh) open
Everything is fine... connexion is ok!

______________
As you can see, I'm having issues with perl, so if you could help it'd be great!

~ Go_L_Den

Thireus
2010-05-19 18:40:44
-------------------------

To install Perl you really need to make all steps from this how to:

http://thireus.dareyourmind.net/index.php/iphone-notes/111-iphone-perl-framework

I've just done a fresh new install of my iPhone and I can confirm everything is fine under OS 3.1.3.

Try again the "apt-get install perl", or make an update. Don't forget to be root and look for displayed errors Wink


Last Updated on Wednesday, 25 August 2010 18:29