Hi,
When the phone isn't plugged in and you try to run the script, it gives a Value Error
I believe you should try and catch ADB errors as an exception and display it nicely to the user, and ask if the phone is plugged in, if ADB is running, of USB Debugging is enabled, etc.
2021-05-31 10:06:24 BlackPearl android_otp_extractor.adb[39864] INFO Testing if your phone uses binary: 'toybox'
2021-05-31 10:06:24 BlackPearl android_otp_extractor.adb[39864] INFO Checking if adb already runs as root
Traceback (most recent call last):
File "c:\python3\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python3\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\python3\lib\site-packages\android_otp_extractor\__main__.py", line 3, in <module>
main()
File "c:\python3\lib\site-packages\android_otp_extractor\cli.py", line 53, in main
adb = guess_adb_interface(args.data)
File "c:\python3\lib\site-packages\android_otp_extractor\adb.py", line 136, in guess_adb_interface
if '0' == test.adb_uid() and '0' == test.adb_gid():
File "c:\python3\lib\site-packages\android_otp_extractor\adb.py", line 89, in adb_uid
lines = self.run(f'{self.binary} id -u', prefix=b'id: ', root=False)
File "c:\python3\lib\site-packages\android_otp_extractor\adb.py", line 71, in run
raise ValueError(f'adb command failed: {lines}')
ValueError: adb command failed: [b'error: no devices/emulators found\r\n']
Similar error but on my Raspberry Pi
2021-05-31 10:42:19 Harbormaster android_otp_extractor.adb[25587] INFO Testing if your phone uses binary: 'toybox'
2021-05-31 10:42:19 Harbormaster android_otp_extractor.adb[25587] INFO Checking if adb already runs as root
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.7/dist-packages/android_otp_extractor/__main__.py", line 3, in <module>
main()
File "/usr/local/lib/python3.7/dist-packages/android_otp_extractor/cli.py", line 53, in main
adb = guess_adb_interface(args.data)
File "/usr/local/lib/python3.7/dist-packages/android_otp_extractor/adb.py", line 136, in guess_adb_interface
if '0' == test.adb_uid() and '0' == test.adb_gid():
File "/usr/local/lib/python3.7/dist-packages/android_otp_extractor/adb.py", line 89, in adb_uid
lines = self.run(f'{self.binary} id -u', prefix=b'id: ', root=False)
File "/usr/local/lib/python3.7/dist-packages/android_otp_extractor/adb.py", line 71, in run
raise ValueError(f'adb command failed: {lines}')
ValueError: adb command failed: [b'error: device offline\n']
Hi,
When the phone isn't plugged in and you try to run the script, it gives a Value Error
I believe you should try and catch ADB errors as an exception and display it nicely to the user, and ask if the phone is plugged in, if ADB is running, of USB Debugging is enabled, etc.
Similar error but on my Raspberry Pi