honeynet / droidbot

A lightweight test input generator for Android. Similar to Monkey, but with more intelligence and cool features!
MIT License
806 stars 234 forks source link

Argparser mix up filepath and device_serial #3

Closed hannoL closed 9 years ago

hannoL commented 9 years ago

Error 4 with filepath

If I only specify a filepath with -a option, then the droidbot interpretate this as device. I think there is something wrong with the argparser.

RuntimeError: ERROR: couldn't find device that matches '/home/hanno/mobileSamples/myApkTresor/0xA1EA512A.apk' in [<com.dtmilano.android.adb.adbclient.Device instance at 0x7fa431a23ea8>]

Can you reproduce this? Or did you need any further information?

Envirement:

hanno@dockerDroidBox:~/work/PycharmProjects/gsoc_droidbot$ python start.py -a ~/mobileSamples/myApkTresor/0xA1EA512A.apk
Connecting to a device with serialno=/home/hanno/mobileSamples/myApkTresor/0xA1EA512A.apk with a timeout of 60 secs...
Traceback (most recent call last):
  File "start.py", line 59, in <module>
    main()
  File "start.py", line 54, in main
    droidbot.start()
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/droidbot/droidbot.py", line 47, in start
    device = Device(self.options.device_serial)
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/droidbot/types.py", line 44, in __init__
    self.connect()
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/droidbot/types.py", line 96, in connect
    self.get_view_client()
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/droidbot/types.py", line 165, in get_view_client
    self.view_client = ViewClient(*ViewClient.connectToDeviceOrExit(**kwargs1), **kwargs2)
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/com/dtmilano/android/viewclient.py", line 2551, in connectToDeviceOrExit
    device = adbclient.AdbClient(serialno, ignoreversioncheck=ignoreversioncheck)
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/com/dtmilano/android/adb/adbclient.py", line 160, in __init__
    self.__setTransport()
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/com/dtmilano/android/adb/adbclient.py", line 306, in __setTransport
    raise RuntimeError("ERROR: couldn't find device that matches '%s' in %s" % (self.serialno, devices))
RuntimeError: ERROR: couldn't find device that matches '/home/hanno/mobileSamples/myApkTresor/0xA1EA512A.apk' in [<com.dtmilano.android.adb.adbclient.Device instance at 0x7fa431a23ea8>]
hannoL commented 9 years ago

By a little bit debugging I found, that https://github.com/lynnlyc/droidbot/blob/master/com/dtmilano/android/viewclient.py#L2539 between Line 2536 and Line 2541 set serial to an arbitrary parameters. Working on a Workaround, but have not tested it yet.