Skip to content

Instantly share code, notes, and snippets.

@KINGSABRI
Created August 8, 2012 23:45
Show Gist options
  • Save KINGSABRI/3299778 to your computer and use it in GitHub Desktop.
Save KINGSABRI/3299778 to your computer and use it in GitHub Desktop.
post to Virustotal
# http://posttestserver.com/post.php?
@url = "http://www.virustotal.com"
@url_scanner = "http://www.virustotal.com/vtapi/v2/url/scan" # https://www.virustotal.com/vtapi/v2/url/scan
#@url_scanner = "https://www.posttestserver.com/post.php?"
@report_url = "http://www.virustotal.com/vtapi/v2/url/report"
@api_key = "a2068ef6c93dba5fad9a0e374db3b359dcf62as4eef3f22c491a98824fc0cc6d"
url_scanner = URI.parse(@url_scanner)
url2scan = {"url" => "http://download.utorrent.com/3.2/uTorrent.exe", "apikey" => @api_key}.to_json
payload = URI.encode(url2scan)
request = Net::HTTP::Post.new(url_scanner.path , initheader = {'Content-Type' =>'application/json'})
request.body = payload
http = Net::HTTP.new(url_scanner.host, url_scanner.port)
http.use_ssl = true if url_scanner.scheme == 'https'
response = http.request(request)
puts "#{response.code} #{response.message}:\n #{response.body}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment