-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a59bb8b
commit b7c976c
Showing
8 changed files
with
135 additions
and
70 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
APP_NAME = 'your-daily-dose-malware' | ||
APP_NAME = "your-daily-dose-malware" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import click | ||
|
||
|
||
@click.group(name='scraper') | ||
@click.group(name="scraper") | ||
def scraper(): | ||
"""Commands for scraping data from your daily dose malware.""" | ||
pass |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,42 @@ | ||
import click | ||
from .commands.scraper import scraper | ||
from .commands.utils.retrieve_malware import all_most_recent, hundred_most_recent | ||
from .commands.utils.retrieve_malware import (all_most_recent, | ||
hundred_most_recent) | ||
from dotenv import load_dotenv | ||
import os | ||
|
||
load_dotenv() | ||
|
||
|
||
@click.command( | ||
help=""" | ||
Download eitheir hundred recent malwares uploaded within the last 60 min or all the recent malwares uploaded within the last 48 hours sha256 hash by using api from 'https://mb-api.abuse.ch/api/v1/' | ||
Download either hundred recent malware's uploaded within the last 60 min or | ||
all the recent malware's uploaded within the last 48 hours sha256 hash | ||
by using api from 'https://mb-api.abuse.ch/api/v1/' | ||
-s256 or --by-sha256: get the lastest sha256 hashes from 'https://bazaar.abuse.ch/export/txt/sha256/recent' save them in sha256_names.txt then for each file download all malwares in zip file | ||
-s256 or --by-sha256: get the most recent sha256 hashes from | ||
'https://bazaar.abuse.ch/export/txt/sha256/recent' save them in | ||
sha256_names.txt then for each file download all malware's in zip file | ||
-hr or --hundred-recent: get the lastest hundred recent malwares uploaded within the last 60 min | ||
""") | ||
@click.option('-s256','--by-sha256',is_flag=True) | ||
@click.option('-hr','--hundred-recent',is_flag=True) | ||
-hr or --hundred-recent: get the most recent hundred recent malware's | ||
uploaded within the last 60 min | ||
""" | ||
) | ||
@click.option("-s256", "--by-sha256", is_flag=True) | ||
@click.option("-hr", "--hundred-recent", is_flag=True) | ||
def run_scrapper(by_sha256, hundred_recent): | ||
headers = { | ||
'API-KEY':os.getenv('API_KEY') | ||
} | ||
headers = {"API-KEY": os.getenv("API_KEY")} | ||
if hundred_recent: | ||
hundred_most_recent(headers) | ||
elif by_sha256: | ||
all_most_recent(headers) | ||
else: | ||
click.echo(' No selector provided. Please use either by_sha256, hundred_recent as selector',) | ||
click.echo( | ||
" No selector provided. Please use either by_sha256, " | ||
"hundred_recent as selector", | ||
) | ||
|
||
|
||
if __name__ == '__main__': | ||
if __name__ == "__main__": | ||
scraper.add_command(run_scrapper) | ||
scraper() |