Module: Uirusu::VTComment
- Defined in:
- lib/uirusu/vtcomment.rb
Overview
Module for submiting comments to Virustotal.com resources using the Virustotal.com public API
Constant Summary collapse
Class Method Summary collapse
-
.post_comment(api_key, resource, comment) ⇒ JSON
Submits a comment to Virustotal.com for a specific resource.
Class Method Details
.post_comment(api_key, resource, comment) ⇒ JSON
Submits a comment to Virustotal.com for a specific resource
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/uirusu/vtcomment.rb', line 40 def self.post_comment(api_key, resource, comment) if api_key == nil raise "Invalid API Key" end if resource == nil raise "Invalid resource, must be a valid url" end if comment == nil raise "You must provide a comment to submit." end response = RestClient.post POST_URL, :apikey => api_key, :resource => resource, :comment => comment case response.code when 429, 204 raise "Virustotal limit reached. Try again later." when 403 raise "Invalid privileges, please check your API key." when 200 JSON.parse(response) else raise "Unknown Server error." end end |