From 307e756e235b6fd9e97e051708b433b3dca9df9c Mon Sep 17 00:00:00 2001 From: kelvin_ben <> Date: Sat, 8 Aug 2020 22:58:15 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96=E5=90=8E?= =?UTF-8?q?=E7=BC=80=E5=90=8D=E6=96=B9=E5=BC=8F=202.=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=83=A8=E5=88=86dex=E6=A0=BC=E5=BC=8F=E5=8E=9F=E5=9B=A0?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95=E5=8F=8D=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/task/android_task.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libs/task/android_task.py b/libs/task/android_task.py index c296fef..48a8706 100644 --- a/libs/task/android_task.py +++ b/libs/task/android_task.py @@ -38,9 +38,10 @@ class AndroidTask(object): # 根据不同的文件后缀进行文件解析 if os.path.isfile(self.path): - if self.path.split(".")[1] == "apk": + suffix_name = self.path.split(".")[-1] + if suffix_name == "apk": self.__decode_apk__(self.path) - elif self.path.split(".")[1] == "dex": + elif suffix_name == "dex": self.__decode_dex__(self.path) else: # 抛出异常 @@ -62,11 +63,13 @@ class AndroidTask(object): if self.no_resource: self.__decode_dex__(path) else: - cmd_str = ("java -jar %s d -f %s -o %s") % (cores.apktool_path,path,cores.output_path) + cmd_str = ("java -jar %s d -f %s -o %s --only-main-classe") % (cores.apktool_path,path,cores.output_path) if os.system(cmd_str) == 0: self.__scanner_file_by_apktool__(cores.output_path) else: - raise Exception("The Apktool tool was not found.") + print("Decompilation failed, please submit error information at https://github.com/kelvinBen/AppInfoScanner/issues") + raise Exception("Decompilation failed.") + # 分解dex def __decode_dex__(self,path): @@ -74,7 +77,8 @@ class AndroidTask(object): if os.system(cmd_str) == 0: self.__get_scanner_file__(cores.output_path,"smali") else: - raise Exception("The baksmali tool was not found.") + print("Decompilation failed, please submit error information at https://github.com/kelvinBen/AppInfoScanner/issues") + raise Exception("Decompilation failed.") # 初始化检测文件信息