|Feb 2, 2012, 10:18 AM||#1|
Simple Script for Ad-Hoc SOCKS Proxy iPhone Tethering
I made a simple Mac Applescript application to create and set up an Ad-Hoc SOCKS Proxy network to tether your iPhone. It's really basic and I've included the source code. Feel free to check it out, make modifications, comment, ask questions, or correct any bugs. Here's the code:
--modify the following lines and script as much as needed, NetworkPassword must be at least 10 digits. --this is the name of the network property NetworkName : "Tethering" --this is the WEP password for the network property NetworkPassword : "1234567890" --this is the SOCKS Proxy Server IP Address property SocksIP : "220.127.116.11" --this is the SOCKS Proxy Server Port property SocksPort : "20000" -- create ad-hoc network tell application "System Events" tell process "SystemUIServer" tell menu bar 1 -- find Wi-Fi Menu set menu_extras to value of attribute "AXDescription" of menu bar items repeat with the_menu from 1 to the count of menu_extras if item the_menu of menu_extras contains "Wi-Fi" then exit repeat end repeat -- turn on Airport then create ad-hoc network tell menu bar item the_menu perform action "AXPress" -- if Airport is off, turn it on if title of menu item 2 of menu 1 is "Turn Wi-Fi On" then perform action "AXPress" of menu item "Turn Wi-Fi On" of menu 1 perform action "AXPress" end if --if Airport is on, create the ad-hoc network perform action "AXPress" of menu item "Create Network…" of menu 1 end tell end tell -- Enter information into Create Network dialog box tell window 1 -- require password click pop up button 2 -- set to 40-bit WEP click menu item "40-Bit WEP" of menu 1 of pop up button 2 --change channel click pop up button 1 --set to channel 6 click menu item "6" of menu 1 of pop up button 1 --fill in information set value of text field 2 to NetworkPassword set value of text field 3 to NetworkPassword --set name of the network set value of text field 1 to NetworkName --the okay button doesn't show up unless you delete a character and re-enter it click text field 3 keystroke (ASCII character 8) keystroke "0" -- click OK click button 1 try repeat while value of static text 3 is "Creating network…" delay 0.5 end repeat end try end tell end tell end tell tell application "System Preferences" activate set current pane to pane "com.apple.preference.network" end tell tell application "System Events" get properties tell process "System Preferences" tell window "Network" -- Selects the active network connection tell table 1 of scroll area 1 click row 1 end tell tell group 1 if not (exists button "Turn Wi-Fi Off") then display dialog "Please Click The Wi-Fi Row" repeat while not (exists button "Turn Wi-Fi Off") delay 0.3 end repeat end if end tell --Select the Advanced button click button "Advanced…" --Select the Proxies tab tell tab group 1 of sheet 1 -- delay 1 click radio button 6 tell group 1 tell table 1 of scroll area 1 set selected of row 6 to true if value of (checkbox 1 of row 6) is 0 then display dialog "SOCKS Proxy OFF" click checkbox of row 6 end if end tell tell group 1 set value of text field 1 to SocksIP set value of text field 2 to SocksPort end tell end tell end tell tell sheet 1 click button "OK" end tell end tell tell window "Network" click button "Apply" end tell end tell end tell tell application "System Preferences" quit end tell
While you still have to connect to the network, enter the WEP Password, and set up the static IP address on the iPhone, this script saves a lot of time setting up the Mac side.
1. Run the script
2. Connect to the "Tethering" Wi-Fi network on your iPhone/iPad
3. Enter the passcode: 1234567890
4. Set the static IP Address on your iPhone to 18.104.22.168 with the subnet mask 255.255.255.0
5. Finally, run iRandomizer Numbers (or your tethering app of choice)
|Feb 4, 2012, 09:12 AM||#2|
Thanks for the script! I'm having some troubles though...
I can get the two devices to talk using the Web Proxy (HTTP) in my Mac side with the Proxy IP supplied by iRandomizer, but I can't seem to get my SOCKS proxy working! I'm just using the Proxy ID from iRandomizer for the Mac side, but iRandomizer just says "Unsupported SOCKS protocol"...
Any help? I'd really like to get this to work...!
Edit: Got it to work!!!
The other guides showed the HTTP proxy usage... but after further research, you don't need to use it!
So for all the other fellas and ladies out there, you don't need http, just use SOCKS!
Last edited by coder12; Feb 4, 2012 at 09:44 AM.
|Apr 26, 2012, 07:35 AM||#3|
Hey sorry to bother I bought handylight pro and have followed many detailed tutorials getting close to tethering (airport status was green and connected) but always all browsers I tried read proxy error. Is it possible to explain to a complete newb with no code experience how to get this ball rolling please or am I no chance at grasping this? Dam Optus pre Paid restrictions ! I have iPhone 4s latest update cheers
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|How to fix this Geektool Script for Lion?||its||Mac OS X 10.7 Lion||9||Jun 21, 2012 06:30 PM|
|Tether Wi-fi signal. not 3G.||-BigMac-||iPhone||14||Jan 2, 2012 08:27 AM|
|o2 UK tethering now included||fabian9||iPhone||22||Sep 21, 2011 07:04 AM|
|looking for a specific automation/script for itunes ... >||eroxx||Mac OS X||0||Jun 4, 2011 07:17 PM|
|iPhone Tether & Internet Sharing over LAN||Stuart in Oz||Mac OS X||3||Nov 7, 2010 05:50 AM|
All times are GMT -5. The time now is 01:37 AM.