require 'json'
require 'securerandom' # SecureRandom.uuid 
require 'logger'
require_relative 'collectmcafeeinfo'
require_relative 'collectsophosinfo'
require_relative 'collectdefenderinfo'
require_relative 'antimalwarecommon'

ret = {}
if McAfee.detect()
    ret = McAfee.getprotectionstatus()
elsif Sophos.detect()
    ret = Sophos.getprotectionstatus()
elsif Defender.detect()
    ret = Defender.getprotectionstatus()
else
    ($ProtectionStatusRank, $ProtectionStatus) = AntimalwareCommon::UnknownProtectionCode
    ($ThreatStatusRank, $ThreatStatus) = AntimalwareCommon::UnknownThreatCode
	ret["ProtectionStatusRank"] = $ProtectionStatusRank
    ret["ProtectionStatus"] = $ProtectionStatus
    ret["ProtectionStatusDetails"] = ""
    ret["DetectionId"] = SecureRandom.uuid
    ret["Threat"] = ""
    ret["ThreatStatusRank"] = $ThreatStatusRank
    ret["ThreatStatus"] = $ThreatStatus
	ret["ThreatStatusDetails"] = ""
	ret["Signature"] = ""
    ret["ScanDate"] = ""
    ret["DateCollected"] = DateTime.now.strftime("%m/%d/%Y %H:%M")
    ret["Tool"] = "No Anti-Malware Tool was detected"
    ret["AMProductVersion"] = ""
end
puts ret.to_json if !ret.nil?