Class: VirusTotal::Client::File

Inherits:
Base
  • Object
show all
Defined in:
lib/virustotal/clients/file.rb

Constant Summary

Constants inherited from Base

Base::BASE_URL, Base::HOST, Base::VERSION

Instance Attribute Summary

Attributes inherited from Base

#key

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from VirusTotal::Client::Base

Instance Method Details

#behaviour(hash) ⇒ Object



31
32
33
# File 'lib/virustotal/clients/file.rb', line 31

def behaviour(hash)
  get("/file/behaviour", hash: hash) { |json| json }
end

#clusters(date) ⇒ Object



39
40
41
# File 'lib/virustotal/clients/file.rb', line 39

def clusters(date)
  get("/file/clusters", date: date) { |json| json }
end

#download(hash) ⇒ Object



27
28
29
# File 'lib/virustotal/clients/file.rb', line 27

def download(hash)
  get("/file/download", hash: hash) { |raw| raw }
end

#network_traffic(hash) ⇒ Object



35
36
37
# File 'lib/virustotal/clients/file.rb', line 35

def network_traffic(hash)
  get("/file/network-traffic", hash: hash) { |json| json }
end

#report(resource, allinfo: nil) ⇒ Object



6
7
8
9
10
11
# File 'lib/virustotal/clients/file.rb', line 6

def report(resource, allinfo: nil)
  params = { resource: resource, allinfo: allinfo }.compact
  post("/file/report", params) do |json|
    handle_response_code json
  end
end

#rescan(resource) ⇒ Object



19
20
21
# File 'lib/virustotal/clients/file.rb', line 19

def rescan(resource)
  post("/file/rescan", resource: resource) { |json| json }
end

#scan(path) ⇒ Object



13
14
15
16
17
# File 'lib/virustotal/clients/file.rb', line 13

def scan(path)
  name = ::File.basename(path)
  data = ::File.read(path)
  post_with_file("/file/scan", filename: name, file: data) { |json| json }
end

#search(query, offset: nil) ⇒ Object



43
44
45
46
# File 'lib/virustotal/clients/file.rb', line 43

def search(query, offset: nil)
  params = { query: query, offset: offset }.compact
  get("/file/search", params) { |json| json }
end

#upload_urlObject



23
24
25
# File 'lib/virustotal/clients/file.rb', line 23

def upload_url
  get("/file/scan/upload_url") { |location| location }
end