krmaxwell / maltrieve

A tool to retrieve malware directly from the source for security researchers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in CRITs update

krmaxwell opened this issue · comments

Processing source URLs
Completed source processing
Downloading samples, check log for details
Traceback (most recent call last):
  File "/home/kmaxwell/src/maltrieve/venv/bin/maltrieve", line 9, in <module>
    load_entry_point('maltrieve==0.6', 'console_scripts', 'maltrieve')()
  File "/home/kmaxwell/src/maltrieve/maltrieve.py", line 447, in main
    md5 = save_malware(each, cfg)
  File "/home/kmaxwell/src/maltrieve/maltrieve.py", line 299, in save_malware
    stored = upload_crits(response, md5, cfg) or stored
  File "/home/kmaxwell/src/maltrieve/maltrieve.py", line 158, in upload_crits
    logging.info("Exception caught from CRITs when submitting domain: {code}".format(code=domain_response.status_code))
UnboundLocalError: local variable 'domain_response' referenced before assignment

This is a problem for #130

oh, here's the real problem:
requests.exceptions.MissingSchema: Invalid URL u'True/api/v1/domains/': No schema supplied. Perhaps you meant http://True/api/v1/domains/?

Hey Kyle. The URL parsing works well on my end. So I am pretty sure that is not the issue.

I looked at your changes and I think the issues is with your try except blocks. In both sample and domain you are calling "domain_response" and "sample_response" outside the try block. If something breaks in the post then it is possible that those variables will not be assigned .

If we switch it to something basic we should be good to go. This is for both the sample and domain. i.e.:
except:
logging.info("Exception caught from CRITs when submitting domain")

I think you're right, yeah. I looked back at my code after I'd gotten proper 💤 and focus, and realized my scope errors. Going to shape it up tomorrow to look more like your original code ;)

sounds good. Please just let me know if I can do anything to help.

oh and I did have an error with the schema but that was a total brain fart on my part when I assigned the vars

Remaining error is just on my CRITs instance and not with Maltrieve.