-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpublishAgentIni.py
More file actions
37 lines (29 loc) · 1.28 KB
/
publishAgentIni.py
File metadata and controls
37 lines (29 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from devicemanagerSUT import DeviceManagerSUT
from optparse import OptionParser
import sys
import os
def main(ip, port, filename):
dm = DeviceManagerSUT(ip, port)
dm.pushFile(filename, '/data/data/com.mozilla.SUTAgentAndroid/files/SUTAgent.ini')
parser = OptionParser()
defaults = {}
parser.add_option("-i", "--ip", dest="ip", help="IP address of device")
parser.add_option("-p", "--port", dest="port", help="Agent port on device, defaults to 20701")
defaults["port"] = "20701"
parser.add_option("-f", "--file", dest="file", help="SUTAgent.ini file to copy to device, must be named 'SUTAgent.ini' and defaults to checking in the local directory for the file.")
defaults["file"] = "SUTAgent.ini"
parser.set_defaults(**defaults)
(options, args) = parser.parse_args()
# Verify Options
if (not options.ip or not options.file):
print "You must specify an ip address for the device and the SUTAgent.ini file"
sys.exit()
if (not os.path.isfile(options.file)):
print "The SUTAgent.ini file you are referencing either does not exist or I cannot find it"
sys.exit()
(head, tail) = os.path.split(options.file)
if (tail != 'SUTAgent.ini'):
print "The SUTAgent.ini file must be named 'SUTAgent.ini' (case sensitive)"
sys.exit()
if __name__ == "__main__":
main(options.ip, options.port, options.file)