krmaxwell / maltrieve

A tool to retrieve malware directly from the source for security researchers.
GNU General Public License v3.0
562 stars 184 forks source link

Error in CRITs update #131

Closed krmaxwell closed 9 years ago

krmaxwell commented 9 years ago
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

krmaxwell commented 9 years ago

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/?

webstergd commented 9 years ago

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")

krmaxwell commented 9 years ago

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

webstergd commented 9 years ago

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

krmaxwell commented 9 years ago

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

krmaxwell commented 9 years ago

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