nneonneo / iOS-SOCKS-Server

iOS HTTP/SOCKS proxy server for fake-tethering
266 stars 33 forks source link

trouble following #2

Open dzechai18 opened 4 years ago

dzechai18 commented 4 years ago

Hi,

Thank you so much for putting these files and instructions together. I have a limited Tmobile 10gb cellular hotspot plan that I need to maximize during this time of quarantine because I have no wifi at home. (Comcast Xfinity is the monopoly internet service provider in my area. It has been extremely unreliable and I had to cancel it.)

I'm completely new to Python and data networking, so I couldn't quite understand your instructions and was wondering if you can walk me through it, or better yet create a video walkthrough so it's clear?

INSTALLATION: 1) I downloaded Pythonista from apple store. 2) I downloaded the code from the GitHub link. 3) I was not able to unzip the files in the FILES app, but in Pythonista under "SCRIPT LIBRARY >> This iPhone" I was able to unzip the files and move them over to "SCRIPT LIBRARY >> iCloud". Is this what you mean when you write "move the package to the Pythonista iCloud directory"? 4) I could not find the "socks5.py" script anywhere inside the unzipped "socks5-ios-master" folder. So I downloaded the "socks5.py.html" file that you posted, but I'm not sure whether to put it in the "SCRIPT LIBRARY >> This iPhone" or "SCRIPT LIBRARY >> iCloud". Regardless of which of the 2 folders I put it in, when I click on this "socks5.py.html" file I see the codes but the RUN triangle button is greyed out. 5) The wrench icon doesn't allow me to add the script to my homescreen either. I'm not sure what I'm doing wrong. Can you explain/help?

RUNNING: 1) I am able to connect to the Xfinity mobile public hotspot for free for 1 hour each month, so I can connect both my laptop and phone to this service to follow your instructions, but I'm not sure why this is required and what would happen once the free hour is over. I thought the whole point is to run my cellular hotspot and prevent the carrier from throttling the speed after I reach the 10gb. Can you explain more? Can you also show how to create a computer-to-computer ad-hoc network using my laptop? I have an old mac book pro, and as far as I know if I'm on wifi on the mac then I cannot broadcast a wifi signal from the mac to other devices; I can only broadcast signal over USB for example.

2) Again, I wasn't able to create a home screen shortcut or open the socks5.py script in Pythonista and hit Run.

3) I do not understand what "Point your devices at the SOCKS proxy listed (on port 9876), or point them at the PAC (proxy autoconfiguration) URL if they don't support setting a SOCKS proxy (e.g. other iOS devices)" mean at all in laymen terms or how to even do this. Can you explain?

Thank you so much.

dzechai18 commented 4 years ago

Hi again, it seems that when I first downloaded the socks5.py script it became an html file. I was able to download it as a script and placed it on my iPhone home screen.

I basically put the unzipped GitHub file, the ipaddrs.py script, and the socks5.py script into the Pythonista icloud directory. (Your instructions never mentioned what to do with the ipaddrs.py script or where to put both it and the socks5.py script so I just assumed. Let me know if that's wrong.) However, whether I run the socks5.py script from the app or the home screen, the app crashes. I did receive an error once in the "on this iPhone" directory that says "the app was terminated due to an Objective-C exception. Details below: 2020-04-30 16:35:36.498036 threading violation: expected the main thread"

What am I doing wrong? A friend who reviewed the code said that it needs to run on version 3 of Pythonista, so I tried running the socks5.py script on all versions of Pythonista (including the "2to3" option) available on the app to no avail. Is this a bug?

nneonneo commented 4 years ago

Hello, thanks for the bug report. I had the wrong link posted in the instructions! So sorry for the confusion. Here's the correct link for downloading the code; I also updated the instructions accordingly: https://github.com/nneonneo/iOS-SOCKS-Server/archive/master.zip

As for your second problem: I have hopefully fixed the bug that caused this crash. This was caused by a recent update to Pythonista. Please re-download it and give it another shot!

Addressing a few other points:

nneonneo commented 4 years ago

I'll leave this open until you can confirm it works :)

dzechai18 commented 4 years ago

Hi, thank you for replying and clarifying the instructions in the download page. The way you explained makes sense but then the questions I have are:

1) Why do the devices and my iPhone have to be on the same WiFi network for this to work, and what do I do after the script is run and messages are spit out on the python script? That isn’t clear. Can you explain?

At first I was on the 1-hr free Xfinity public hotspot, and I manually configured my iPad WiFi’s proxy as instructed. The messages I got on the python ended with the sock proxy number, so I figured this is NOT correct since nothing further is spit out. My brother said tried putting my iPhone and iPad on the router’s home WiFi network (without connecting the router to the modem since there’s no xfinity service anymore), and then messages started spitting out that connections are made. However, there is no actual internet speed on either iPad of iPhone. (My iPhone didn’t automatically change the WiFi logo back to cellular either, which I thought may happen if the point is to rely on the cellular data plan.) The python script then spit out this error message repeatedly:

INFO:root:192.168.1.3:58967: new connection

Exception happened during processing of request from ('192.168.1.3', 58967) Traceback (most recent call last): File "/var/containers/Bundle/Application/00B458A9-7E40-4BC5-8D94-77A75ED51F37/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/socketserver.py", line 640, in process_request_thread self.finish_request(request, client_address) File "/var/containers/Bundle/Application/00B458A9-7E40-4BC5-8D94-77A75ED51F37/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/socketserver.py", line 362, in finish_request self.RequestHandlerClass(request, client_address, self) File "/var/containers/Bundle/Application/00B458A9-7E40-4BC5-8D94-77A75ED51F37/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/socketserver.py", line 697, in init self.handle() File "/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/iOS-SOCKS-Server-master/socks5.py", line 125, in handle assert version == SOCKS_VERSION AssertionError

Besides this error, the fact that there was no internet speed is disconcerting. So I tried connecting the iPad to my iPhone’s cellular hotspot (not the 1 hour free xfinity public hotspot). The LTE speed I have is 120mbps, and when my iPad is connected to my hotspot normally without proxy, it’s usually around 30mbps. When I’m testing it earlier it was surprisingly only 3mbps. However, if I set the iPad’s hotspot connection to the proxy, it then gets 0 mbps. And that’s just 1 device connected to the hotspot. At first it spit out an “BrokenPipeError: [Errno 32] Broken Pipe” error message. Upon trying again several times, the script also repeatedly spit out the same Assertion error message in the paragraph above.

I was really unsure if I should even connect it by hotspot like I just described, but that truly did not work well.

2) this brings me to the concept you described. So theoretically, I actually need an unlimited data plan, since the code is not actually fooling the cellular provider into not capping my tethering speed after a certain amount of usage, but instead is just telling the devices to route data usage through my phone’s unlimited data plan instead (e.g. it would never even touch the 10gb of personal hotspot I have)? If a person has a limited data plan like 15gb of LTE data in addition to the 10gb of hotspot, this code would not be applicable to the user because extensive usage would cause the user to exceed that 15gb of LTE data? What if the user has 15gb of LTE, but after that the speed reduces to unlimited dial up speed (which is still unlimited data, but obviously not in any way a useful speed)? The python script won’t fool the cellular provider into not throttling the user’s speed after 15gb of LTE usage?

dzechai18 commented 4 years ago

7D8899CC-AA32-4845-B8D2-C6C3E874DE8E ![Uploading 31B9D067-AD67-4530-889F-7E9A6073E846.png…]()

dzechai18 commented 4 years ago

657023FF-1D0F-43E3-9398-04E022BF86E8

dzechai18 commented 4 years ago

15CB6BD9-722B-440B-A401-8BCE60847710

nneonneo commented 4 years ago

The fact that the phone is getting connections is good. Unfortunately, as you can see something's set up wrong. Did you set up the proxy as a SOCKS Proxy in your settings? The confusing thing is that there are both "HTTP proxies" and "SOCKS proxies"; if you set it up wrong you will confuse this proxy. If you are using a Mac, you should put the proxy only in the SOCKS Proxy field and leave all other proxy options unchecked (or, fill in the wpad.dat URL in the Automatic Proxy Configuration).

Also, no, this doesn't automatically fool a provider into giving you unlimited speeds and bandwidth. It simply uses your mobile data rather than tethering data. I've been on T-Mobile, and they don't throttle mobile data until a fairly high limit; I never ran into it myself. Nevertheless, I probably wouldn't recommend streaming video constantly over this connection!

dzechai18 commented 4 years ago

The iPad getting connection was through the iPhone’s Tmobile hotspot and not through WiFi, so I don’t think that was a valid test.

On the iPad last night, I could only configure the http proxies. There wasn’t an option for socks proxy, presumably because I haven’t jailbreak my iPad to do that. This morning, I just tested on my old Mac book pro. I made sure to put in the SOCKS proxy field as you said, and even tried using the socks5 proxy field in Firefox, but both still have the same error, as seen below.

57656071-FB6A-4A2D-A41C-9934B5DF92D4

dzechai18 commented 4 years ago

1745A697-2087-4E37-8EF7-D3E5FA7B93D4

dzechai18 commented 4 years ago

In the above scenario with the MacBook, I again used the WiFi network from the router (without the modem). If there is a successful connection, what is supposed to happen on my iPhone? Will the iPhone internet icon change from WiFi back to LTE? Will my iPhone still be able to use regular internet while I’m running this socks5 script? I still don’t understand how the iPhone and MacBook both being on a fake WiFi network through a socks5 proxy will actually use my iPhone cellular internet.

nneonneo commented 4 years ago

Could you confirm a suspicion for me? Try accessing https://1.1.1.1 from your laptop browser when you're connected to the proxy like this (iPhone & Macbook both connected to WiFi). If my suspicion is correct then this will connect successfully and drop you onto a page hosted by Cloudflare.

If that does work, I'll ship a fix shortly that should make it possible to access any site.

dzechai18 commented 4 years ago

I put the MacBook on sock proxy and connected it to the home WiFi network (with no internet) before trying. Neither the iPhone nor MacBook loaded the page or any page.

On Sat, May 2, 2020 at 4:56 AM Robert Xiao notifications@github.com wrote:

Could you confirm a suspicion for me? Try accessing https://1.1.1.1 from your laptop browser when you're connected to the proxy like this (iPhone & Macbook both connected to WiFi). If my suspicion is correct then this will connect successfully and drop you onto a page hosted by Cloudflare.

If that does work, I'll ship a fix shortly that should make it possible to access any site.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nneonneo/iOS-SOCKS-Server/issues/2#issuecomment-622902944, or unsubscribe https://github.com/notifications/unsubscribe-auth/APLS47URXVQ5W62RNXBQUXLRPPN2ZANCNFSM4MSHONTQ .

nneonneo commented 4 years ago

I'm sorry you're having trouble with it. You're one of the first people to try and use it besides myself, so I'm discovering a lot of places where I've simply made assumptions about the way my setup works that aren't generally applicable. I really appreciate your patience!

As far as I can tell, the screenshot you shared here: https://github.com/nneonneo/iOS-SOCKS-Server/issues/2#issuecomment-622480733 shows roughly what I expect to see, except for one problem. What it's saying is the following:

dzechai18 commented 4 years ago

It’s my pleasure to work with such a smart and talented programmer! I also appreciate your patience in working with me since I’m very new to this.

I do have the cellular data turned on all the time because I expected the internet connection to actually come from cellular (I just didn’t understand how the script is doing it because I don’t know python), and I did try the URL too on the iPad.

I’m going to be away for several days, but I will download your new script next Friday and test it again, so please don’t close this issue yet.

dzechai18 commented 4 years ago

Hi, I apologize for the tardiness. I re-downloaded the code but it’s not even showing a connection, as you can see below. A9FAEF26-EE65-4CFA-A6CC-2E032A425860

dzechai18 commented 4 years ago

After I turned off the sock proxy I got this error message: 366B12A8-C1BC-4C34-B4E3-ACDDC9BDFF7B

dzechai18 commented 4 years ago

I also want to note that at first when I ran the socks5 script there was a long error message, but I forgot to capture that message and couldn’t replicate it.

nneonneo commented 4 years ago

This output seems fine to me. There are no errors in the log. The red text here is debugging info, showing you what connections are being made.

Robert

On May 12, 2020, at 10:54 PM, dzechai18 notifications@github.com wrote:

 After I turned off the sock proxy I got this error message:

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

dzechai18 commented 4 years ago

I will try again tmr, but the WiFi did not switch to my cellular connection.

nneonneo commented 4 years ago

It’s not supposed to! The proxy intelligently routes traffic over the cellular connection even when the WiFi is active.

Robert

On May 12, 2020, at 11:29 PM, dzechai18 notifications@github.com wrote:

 I will try again tmr, but the WiFi did not switch to my cellular connection.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

dzechai18 commented 4 years ago

That’s what I hoped to see too, but I’ve been trying for the past few days and it’s not doing that. Today, I noticed that 40 new files were created in the python iCloud folder and the socks5.py script was automatically deleted. So I followed the process again. Those 40 new files were again created, but I haven’t seen the socks5 script being deleted yet.

D794E357-4D92-4541-ABA9-832EA0D1E22C

dzechai18 commented 4 years ago

820736FB-6A2A-4C0B-B6AE-7F6BCEB9F41D