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

Error 3: Crashes if started with no option. #2

Closed hannoL closed 9 years ago

hannoL commented 9 years ago

Error 3.1 with no options

All options are defined as optional, but it crashes if you start droidbot without any option:

TypeError: coercing to Unicode: need string or buffer, NoneType found

Are there any must have options? Perhaps you can declare them, or give a proper error message.

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

Envirement:

hanno@dockerDroidBox:~/work/PycharmProjects/gsoc_droidbot$ python start.py
Connecting to a device with serialno=.* with a timeout of 60 secs...
Connected to device with serialno=.*
/home/hanno/work/PycharmProjects/gsoc_droidbot/com/dtmilano/android/viewclient.py:2485: UserWarning: Running on emulator but no serial number was specified then 'emulator-5554' is used
  warnings.warn("Running on emulator but no serial number was specified then 'emulator-5554' is used")
Actual device serialno=emulator-5554
INFO:TelnetConsole:telnet successfully initiated, the addr is (localhost:5554)
WARNING:App:no app given, will operate on whole device
INFO:AppEnvManager:start deploying environment, policy is none
INFO:AppEnvManager:finish deploying environment, policy is none
INFO:AppEventManager:start sending events, policy is monkey
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 57, in start
    event_manager.start()
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/droidbot/app_event.py", line 596, in start
    self.event_factory.start(self)
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/droidbot/app_event.py", line 622, in start
    event = self.generate_event()
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/droidbot/app_event.py", line 662, in generate_event
    event = event_type.get_random_instance(self.device, self.app)
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/droidbot/app_event.py", line 207, in get_random_instance
    if not device.is_foreground(app):
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/droidbot/types.py", line 172, in is_foreground
    package = app.get_package_name()
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/droidbot/types.py", line 453, in get_package_name
    elif self.get_androguard_analysis() is not None:
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/droidbot/types.py", line 429, in get_androguard_analysis
    self.androguard = AndroguardAnalysis(self.app_path)
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/droidbot/types.py", line 524, in __init__
    self.a, self.d, self.dx = AnalyzeAPK(app_path)
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/androguard/androlyze.py", line 114, in AnalyzeAPK
    a = APK(filename, raw)
  File "/home/hanno/work/PycharmProjects/gsoc_droidbot/androguard/core/bytecodes/apk.py", line 170, in __init__
    fd = open(filename, "rb")
TypeError: coercing to Unicode: need string or buffer, NoneType found
yuanchun-li commented 9 years ago

Thanks, I ignored the case when no app file path is given.

hannoL commented 9 years ago

Fixed in 866657a. Thank you.