Created
July 11, 2014 12:22
-
-
Save hvisser/5da0e0666d3ef2861e46 to your computer and use it in GitHub Desktop.
Monkey runner script to set the proxy on Android from the "modify network" screen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice | |
import sys | |
import socket | |
import time | |
device = MonkeyRunner.waitForConnection() | |
host = socket.gethostbyname(socket.gethostname()) | |
port = "8888" | |
if len(sys.argv) >= 2: | |
host = sys.argv[1] | |
if len(sys.argv) >= 3: | |
port = sys.argv[2] | |
device.wake() | |
device.press("KEYCODE_DPAD_DOWN") | |
device.press("KEYCODE_DPAD_DOWN") | |
device.press("KEYCODE_ENTER") | |
time.sleep(1) | |
device.press("KEYCODE_DPAD_DOWN") | |
device.press("KEYCODE_ENTER") | |
time.sleep(1) | |
device.press("KEYCODE_DPAD_DOWN") | |
device.press("KEYCODE_ENTER") | |
time.sleep(1) | |
# ICS appears to need this extra "down" | |
# device.press("KEYCODE_DPAD_DOWN") | |
# time.sleep(1) | |
device.press("KEYCODE_DPAD_DOWN") | |
time.sleep(1) | |
print "host" | |
device.type(host) | |
time.sleep(1) | |
device.press("KEYCODE_DPAD_DOWN") | |
time.sleep(1) | |
device.type(port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment