From 499826bb7232f7a651e75a9eade0aed667bac9c6 Mon Sep 17 00:00:00 2001 From: Jing Ling Date: Thu, 10 Sep 2020 00:20:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=93=E6=9E=9C=E6=8E=92?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/request.py | 4 +++- common/utils.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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'))