Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trouble following #2

Open
dzechai18 opened this issue Apr 27, 2020 · 23 comments
Open

trouble following #2

dzechai18 opened this issue Apr 27, 2020 · 23 comments

Comments

@dzechai18
Copy link

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
Copy link
Author

dzechai18 commented Apr 30, 2020

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
Copy link
Owner

nneonneo commented Apr 30, 2020

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:

  • To add to the home screen, you now have to use the wrench -> "shortcuts" button. Instructions were updated to reflect this.

  • The point of this script is the following: suppose you have a cellular plan that is unlimited or substantially unlimited for normal (phone) data, but has a limited tethering plan (no tethering at all, low bandwidth cap, or low speed cap). Then you can use this to "fake-tether" your phone in such a way that all traffic comes from the phone itself - this way, your computer's traffic will access the internet using your normal cellular connection rather than the tethering connection.

  • I only recommend an ad-hoc network if you can't tether at all, because it's trickier to set up. The normal (non-ad-hoc) setup is as follows:

    1. Tether your computer to your phone normally, via WiFi or USB tethering.
    2. Run the socks5 proxy server on your phone.
    3. Configure your web browser or OS to use the phone as the SOCKS proxy in your network settings. To set the proxy, search for instructions for your OS or browser (Google "set proxy server <os/browser>"). For example, here's the Apple help page for setting a proxy on macOS: https://support.apple.com/en-us/guide/mac-help/mchlp2591/mac

    If it works, the socks5 proxy app will start spitting out a lot of messages showing all the connections that are being made through the proxy (and thus through "fake tethering").

@nneonneo nneonneo reopened this Apr 30, 2020
@nneonneo
Copy link
Owner

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

@dzechai18
Copy link
Author

dzechai18 commented May 1, 2020

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/iCloudcomomz-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.

  1. 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
Copy link
Author

7D8899CC-AA32-4845-B8D2-C6C3E874DE8E
Uploading 31B9D067-AD67-4530-889F-7E9A6073E846.png…

@dzechai18
Copy link
Author

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

@dzechai18
Copy link
Author

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

@nneonneo
Copy link
Owner

nneonneo commented May 1, 2020

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
Copy link
Author

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
Copy link
Author

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

@dzechai18
Copy link
Author

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
Copy link
Owner

nneonneo commented May 2, 2020

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
Copy link
Author

dzechai18 commented May 3, 2020 via email

@nneonneo
Copy link
Owner

nneonneo commented May 3, 2020

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: #2 (comment) shows roughly what I expect to see, except for one problem. What it's saying is the following:

  • It expects clients (like your MacBook) to connect to the server (your iPhone) over WiFi (en0)
  • It will try to use your cellular data connection to connect to the internet (pdp_ip0). Yes, it is possible for apps to explicitly specify which connection they want to use, although very very few apps actually do. Your LTE connection is always on (assuming you don't disable cellular data) even when WiFi is enabled. This is a configuration I have tested to work in the past.
  • Your iPad doesn't support directly setting a SOCKS proxy. I encountered that too, which is why a PAC URL (the wpad.dat thing) is provided. You can use that URL in by selecting Configure Proxy -> Automatic -> URL. The iPad does support SOCKS proxies, it just doesn't support them with the "Manual" proxy setting.
  • The most significant problem is dnspython. This is a package that allows DNS (the service that translates website names into IP addresses) to go over the cellular connection too. Without it, your iPhone falls back to making DNS requests over WiFi, which doesn't work. I fixed this (just now) by bundling a copy of dnspython with this SOCKS server. Hopefully, that will fix this issue.

@dzechai18
Copy link
Author

dzechai18 commented May 3, 2020

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
Copy link
Author

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
Copy link
Author

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

@dzechai18
Copy link
Author

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
Copy link
Owner

nneonneo commented May 13, 2020 via email

@dzechai18
Copy link
Author

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

@nneonneo
Copy link
Owner

nneonneo commented May 13, 2020 via email

@dzechai18
Copy link
Author

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants