Created
October 13, 2014 13:43
-
-
Save arthurbarros/9f049a50b85505e017cf to your computer and use it in GitHub Desktop.
Extracting WhatsApp passwords
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from path import path | |
import paramiko | |
import os, sys, time | |
def find_between( s, first, last ): | |
try: | |
start = s.index( first ) + len( first ) | |
end = s.index( last, start ) | |
return s[start:end] | |
except ValueError: | |
return "" | |
def getPath(username, host, password): | |
dssh = paramiko.SSHClient() | |
dssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
dssh.connect(host, username=username, password=password) | |
cmd1 = "find /var/mobile/Applications -iname WhatsApp.app" | |
print "> "+cmd1 | |
stdin, stdout, stderr = dssh.exec_command(cmd1) | |
res = stdout.read() | |
res = res.split("\n") | |
print res[0] | |
dssh.close() | |
return res[0] | |
def getDB(WAPath, username, host, password): | |
localPath = "Cache.db-wal" | |
remotePath = WAPath+"/Library/Caches/net.whatsapp.WhatsApp/Cache.db-wal" | |
pwFile = WAPath+"/Library/pw.dat" | |
transport = paramiko.Transport((host, 22)) | |
transport.connect(username = username, password = password) | |
sftp = paramiko.SFTPClient.from_transport(transport) | |
sftp.get(remotePath, localPath) | |
sftp.get(pwFile, 'pw.dat') | |
sftp.close() | |
transport.close() | |
print "\n\n- Cache.db-wal downloaded!" | |
print "- pw.dat downloaded!" | |
def getData(): | |
s = path("Cache.db-wal").bytes() | |
pw = find_between( s, "pw\":\"", "\",\"" ) | |
id = find_between( s, "id=", "&lg" ) | |
print "pw: "+pw | |
print "id: "+id | |
print ''' | |
########################################### | |
# # | |
# WA Password and Identity Extractor # | |
# for iPhone # | |
# # | |
########################################### | |
Author: @_mgp25 - github.com/mgp25 - mgp25.com | |
''' | |
if len(sys.argv) < 4: | |
sys.exit("Usage: python extractPW.py <username> <host> <password>\n") | |
time.sleep(2) | |
username = sys.argv[1] | |
host = sys.argv[2] | |
password = sys.argv[3] | |
WAPath = getPath(username, host, password) | |
WAPath = WAPath[0:61] | |
getDB(WAPath, username, host, password) | |
print "\n- Extracting data...\n" | |
getData() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment