class Fushin::HybridAnalysis

Constants

BASE_URL
VERSION

Public Class Methods

quick_url_scan(url) click to toggle source
# File lib/fushin/hybrid_analysis.rb, line 25
def self.quick_url_scan(url)
  new.quick_url_scan(url)
end

Public Instance Methods

quick_url_scan(url) click to toggle source
# File lib/fushin/hybrid_analysis.rb, line 11
def quick_url_scan(url)
  payload = {
    scan_type: "all",
    url: url
  }
  res = HTTP.headers(default_headers).post(url_for("/quick-scan/url-to-file"), form: payload)
  if res.code == 200
    JSON.parse(res.body.to_s)
  else
    message = JSON.parse(res.body.to_s).dig("message")
    raise HAResponseError, message
  end
end

Private Instance Methods

api_key() click to toggle source
# File lib/fushin/hybrid_analysis.rb, line 31
def api_key
  @api_key ||= ENV.fetch("HA_API_KEY")
end
default_headers() click to toggle source
# File lib/fushin/hybrid_analysis.rb, line 35
def default_headers
  {
    "accept" => "application/json",
    "api-key" => api_key,
    "user-agent" => "Falcon Sandbox",
  }
end
url_for(path) click to toggle source
# File lib/fushin/hybrid_analysis.rb, line 43
def url_for(path)
  "#{BASE_URL}/api/#{VERSION}#{path}"
end