Class: VirusTotal::Client::File
- Includes:
- Action::Comments, Action::Get, Action::Relationships, Action::Votes
- Defined in:
- lib/virustotal/clients/file.rb
Constant Summary
Constants inherited from Base
Base::BASE_URL, Base::CONVERT_TABLE, Base::HOST, Base::VERSION
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#analyse(hash) ⇒ Hash
Reanalyse a file already in VirusTotal.
-
#download(hash) ⇒ <Type>
Download a file.
-
#download_url(hash) ⇒ Hash
Get a download URL for a file.
-
#pcap(id) ⇒ Hash
Retrieve objects related to a file.
-
#upload(path) ⇒ Hash
Upload and analyse a file.
-
#upload_url ⇒ Hash
Get a URL for uploading files larger than 32MB.
Methods included from Action::Votes
Methods included from Action::Relationships
#method_missing, #respond_to_missing?
Methods included from Action::Get
Methods included from Action::Comments
Methods inherited from Base
Constructor Details
This class inherits a constructor from VirusTotal::Client::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class VirusTotal::Client::Action::Relationships
Instance Method Details
#analyse(hash) ⇒ Hash
Reanalyse a file already in VirusTotal
46 47 48 |
# File 'lib/virustotal/clients/file.rb', line 46 def analyse(hash) _post("/files/#{hash}/analyse") { |json| json } end |
#download(hash) ⇒ <Type>
Download a file
72 73 74 |
# File 'lib/virustotal/clients/file.rb', line 72 def download(hash) _get("/files/#{hash}/download") { |location| location } end |
#download_url(hash) ⇒ Hash
Get a download URL for a file
59 60 61 |
# File 'lib/virustotal/clients/file.rb', line 59 def download_url(hash) _get("/files/#{hash}/download_url") { |json| json } end |
#pcap(id) ⇒ Hash
Retrieve objects related to a file
85 86 87 |
# File 'lib/virustotal/clients/file.rb', line 85 def pcap(id) _get("/file_behaviours/#{id}/pcap") { |raw| raw } end |
#upload(path) ⇒ Hash
Upload and analyse a file
20 21 22 23 24 |
# File 'lib/virustotal/clients/file.rb', line 20 def upload(path) name = ::File.basename(path) data = ::File.read(path) _post_with_file("/files", file: data, filename: name) { |json| json } end |
#upload_url ⇒ Hash
Get a URL for uploading files larger than 32MB
33 34 35 |
# File 'lib/virustotal/clients/file.rb', line 33 def upload_url _get("/files/upload_url") { |json| json } end |