DESCRIPTION:

virustotalapi is a Ruby module that interfaces with the VirusTotal API via HTTP POST and JSON responses. The code was derived from Takahiro Matsuji’s snippet at gist.gituhub.com/520909

FEATURES/PROBLEMS:

The module implements the following:

  • Retrieve a file scan report

  • Send and scan a file

  • Retrieve a URL scan report

  • Submit and scan a URL

SYNOPSIS:

require ‘virustotalapi’

mykey = ‘INSERT YOUR KEY HERE’ vt = VirusTotal::API.new(mykey)

myfilehash = ‘INSERT FILE HASH HERE’ out = vt.get_file_report(myfilehash) p out # May return the following values: # VTAPI_REQ_SUCESS = 1 # VTAPI_NOT_FOUND = 0 # VTAPI_REQ_EXCEEDED = -2 # VTAPI_KEY_ERROR = -1 p vt.vtapistatus

myurl = ‘INSERT URL HERE’ out = vt.get_url_report(myurl) p out p vt.vtapistatus

malfile = ‘INSERT PATH TO YOUR FILE HERE’ out = vt.scan_file(malfile) # Returns a hash value for later retrieval p out p vt.vtapistatus

myurl = ‘INSERT URL HERE’ out = vt.scan_url(myurl) # Returns a hash value for later retrieval p out p vt.vtapistatus

REQUIREMENTS:

VirusTotal API Key

INSTALL:

sudo gem install virustotalapi

LICENSE:

(The MIT License)

Copyright © 2011 Jun C. Valdez

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.