添加结果排序

This commit is contained in:
Jing Ling
2020-09-10 00:20:01 +08:00
parent 634eb9adf2
commit 499826bb72
2 changed files with 7 additions and 1 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
import json import json
from threading import Thread from threading import Thread
from queue import Queue from queue import Queue
from operator import attrgetter
import tqdm import tqdm
import requests import requests
@@ -243,7 +244,8 @@ def run_request(domain, data, port):
new_data = gen_new_data(req_data, resp_list) new_data = gen_new_data(req_data, resp_list)
count = utils.count_alive(new_data) count = utils.count_alive(new_data)
logger.log('INFOR', f'Found that {domain} has {count} alive subdomains') logger.log('INFOR', f'Found that {domain} has {count} alive subdomains')
return new_data sorted_data = utils.sort_by_subdomain(new_data)
return sorted_data
def save_db(name, data): def save_db(name, data):
+4
View File
@@ -723,3 +723,7 @@ def decode_resp_text(resp):
# 最后尝试自动解码 # 最后尝试自动解码
content = str(content, errors='replace') content = str(content, errors='replace')
return content return content
def sort_by_subdomain(data):
return sorted(data, key=lambda item: item.get('subdomain'))