mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-23 14:37:17 +00:00
chg: [misp_modules] add enrichment request
This commit is contained in:
parent
8cbfec51f6
commit
6295560216
1 changed files with 10 additions and 4 deletions
|
@ -31,9 +31,15 @@ def init_module_config(module_json, config, config_path=default_config_path):
|
||||||
print(module_json['name'])
|
print(module_json['name'])
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def misp_module_enrichement(misp_module_url, misp_module_port, request_content):
|
def build_enrichment_request_json(module_name, var_name, var_value):
|
||||||
|
request_dict = {'module': module_name, var_name: var_value}
|
||||||
|
# # TODO: add error handler
|
||||||
|
return json.dumps(request_dict)
|
||||||
|
|
||||||
|
def misp_module_enrichement_request(misp_module_url, misp_module_port, request_content):
|
||||||
endpoint_url = '{}:{}/query'.format(misp_module_url, misp_module_port)
|
endpoint_url = '{}:{}/query'.format(misp_module_url, misp_module_port)
|
||||||
req = requests.post(endpoint_url, headers={'Content-Type': 'application/json'}, data=request_content)
|
req = requests.post(endpoint_url, headers={'Content-Type': 'application/json'}, data=request_content)
|
||||||
|
if req.status_code == 200:
|
||||||
print(req.json())
|
print(req.json())
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -60,8 +66,8 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
misp_module_url = 'http://localhost'
|
misp_module_url = 'http://localhost'
|
||||||
misp_module_port = 6666
|
misp_module_port = 6666
|
||||||
test_content = json.dumps({'module': 'btc_steroids', 'btc': '1hmZdUYHyqH3DmWyduRRW3HT8Vm6PHsD1'})
|
test_content = build_enrichment_request_json('btc_steroids', 'btc', 'btc address')
|
||||||
misp_module_enrichement(misp_module_url, misp_module_port, test_content)
|
misp_module_enrichement_request(misp_module_url, misp_module_port, test_content)
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue