module Uirusu::VTComment

Module for submiting comments to Virustotal.com resources using the Virustotal.com public API

Constants

GET_URL
POST_URL

Public Class Methods

get_comments(api_key, resource, before=nil) click to toggle source

Retrieve a list of comments to Virustotal.com for a specific resource

@param [String] api_key Virustotal.com API key @param [String] resource MD5/sha1/sha256/scan_id/URL to search for @param [DateTime] before A datetime token that allows you to iterate over all comments on a specific item whenever it has been commented on more than 25 times

@return [JSON] Parsed response

# File lib/uirusu/vtcomment.rb, line 59
def self.get_comments(api_key, resource, before=nil)
        if resource == nil
                raise "Invalid resource, must be a valid url"
        end

        params = {
                apikey: api_key,
                resource: resource
        }
        params[:before] = before unless before.nil?
        Uirusu.query_api GET_URL, params
end
post_comment(api_key, resource, comment) click to toggle source

Submits a comment to Virustotal.com for a specific resource

@param [String] api_key Virustotal.com API key @param [String] resource MD5/sha1/sha256/scan_id to search for @param [String] comment Comment to post to the resource

@return [JSON] Parsed response

# File lib/uirusu/vtcomment.rb, line 35
def self.post_comment(api_key, resource, comment)
        if resource == nil
                raise "Invalid resource, must be a valid url"
        end

        if comment == nil
                raise "You must provide a comment to submit."
        end

        params = {
                apikey: api_key,
                resource: resource,
                comment: comment
        }
        Uirusu.query_api POST_URL, params
end