46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
import base64
|
|
import sys
|
|
import time
|
|
import requests
|
|
import json
|
|
|
|
|
|
def reg_check(app_id, app_secret, domain):
|
|
api_url = f'https://www.mxnzp.com/api/beian/search?domain={domain}&app_id={app_id}&app_secret={app_secret}'
|
|
res = requests.get(api_url)
|
|
|
|
res_http_code = res.status_code
|
|
res_text = json.loads(res.text)
|
|
res_code = res_text['code']
|
|
res_msg = res_text['msg']
|
|
if res_http_code != 200 or res_code == 0:
|
|
print(res_msg)
|
|
exit(3)
|
|
else:
|
|
# print(res_text)
|
|
print("*" * 50)
|
|
print(f"域 名:{res_text['data']['domain']}")
|
|
print(f"单 位:{res_text['data']['unit']}")
|
|
print(f"类 型:{res_text['data']['type']}")
|
|
print(f"备案号:{res_text['data']['icpCode']}")
|
|
print(f"名 称:{res_text['data']['name']}")
|
|
print(f"审核时间:{res_text['data']['passTime']}\n")
|
|
|
|
|
|
def main():
|
|
app_id = "nrsngdkvknqkrwko"
|
|
app_secret = "SFFmQWo2dnNBRjdNYkVSclZxa2ZvUT09"
|
|
if len(sys.argv) == 1:
|
|
print("Must specify one or more domains to check registration.")
|
|
exit(2)
|
|
|
|
for domain in sys.argv[1:]:
|
|
domain = str(base64.b64encode(domain.encode('utf-8')), encoding='utf-8')
|
|
reg_check(app_id, app_secret, domain)
|
|
time.sleep(1)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|
|
|