-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsubmit_sample.py
More file actions
34 lines (30 loc) · 939 Bytes
/
submit_sample.py
File metadata and controls
34 lines (30 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
import sys
import os
import json
import requests
def submit_sample(auth_key, file_path):
jsonData = {
'anonymous': 0,
'tags': [
'exe'
]
}
headers = {
"Auth-Key" : auth_key
}
files = {
'json_data': (None, json.dumps(jsonData), 'application/json'),
'file': (open(file_path,'rb'))
}
r = requests.post('https://mb-api.abuse.ch/api/v1/', files=files, verify=True, headers=headers)
print(r.content.decode("utf-8", "ignore"))
if len(sys.argv) > 2:
if os.path.isfile(sys.argv[2]):
submit_sample(sys.argv[1], sys.argv[2])
else:
print("Error: File not found")
else:
print("Submit a malware sample to MalwareBazaar")
print("Usage: python3 sumbit_sample.py <YOUR-AUTH-KEY> <PATH-TO-FILE>")
print("Note: If you don't have an Auth-Key yet, you can obtain one at https://auth.abuse.ch/")