Skip to content
This repository has been archived by the owner on Dec 16, 2017. It is now read-only.

Commit

Permalink
Test saving malware locally
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Maxwell committed Mar 26, 2015
1 parent 6e34781 commit 8c5a679
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion maltrieve.py
Expand Up @@ -190,7 +190,7 @@ def save_malware(response, cfg):
url = response.url
data = response.content
mime_type = magic.from_buffer(data, mime=True)
if mime_type in cfg.black_list:
if cfg.black_list and mime_type in cfg.black_list:
logging.info('{mtype} in ignore list for {url}'.format(mtype=mime_type, url=url))
return
if cfg.white_list:
Expand Down
7 changes: 7 additions & 0 deletions test.py
Expand Up @@ -81,3 +81,10 @@ def test_get_sources():
cfg = maltrieve.config(args, filename='maltrieve-test.cfg')
source_lists = maltrieve.process_source_lists(cfg)
assert len(source_lists) == len(cfg.source_urls)


def test_save_malware():
args = maltrieve.setup_args([])
cfg = maltrieve.config(args, filename='maltrieve-test.cfg')
r = requests.get('http://maltrieve.org')
assert maltrieve.save_malware(r, cfg)

0 comments on commit 8c5a679

Please sign in to comment.