Closed Nuc1eoN closed 3 years ago
My day is occupied so I'll start working on it this evening in the meantime if you any experience with python or vs code you can try to debug it urself. Love that profile picture BTW😂
I have never heard that compliment haha, thank you :joy: I like it too^^
I dont have any experience with python unfortunately, but if you can direct me how to debug it I might try :p
EDIT: On linux I would run strace
, but we dont have that on windows.
EDIT2: Oh shit, I just noticed that wa_kdbe.py
has actually uninstalled whatsapp from my phone
EDIT3: Testing on linux now, similar behaviour.. but its now stuck on Connected to FRD-L09
instead of exiting.
I think it is because Whatsapp is not installed anymore...
Yupp I reinstalled whatsapp and ran wa_kdbe.py
again, this time from linux and it worked!
So not sure what to do now.. Maybe you could add a check if whatsapp is installed to prevent future occurrences of this issue. For me the bug is closed :)
Also BTW thank you very much for your work on this tool!! It's a life safer!! :heart:
It has that check actually. https://github.com/YuvrajRaghuvanshiS/WhatsApp-Key-Database-Extractor/blob/24fb112a81fe54d0b0f42a6d3253b3420b92976e/helpers/WIndowsUSB.py#L36-L40 I can not say for sure if that is the issue. Whatever the case was glad to hear it all worked out.
I can reproduce the error reliably when I manually uninstall whatsapp and then run wa_kdbe.py
, after it shows the message "Connected to FRD-L09".
The error happens in LinuxUSB.py
line 31/32 (or the equivalent on Windows):
WhatsAppapkPath = re.search(
'(?<=package:)(.*)(?=apk)', str(check_output(_waPathText.split()))).group(1) + 'apk'
Debugger exception error:
Exception has occurred: CalledProcessError
Command '['adb', '-s', '73QDU17A14003943', 'shell', 'pm', 'path', 'com.whatsapp']' returned non-zero exit status 1.
File "/home/nuc/WhatsApp-Key-Database-Extractor/helpers/LinuxUSB.py", line 32, in AfterConnect
'(?<=package:)(.*)(?=apk)', str(check_output(_waPathText.split()))).group(1) + 'apk'
File "/home/nuc/WhatsApp-Key-Database-Extractor/helpers/LinuxUSB.py", line 71, in LinuxUSB
return AfterConnect(ADBSerialId)
File "/home/nuc/WhatsApp-Key-Database-Extractor/wa_kdbe.py", line 223, in USBMode
ACReturnCode, SDKVersion, WhatsAppapkPath, versionName, sdPath = LinuxUSB(
File "/home/nuc/WhatsApp-Key-Database-Extractor/wa_kdbe.py", line 59, in main
USBMode()
EDIT:
I can not say for sure if that is the issue.
It seems like the issue is exactly there. Something about the check fails. (And also it's an unhandled error?)
Yes it is unhandled. Also This innocent looking line 31 uses check_output from subprocess module (to execute shell commands and get the output) which itself is very complicated. Then applies regular expression on that to get the actual path, and concatenates 'apk' to it. If you ask me this has to do something with check_output, that just stops because there is no error it is just waiting. Since you're the first person having this issue I believe that has something to do with your phone also.
If it had something to do with regex I could have used grep for LinuxUSB like https://github.com/EliteAndroidApps/WhatsApp-Key-DB-Extractor/blob/a68f062df88e6189e207688fc68d873f1f87355e/WhatsAppKeyDBExtract.sh#L54 but again I don't think it is that much concerning at this stage atleast.
So I don't know, I don't need the issue solved anymore, be free to close it :D
You are saying it might be specific to my phone.. maybe. My reproduction steps are simply:
wa_kdbe.py
Connected to [PHONE]
or exit with no message. Windows or linux doesnt matter.For me it happens on a Honor/Huawei phone, which are known to be a little different than most Android phones.
Cool. Closing it.
Hi there. I'm running into this exact issue on an OPPO device. wa_kdbe.py exits immediately after "Connected to [device]".
Unlike Nuc1eoN's case, though, WhatsApp isn't getting uninstalled from my phone at all. As mentioned above, I guess the script isn't getting past the 'check for WhatsApp installation' stage. Any workaround for this?
Now this needs to be taken care of. I'll look into it. Reopening this.
Now to solve this either you can debug it using vs code if you have experience with python or using pdb which does not require any experience you just need to press 'n' and hit enter many times and send me output.
You need to do the following to help me debug this issue. Paste these commands in your terminal inside 'Whatsapp-Key-Database-Folder'
Now after that you will see you terminal saying (Pdb)
here all you need to do is type n
and hit enter key around 39 times or until you see your terminal saying
(Pdb) n
--Return--
> d:\yuvraj\work\github\wa-kdbe\helpers\windowsusb.py(62)AfterConnect()->(1, 29, '/data/app/co...Wg==/base.apk', '2.21.6.12', '/sdcard')
-> return 1, SDKVersion, WhatsAppapkPath, versionName, sdPath
However in your case this might not be the case where this function returns something because it stops after saying "connected to
My output hasn't changed at all. I believe I've followed the instructions correctly (the only thing I changed was 'python' to 'python3' in the third line).
I'm not particularly experienced with Python, sorry.
Python or python3 doesn't really matter if you only have python3 installed on system and that is defaulted as 'python'. The thing I can not understand is why python debugger is not working for your system. Before showing device name it should get into debug mode.
Could it be a Linux issue? I notice your output accesses 'windowsusb.py'. I'm running KUbuntu.
🤦🏻 My bad one moment.
check now. Do all these steps first.
Error
> /home/??/WhatsApp-Key-Database-Extractor/helpers/LinuxUSB.py(41)AfterConnect()
-> contentLength = int(re.search("(?<=Content-Length:)(.*[0-9])(?=)", str(check_output(
(Pdb) n
> /home/??/WhatsApp-Key-Database-Extractor/helpers/LinuxUSB.py(42)AfterConnect()
-> 'curl -sI http://www.cdn.whatsapp.net/android/2.11.431/WhatsApp.apk'.split()))).group(1))
(Pdb) n
> /home/??/WhatsApp-Key-Database-Extractor/helpers/LinuxUSB.py(41)AfterConnect()
-> contentLength = int(re.search("(?<=Content-Length:)(.*[0-9])(?=)", str(check_output(
(Pdb) n
n> /home/??/WhatsApp-Key-Database-Extractor/helpers/LinuxUSB.py(42)AfterConnect()
-> 'curl -sI http://www.cdn.whatsapp.net/android/2.11.431/WhatsApp.apk'.split()))).group(1))
(Pdb) n
> /home/??/WhatsApp-Key-Database-Extractor/helpers/LinuxUSB.py(41)AfterConnect()
-> contentLength = int(re.search("(?<=Content-Length:)(.*[0-9])(?=)", str(check_output(
(Pdb) n
ValueError: invalid literal for int() with base 10: ' 0\\r\\nVia: HTTP/1.1 forward.http.proxy:3333'
> /home/??/WhatsApp-Key-Database-Extractor/helpers/LinuxUSB.py(41)AfterConnect()
-> contentLength = int(re.search("(?<=Content-Length:)(.*[0-9])(?=)", str(check_output(
(Pdb) n
--Return--
> /home/??/WhatsApp-Key-Database-Extractor/helpers/LinuxUSB.py(41)AfterConnect()->None
This made an exception and AfterConnect() function returned with a value none and all the stack call failed like dominos. Great help @Endothermia , also @Nuc1eoN were you also facing problems on Linux?
Note to self : ValueError: invalid literal for int() with base 10: ' 0\\r\\nVia: HTTP/1.1 forward.http.proxy:3333'
For some reason it is returning an int with value of 0 along with \\r\\nVia: HTTP/1.1 forward.http.proxy:3333
regex needs to be updated.
Could not reproduce on Ubuntu VM
@Endothermia do a quick
Some issue with wget, can't reproduce locally, need some time.
[20:34:18.972857] Downloading legacy WhatsApp V2.11.431 to helpers folder
> /home/??/WhatsApp-Key-Database-Extractor/helpers/LinuxUSB.py(58)AfterConnect()
-> wget.download(downloadAppFrom, 'helpers/LegacyWhatsApp.apk')
(Pdb) n
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)>
> /home/??/WhatsApp-Key-Database-Extractor/helpers/LinuxUSB.py(58)AfterConnect()
-> wget.download(downloadAppFrom, 'helpers/LegacyWhatsApp.apk')
(Pdb) n
--Return--
> /home/??/WhatsApp-Key-Database-Extractor/helpers/LinuxUSB.py(58)AfterConnect()->None
@Endothermia try now, be sure to to do git pull origin
to get latest changes.
Side note : Try code by pressing 'c' for the first time instead of 'n' that will save you a lot of steps as 'c' stands for continue and 'n' stands for next. If then code does not work then re run it with 'n'
Note to self : WhatsAppapkPath = re.search('(?<=package:)(.*)(?=apk)', str(check_output(adb + ' shell pm path com.whatsapp'))).group(1) + 'apk'
instead of assigning a null/none/'' value to WhatsAppapkPath returns with an "exit status 1". And this just happens to cascade entire call with null. Need to do a subprocess here I guess.
I have strong reasons to believe that this error is related to your machine only as this never happened with anyone before and no matter what I do I will never be able to reproduce it on my machine. A quick workaround for this is to download apk manually and saving it to helpers folder with name as 'LegacyWhatsApp.apk', here's the link https://whatcrypt.com/WhatsApp-2.11.431.apk
Tried again and forgot to rename the APK, so I ran into some well-deserved hiccups...
But I fixed that and it works great! Thanks a bunch for your time and effort.
Great... Glad it all worked out for you! Thank you too for keeping me posted and following along.
Note to self : Close this with commit which will do things mentioned in https://github.com/YuvrajRaghuvanshiS/WhatsApp-Key-Database-Extractor/pull/48#issuecomment-809160951 and https://github.com/YuvrajRaghuvanshiS/WhatsApp-Key-Database-Extractor/pull/48#issuecomment-809162396
Hi as mentioned in #20
wa_kdbe.py
simply exits without any messages:then it exits and I am back in the shell.