1. 将web任务处理逻辑添加至任务处理中心

v1.0.5 V1.0.5_Releases
kelvinBen 4 years ago committed by Your Name
parent 626fc565e0
commit fa37dda0ce
  1. 6
      app.py
  2. 2
      libs/task/base_task.py
  3. 1
      libs/task/ios_task.py
  4. 61
      libs/task/web_task.py
  5. 16
      update.md

@ -63,10 +63,10 @@ def web(inputs: str, rules: str, all_str:bool,threads:int) -> None:
bootstrapper = Bootstrapper(__file__) bootstrapper = Bootstrapper(__file__)
bootstrapper.init() bootstrapper.init()
# BaseTask("Web", inputs, rules,all_str, threads).start() BaseTask("Web", inputs, rules,all_str, threads).start()
task = WebTask(input, rules,all,threads) # task = WebTask(input, rules,all,threads)
task.start() # task.start()
except Exception as e: except Exception as e:
raise e raise e

@ -76,7 +76,7 @@ class BaseTask(object):
task_info = iOSTask(self.path,self.no_resource).start() task_info = iOSTask(self.path,self.no_resource).start()
# 调用Web 相关处理逻辑 # 调用Web 相关处理逻辑
else: else:
task_info = WebTask.start() task_info = WebTask(self.path).start()
return task_info return task_info
def __threads_control__(self,file_queue): def __threads_control__(self,file_queue):

@ -36,7 +36,6 @@ class iOSTask(object):
return {"shell_flag":self.shell_flag,"file_queue":self.file_queue,"comp_list":[],"packagename":None} return {"shell_flag":self.shell_flag,"file_queue":self.file_queue,"comp_list":[],"packagename":None}
def __get_file_header__(self,file_path): def __get_file_header__(self,file_path):
print("====================")
hex_hand = 0x0 hex_hand = 0x0
with open(file_path,"rb") as macho_file: with open(file_path,"rb") as macho_file:
macho_file.seek(hex_hand,0) macho_file.seek(hex_hand,0)

@ -17,38 +17,23 @@ class WebTask(object):
value_list = [] value_list = []
result_dict = {} result_dict = {}
def __init__(self, input, rules,all,threads): def __init__(self, path):
self.path = input self.path = path
if rules:
config.filter_strs.append(r'.*'+str(rules)+'.*')
self.all = all
self.threads = threads
self.file_queue = Queue() self.file_queue = Queue()
self.shell_falg=False
def start(self): def start(self):
# 此处判断是文件还是目录
# 文件判断后缀 html,js,css,htm,xml等
if len(config.web_file_suffix) <=0: if len(config.web_file_suffix) <=0:
scanner_file_suffix = ["html","js","html","xml"] scanner_file_suffix = ["html","js","html","xml"]
scanner_file_suffix = config.web_file_suffix scanner_file_suffix = config.web_file_suffix
if os.path.isdir(self.path): # 目录的话就提取 if os.path.isdir(self.path):
self.__get_scanner_file__(self.path,scanner_file_suffix) self.__get_scanner_file__(self.path,scanner_file_suffix)
else: 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)) 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) raise Exception(err_info)
self.file_queue.put(self.path) self.file_queue.put(self.path)
return {"comp_list":[],"shell_flag":False,"file_queue":self.file_queue,"packagename":None}
self.__start_threads()
for thread in self.thread_list:
thread.join()
self.__print__()
def __get_scanner_file__(self,scanner_dir,file_suffix): def __get_scanner_file__(self,scanner_dir,file_suffix):
dir_or_files = os.listdir(scanner_dir) dir_or_files = os.listdir(scanner_dir)
@ -61,22 +46,22 @@ class WebTask(object):
if dir_file.split(".")[-1] in file_suffix: if dir_file.split(".")[-1] in file_suffix:
self.file_queue.put(dir_file_path) self.file_queue.put(dir_file_path)
def __print__(self): # def __print__(self):
print("=========The result set for the static scan is shown below:===============") # print("=========The result set for the static scan is shown below:===============")
with open(cores.result_path,"a+") as f: # with open(cores.result_path,"a+") as f:
for key,value in self.result_dict.items(): # for key,value in self.result_dict.items():
f.write(key+"\r") # f.write(key+"\r")
for result in value: # for result in value:
if result in self.value_list: # if result in self.value_list:
continue # continue
self.value_list.append(result) # self.value_list.append(result)
print(result) # print(result)
f.write("\t"+result+"\r") # f.write("\t"+result+"\r")
print("For more information about the search, see: %s" %(cores.result_path)) # print("For more information about the search, see: %s" %(cores.result_path))
def __start_threads(self): # def __start_threads(self):
for threadID in range(1,self.threads) : # for threadID in range(1,self.threads) :
name = "Thread - " + str(threadID) # name = "Thread - " + str(threadID)
thread = ParsesThreads(threadID,name,self.file_queue,self.all,self.result_dict) # thread = ParsesThreads(threadID,name,self.file_queue,self.all,self.result_dict)
thread.start() # thread.start()
self.thread_list.append(thread) # self.thread_list.append(thread)

@ -1,27 +1,15 @@
### V1.0.5 ### V1.0.5
- 新增对DOM、SAX、DOM4J、JDOM等XML解析组件的识别 - 新增对DOM、SAX、DOM4J、JDOM等XML解析组件的识别
- 新增反编译失败后提交issues入口 - 新增反编译失败后提交issues入口
- 新增ipa壳识别功能,将能够更好的对壳进行识别 - 新增ipa壳识别功能,将能够更好的对壳进行识别
- 新增macho文件扫描功能 - 新增macho文件扫描功能
- 新增结果url和ip地址单独输出到excel - 新增结果url和ip地址单独输出到excel
- 优化后缀名获取方式 - 优化后缀名获取方式
- 优化任务控制中心,将分散的入口整合为一个
- 优化任务控制中心,将分散的入口整合为一个(web的除外) - 优化任务处理逻辑,识别到有壳后,停止执行后继逻辑
- 化任务处理逻辑,识别到有壳后,停止执行后继逻辑
- 修复部分DEX格式原因导致无法进行反编译问题 - 修复部分DEX格式原因导致无法进行反编译问题
- 修复ipa包中存在中文路径不能识别macho问题 - 修复ipa包中存在中文路径不能识别macho问题
### V1.0.4 ### V1.0.4
- 新增对Flutter框架检测支持 - 新增对Flutter框架检测支持
- 对输出结果整体去重 - 对输出结果整体去重

Loading…
Cancel
Save