DisWarden/lib/api_clients/virus_total_client.rb

19 lines
623 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'httparty'
require 'yaml'
# Main class for handling communication with the Virus Total API v3
class VirusTotalClient
API_KEY = YAML.load_file(File.join(__dir__, '../../config/api_keys.yml'))['virus_total']
BASE_URL = 'https://www.virustotal.com/api/v3/'
def self.scan_url(url)
response = HTTParty.post("#{BASE_URL}urls",
headers: { 'x-apikey' => API_KEY },
body: { url: })
# TODO: Implement proper response handling
{ is_safe: response.ok? } # Placeholder: Implement based on actual API response
end
end