Skip to content

Commit

Permalink
feat:add date for each malwares downloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
poneoneo committed Jun 13, 2024
1 parent 0bff3bd commit 39818f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions your_daily_dose_malware/backends/malshare.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import click
from dotenv import load_dotenv
from rich.progress import Progress

from datetime import datetime as dt
load_dotenv()


Expand Down Expand Up @@ -38,7 +38,8 @@ def scrap_malshare():
verify=True,
)
response.raise_for_status()
with open(f"malware_{sha256_id[:4]}.zip", "wb") as f:
curr_time = dt.now().date().strftime("%Y-%m-%d")
with open(f"malware_{sha256_id[:6]}_{curr_time}.zip", "wb") as f:
f.write(response.content)
progress.update(task, advance=1)
except Exception as err:
Expand Down
5 changes: 3 additions & 2 deletions your_daily_dose_malware/backends/malware_bazaar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import requests
import os
from rich.progress import Progress
from datetime import datetime as dt


def hundred_most_recent(headers_info):
Expand Down Expand Up @@ -70,8 +71,8 @@ def all_most_recent(headers_info):
)

for sha256_hash in sha256_names:

if os.path.exists(f"malware_{sha256_hash[:4]}.zip"):
curr_time = dt.now().date().strftime("%Y-%m-%d")
if os.path.exists(f"malware_{sha256_hash[:6]}_{curr_time}.zip"):
continue
response = requests.post(
"https://mb-api.abuse.ch/api/v1/",
Expand Down

0 comments on commit 39818f1

Please sign in to comment.