Skip to content

Commit 3e810bb

Browse files
committed
Refactor: Use constants for header keys and values in MalwareBazaar downloader
1 parent aa9ca92 commit 3e810bb

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/downloaders/malwarebazaar.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
integrations_cfg = Config("integrations")
1010

11+
AUTH_HEADER_KEY = "Auth-Key"
12+
USER_AGENT_HEADER_KEY = "User-Agent"
13+
USER_AGENT_VALUE = "CAPE Sandbox"
14+
1115
log = logging.getLogger(__name__)
1216

1317
_bazaar_map = {
@@ -54,7 +58,7 @@ def download(hash: str, apikey: str = "") -> bytes:
5458
data = requests.post(
5559
"https://mb-api.abuse.ch/api/v1/",
5660
data={"query": "get_file", _bazaar_map[len(hash)]: hash},
57-
headers={"Auth-Key": integrations_cfg.abusech.apikey or apikey, "User-Agent": "CAPE Sandbox"},
61+
headers={AUTH_HEADER_KEY: integrations_cfg.abusech.apikey or apikey, USER_AGENT_HEADER_KEY: USER_AGENT_VALUE},
5862
)
5963
if data.ok:
6064
try:

0 commit comments

Comments
 (0)