資源簡介
安卓逆向開發的python小程序,可以實現自動化提取,但是目前只能實現單個提取,需要優化,并且需要加入數據庫
代碼片段和文件信息
#?coding=utf-8
import?sysretimeos_winregrandom
def?GetDesktop():
????key?=?_winreg.OpenKey(_winreg.HKEY_CURRENT_USER
??????????????????????????r‘Software\Microsoft\Windows\CurrentVersion\Explorer\Shell?Folders‘?)
????return?_winreg.QueryValueEx(key?“Desktop“)[0]
def?GetFilePath():
????list?=?[]
????if?len(sys.argv)?>?1:
????????list.append(sys.argv[1])
????else:
????????arg1?=?raw_input(“please?input?apk?file?path:\n“)
????????#?arg1?=?TransString(arg1)
????????list.append(arg1)
????return?list
def?RetDexPathByCmd():
????listArgv?=?GetFilePath()
????dexPath?=?listArgv[0]
????if?dexPath?==?““:
????????print?“--Fail--?Ret?file?path?“
????????exit(-1)
????print?“--Sucs--?Ret?file?path?“
????return?dexPath
def?LoopDirFiles(path?fileList?keyStr?lens):
????files?=?os.listdir(path)
????for?file?in?files:
????????filePath?=?os.path.join(path?file)
????????if?os.path.isdir(filePath):
????????????LoopDirFiles(filePath?fileList?keyStr?lens)
????????else:
????????????strLen?=?len(filePath)
????????????if?filePath[strLen?-?lens:strLen]?==?keyStr:
????????????????fileList.append(filePath)
def?GetSaltTimeStr():
????return?time.strftime(“%Y-%m-%d-%H-%M-%S“?time.localtime())?+?str(random.randint(0?99999999))
def?Decomplier():
????apktool_command?=?“apktool.jar?d?“?+?apk?+?“?-o?output“
????#?print(apktool_command)
????os.system(apktool_command)
def?save_to_file(file_name?contents):
????fh?=?open(file_name?‘a‘)
????fh.write(contents)
????fh.close()
if?__name__?==?“__main__“:
????print?“--------------Start?Main?Func------------------“
????#?get?file?path?list:
????if(os.path.exists(“newtest.txt“)):
????????os.remove(“newtest.txt“)
????if?(os.path.exists(“APIextraction.txt“)):
????????os.remove(“APIextraction.txt“)
????apkPath?=?RetDexPathByCmd()
????apkList?=?[]
????if?os.path.isdir(apkPath):
????????#?dir:loop?all?files
????????LoopDirFiles(apkPath?apkList?“.apk“?4)
????else:
????????strLen?=?len(apkPath)
????????if?apkPath[strLen?-?4:strLen]?==?“.apk“:
????????????apkList.append(apkPath)
????#?try:
????#?????logFileName?=?GetDesktop()+“\\log-“?+?GetSaltTimeStr()
????#?????logFile?=?open(logFileName“w+“)
????#?????oldStdOut?=?sys.stdout
????#?????sys.stdout?=?logFile
????#?finally:
????#?????r0?=?0
????for?file?in?apkList:
????????str?=?re.split(r“\\“?file)
????????apk?=?str[-1]
????????#?print(apk)
????????#Decomplier?file?and?get?smali??manifest
????????if?(os.path.exists(‘output‘)):
????????????print(“the?output?is?existcontinue“)
????????else:
????????????Decomplier()
????????DstDir=os.getcwd()
????????#?print?DstDir
????????#get?manifest
????????os.system(‘extractManifest.bat‘)
????????#get?smali?path
????????os.system(‘api.bat‘)
????????command?=?“copy?“?+?DstDir?+?“\\output\\newtest.txt“?+?“?“?+?DstDir
????????#?print(command)
????????command2?=?“copy?“?+?DstDir?+?“\\output\\smali\\FILESLIST111.TXT“?+?“?“?+?DstDir
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????165??2018-04-19?21:03??test2\api.bat
?????文件??????50852??2018-04-23?21:41??test2\APIextraction.txt
?????文件????????185??2018-04-09?21:32??test2\apktool.bat
?????文件????5947943??2018-04-02?15:40??test2\apktool.jar
?????文件????????342??2018-04-19?09:49??test2\extractManifest.bat
?????文件???????3130??2018-04-23?21:41??test2\ManifestExtraction.txt
?????文件??????19576??2018-04-23?21:21??test2\output\AndroidManifest.xm
?????文件???????1003??2018-04-23?21:21??test2\output\apktool.yml
?????文件????????548??2018-04-23?21:21??test2\output\assets\clientCert.crt
?????文件?????236307??2018-04-23?21:21??test2\output\assets\gdt_plugin\gdtadv2.jar
?????文件???????2187??2018-04-23?21:21??test2\output\assets\getui_popup_bg.9.png
?????文件????????793??2018-04-23?21:21??test2\output\assets\getui_popup_close.png
?????文件????????278??2018-04-23?21:21??test2\output\assets\serverPublicKey.pem
?????文件???????9949??2018-04-23?21:21??test2\output\assets\Umeng.js
?????文件?????285840??2018-04-23?21:21??test2\output\assets\ye_app_trash.db
?????文件???????4096??2018-04-23?21:21??test2\output\assets\ye_largedirs.db
?????文件????????136??2018-04-23?21:21??test2\output\assets\ye_license
?????文件????????926??2018-04-23?21:21??test2\output\kotlin\annotation\annotation.kotlin_builtins
?????文件???????3689??2018-04-23?21:21??test2\output\kotlin\collections\collections.kotlin_builtins
?????文件????????726??2018-04-23?21:21??test2\output\kotlin\internal\internal.kotlin_builtins
?????文件??????14202??2018-04-23?21:21??test2\output\kotlin\kotlin.kotlin_builtins
?????文件???????2296??2018-04-23?21:21??test2\output\kotlin\ranges\ranges.kotlin_builtins
?????文件???????4866??2018-04-23?21:21??test2\output\kotlin\reflect\reflect.kotlin_builtins
?????文件??????38008??2018-04-23?21:21??test2\output\lib\armeabi\libdot-zipio.so
?????文件??????21624??2018-04-23?21:21??test2\output\lib\armeabi\libgaussblur.so
?????文件??????42396??2018-04-23?21:21??test2\output\lib\armeabi\libgetuiext2.so
?????文件??????15456??2018-04-23?21:21??test2\output\lib\armeabi\liblbs.so
?????文件??????13728??2018-04-23?21:21??test2\output\lib\armeabi\libnative-ghosty.so
?????文件??????38064??2018-04-23?21:21??test2\output\lib\armeabi\libpl_droidsonroids_gif.so
?????文件??????38012??2018-04-23?21:21??test2\output\lib\armeabi-v7a\libdot-zipio.so
............此處省略6698個文件信息
評論
共有 條評論