Friday, 23 May 2014

Simple Script for Ad-Hoc SOCKS Proxy iPhone Tethering


hey everyone!

made simple mac applescript application create , set ad-hoc socks proxy network tether iphone. it's basic , i've included source code. feel free check out, make modifications, comment, ask questions, or correct bugs. here's code:

code:
--modify following lines , script as needed, networkpassword must @ least 10 digits.    --this name of network  property networkname : "tethering"  --this wep password network  property networkpassword : "1234567890"  --this socks proxy server ip address  property socksip : "13.37.13.37"  --this 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 value of attribute "axdescription" of menu bar items  			repeat the_menu 1 count of menu_extras  				if item the_menu of menu_extras contains "wi-fi" exit repeat  			end repeat  			  			-- turn on airport create ad-hoc network  			tell menu bar item the_menu  				perform action "axpress"  				  				-- if airport off, turn on  				if title of menu item 2 of menu 1 "turn wi-fi on"  					perform action "axpress" of menu item "turn wi-fi on" of menu 1  					perform action "axpress"  				end if  				  				--if airport on, create ad-hoc network  				perform action "axpress" of menu item "create network…" of menu 1  			end tell  		end tell  		  		-- enter information create network dialog box  		tell window 1  			  			-- require password  			click pop button 2  			  			-- set 40-bit wep  			click menu item "40-bit wep" of menu 1 of pop button 2  			  			--change channel  			click pop button 1  			  			--set channel 6  			click menu item "6" of menu 1 of pop button 1  			  			--fill in information  			set value of text field 2 networkpassword  			set value of text field 3 networkpassword  			  			--set name of network  			set value of text field 1 networkname  			  			--the okay button doesn't show unless delete character , re-enter  			click text field 3  			keystroke (ascii character 8)  			keystroke "0"  			  			-- click ok  			click button 1  			  			try  				repeat while value of static text 3 "creating network…"  					delay 0.5  				end repeat  			end try  		end tell  	end tell  end tell    tell application "system preferences"  	activate  	set current pane pane "com.apple.preference.network"  end tell    tell application "system events"  	get properties  	tell process "system preferences"  		tell window "network"  			-- selects 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")  					display dialog "please click wi-fi row"  					repeat while not (exists button "turn wi-fi off")  						delay 0.3  					end repeat  				end if  			end tell  			  			--select advanced button  			click button "advanced…"  			--select 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 true  						if value of (checkbox 1 of row 6) 0  							display dialog "socks proxy off"  							click checkbox of row 6  						end if  					end tell  					tell group 1  						set value of text field 1 socksip  						set value of text field 2 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
this script designed use application "irandomizer numbers" ios tethering app that's still in app store (get while lasts).

while still have connect network, enter wep password, , set static ip address on iphone, script saves lot of time setting mac side.

use:
1. run script
2. connect "tethering" wi-fi network on iphone/ipad
3. enter passcode: 1234567890
4. set static ip address on iphone 13.37.13.37 subnet mask 255.255.255.0
5. finally, run irandomizer numbers (or tethering app of choice)
6. enjoy!

thanks!
 

thanks script! i'm having troubles though...

can 2 devices talk using web proxy (http) in mac side proxy ip supplied irandomizer, can't seem socks proxy working! i'm using proxy id irandomizer mac side, irandomizer says "unsupported socks protocol"...

help? i'd work...!

edit: got work!!! :d
other guides showed http proxy usage... after further research, don't need use it!

other fellas , ladies out there, don't need http, use socks! :)
 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment