Friday, June 21, 2013

Python - Basic VirusTotal Uploader

Just my little/quick note about submitting malware sample to VirusTotal.com. Be reminded that this python code is not handling an error properly. Just for quick reference.

import postfile
import sys, getopt

def main(argv):
 inputfile = sys.argv[1]
 host = "www.virustotal.com"
 mfile = inputfile
 selector = "https://www.virustotal.com/vtapi/v2/file/scan"
 fields = [("apikey", "YOUR PUBLIC API KEY")]
 file_to_send = open(mfile, "rb").read()
 files = [("file", mfile, file_to_send)]
 json = postfile.post_multipart(host, selector, fields, files)
 print json
 
if __name__ == "__main__":
 main(sys.argv[1:])

You can replace the 'YOUR PUBLIC API KEY' with your own key. Get it at VirusTotal.com.

~ alternat0r

No comments:

Post a Comment