Skip to content

Instantly share code, notes, and snippets.

@h-j-13
Created January 25, 2018 11:19
Show Gist options
  • Select an option

  • Save h-j-13/7e05dadde94f419880c3bab3c7e80b06 to your computer and use it in GitHub Desktop.

Select an option

Save h-j-13/7e05dadde94f419880c3bab3c7e80b06 to your computer and use it in GitHub Desktop.
export func
def export_domain(self, type, start, end):
"""导出某一条件下某一时间段的域名"""
result = {"type": type,
"start": start,
"end": end,
"result": []}
domain_list = []
query_result = temp_DB.execute(SQL_refactor.export_domain(type, start, end))
if query_result:
for domain in query_result:
domain_list.append(domain[0])
result["result"] = domain_list
return result
def export_whois(self, time_type, start, end, input_malicious_type_list):
"""导出某一条件下某一时间段的域名"""
with DataBase() as temp_DB:
malicious_type_list = input_malicious_type_list.split('_')
result = {"time_type": time_type,
"start": start,
"end": end,
"malicious_type": malicious_type_list,
"result": []}
whois_list = []
query_result_list = temp_DB.execute_Iterator(
SQL_refactor.export_WHOIS(time_type, start, end, malicious_type_list),
pretchNum=500
)
for query_results in query_result_list:
for query_result in query_results:
WHOIS = {}
WHOIS['domain'] = query_result[0]
WHOIS['domain_status'] = statusValue2status(query_result[1])
WHOIS['registrar'] = query_result[2]
WHOIS['sec_whois_srv'] = query_result[3]
WHOIS['reg_name'] = query_result[4]
WHOIS['reg_phone'] = query_result[5]
WHOIS['standard_phone'] = query_result[6]
WHOIS['phone_country_code'] = query_result[7]
WHOIS['phone_position_code'] = query_result[8]
WHOIS['phone_number'] = query_result[9]
WHOIS['phone_type'] = query_result[10]
WHOIS['reg_email'] = query_result[11]
WHOIS['org_name'] = query_result[12]
WHOIS['name_server'] = str(query_result[13]).split(";")
WHOIS['creation_date'] = str(query_result[14])
WHOIS['expiration_date'] = str(query_result[15])
WHOIS['updated_date'] = str(query_result[16])
WHOIS['record_time'] = str(query_result[17])
whois_list.append(WHOIS)
result["result"] = whois_list
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment