微步在线云API-调用代码
实例接口调用代码:
#!/usr/bin/python # -*- coding: UTF-8 -*- import requests,json class intelligenceSearch(): def __init__(self): self.search_url="https://api.threatbook.cn/v3/ip/query" self.api_key ="******请替换apikey" def getIpIoc(self,ip): params = { "data": ip, "apiKey": self.api_key, } result_ip_list = [] print("ip params:", params) resp = requests.get(self.search_url, params=params, verify=False) print("ip type of resp:", type(resp.json())) print("ip resp.json:", resp.json()) res_dict = json.loads(resp.text) record_content = res_dict.get(content) print("len of record_content:",len(record_content),type(record_content),type(record_content[0])) print("record_content:",record_content) def getDnsIoc(self,dns): params = { "data": dns, "apiKey": self.api_key, } print("dns params:", params) resp = requests.get(self.search_url, params=params, verify=False) print("dns type of resp:", type(resp.json())) print("dns resp.json:", resp.json()) res_dict = json.loads(resp.text) record_content = res_dict.get(content) print("len of record_content:", len(record_content), type(record_content), type(record_content[0])) print("record_content:", record_content) if __name__ == __main__: print("weibu test begin:") querier = intelligenceSearch() print("AAAAAAAAAA ip test:") querier.getIpIoc("19.29..24,9.9.36.24") print("BBBBBBBBBB dns test:") querier.getDnsIoc("nawqned.com,119.19.26.24")
上一篇:
Java架构师技术进阶路线图