diff --git a/common/request.py b/common/request.py index 9705305..18840f8 100644 --- a/common/request.py +++ b/common/request.py @@ -1,6 +1,7 @@ import json from threading import Thread from queue import Queue +from operator import attrgetter import tqdm import requests @@ -243,7 +244,8 @@ def run_request(domain, data, port): new_data = gen_new_data(req_data, resp_list) count = utils.count_alive(new_data) 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): diff --git a/common/utils.py b/common/utils.py index 9367391..2382f7f 100644 --- a/common/utils.py +++ b/common/utils.py @@ -723,3 +723,7 @@ def decode_resp_text(resp): # 最后尝试自动解码 content = str(content, errors='replace') return content + + +def sort_by_subdomain(data): + return sorted(data, key=lambda item: item.get('subdomain'))