Last active
March 26, 2019 20:14
-
-
Save ag-michael/8ab46263e3d24b8391b99c1c85522543 to your computer and use it in GitHub Desktop.
Add a file as an observable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def thehive_alert(alert): | |
global CONFIG | |
authheader={'Content-Type': 'application/json', 'Authorization': 'Bearer '+CONFIG['thehiveapikey']} | |
print(requests.post("http://127.0.0.1:9000/api/alert",headers=authheader,data=json.dumps(alert),verify=False)) | |
myfile='' | |
try: | |
with open(fname,"rb") as f: | |
myfile=fname+";text/plain;"+base64.b64encode(f.read()) | |
except Exception: | |
pass | |
alert={ | |
"title": "Your casetitle", | |
"description":"```\n"+"alert information""\n```", | |
"type": "SpearPhishing", | |
"source": "Your script", | |
"sourceRef": "Some email subject", | |
"severity":3, | |
"tlp":3, | |
"artifacts":[{"dataType":"mail","data":"[email protected]","message":"email sender"}, | |
{"dataType":"file","data":myfile,"message":"FireEye alert email body"} | |
], | |
"caseTemplate":"Secops default playbook" | |
} | |
thehive_alert(alert) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment