From f27886380318b8a2e3f82f7d6f20a44217a2ec91 Mon Sep 17 00:00:00 2001 From: kelvin_ben <> Date: Mon, 10 Aug 2020 09:46:01 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=96=B0=E5=A2=9E=E5=AF=B9dom=E3=80=81sax?= =?UTF-8?q?=E3=80=81dom4j=E3=80=81=20jdom=E7=AD=89xml=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E6=94=AF=E6=8C=81=202.=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=90=8E=E7=BC=80=E5=90=8D=E8=8E=B7=E5=8F=96=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 16 ++++++++++++++-- libs/task/android_task.py | 10 ++++++---- libs/task/ios_task.py | 6 +++--- libs/task/web_task.py | 4 ++-- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/config.py b/config.py index 5b19ffc..8a97223 100644 --- a/config.py +++ b/config.py @@ -3,12 +3,24 @@ # Github: https://github.com/kelvinBen/AppInfoScanner -# 此处用于搜索组件信息,如fastjson、gson等 +# 此处用于搜索组件信息 +# com.alibaba.fastjson -> fastjson +# com.google.gson -> gson +# com.fasterxml.jackson -> jackson +# net.sf.json -> +# javax.xml.parsers.DocumentBuilder -> dom方式 +# javax.xml.parsers.SAXParser -> sax方式 +# org.jdom.input.SAXBuilder -> jdom +# org.dom4j.io.SAXReader -> dom4j filter_components = [ 'com.alibaba.fastjson', 'com.google.gson', 'com.fasterxml.jackson', - 'net.sf.json' + 'net.sf.json', + 'javax.xml.parsers.DocumentBuilder', + 'javax.xml.parsers.SAXParser', + 'org.jdom.input.SAXBuilder', + 'org.dom4j.io.SAXReader' ] # 此处目前支持过滤 diff --git a/libs/task/android_task.py b/libs/task/android_task.py index 48a8706..ad6015a 100644 --- a/libs/task/android_task.py +++ b/libs/task/android_task.py @@ -105,7 +105,7 @@ class AndroidTask(object): if "." not in dir_file: continue if len(dir_file.split("."))>1: - if dir_file.split(".")[1] in file_suffix: + if dir_file.split(".")[-1] in file_suffix: self.file_queue.put(dir_file_path) for component in config.filter_components: comp = component.replace(".","/") @@ -120,10 +120,12 @@ class AndroidTask(object): dir_file_path = os.path.join(root_path,dir_file) if os.path.isdir(dir_file_path): self.__get_file_type__(dir_file_path) - else: - if dir_file.split(".")[1] == "apk": + else: + suffix_name = dir_file.split(".")[-1] + + if suffix_name == "apk": self.__decode_apk__(dir_file) - elif dir_file.split(".")[1] == "dex": + elif suffix_name == "dex": self.__decode_dex__(dir_file) else: continue diff --git a/libs/task/ios_task.py b/libs/task/ios_task.py index 2c4c477..047aaaf 100644 --- a/libs/task/ios_task.py +++ b/libs/task/ios_task.py @@ -30,7 +30,7 @@ class iOSTask(object): def start(self): # ipa 文件 - if self.path.split(".")[1] == 'ipa': + if self.path.split(".")[-1] == 'ipa': # 对ipa进行解包 self.__decode_ipa__(cores.output_path) @@ -56,7 +56,7 @@ class iOSTask(object): dir_file_path = os.path.join(scanner_dir,dir_file) if os.path.isdir(dir_file_path): if dir_file.endswith(".app"): - self.elf_file_name = dir_file.split(".")[0] + self.elf_file_name = dir_file.replace(".app","") self.__get_scanner_file__(dir_file_path,file_suffix) else: if self.elf_file_name == dir_file: @@ -65,7 +65,7 @@ class iOSTask(object): if self.no_resource: dir_file_suffix = dir_file.split(".") if len(dir_file_suffix) > 1: - if dir_file_suffix[1] in file_suffix: + if dir_file_suffix[-1] in file_suffix: self.file_queue.put(dir_file_path) def __decode_ipa__(self,output_path): diff --git a/libs/task/web_task.py b/libs/task/web_task.py index fc138ac..14884ed 100644 --- a/libs/task/web_task.py +++ b/libs/task/web_task.py @@ -38,7 +38,7 @@ class WebTask(object): self.__get_scanner_file__(self.path,scanner_file_suffix) else: - if not (self.path.split(".")[1] in scanner_file_suffix): # 内容包含进行下步处理 + if not (self.path.split(".")[-1] in scanner_file_suffix): # 内容包含进行下步处理 err_info = ("Retrieval of this file type is not supported. Select a file or directory with a suffix of %s" % ",".join(scanner_file_suffix)) raise Exception(err_info) self.file_queue.put(self.path) @@ -58,7 +58,7 @@ class WebTask(object): self.__get_scanner_file__(dir_file_path,file_suffix) else: if len(dir_file.split("."))>1: - if dir_file.split(".")[1] in file_suffix: + if dir_file.split(".")[-1] in file_suffix: self.file_queue.put(dir_file_path) def __print__(self):