Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Mcafee Changes #900

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions Providers/Modules/Plugins/Antimalware/plugin/collectmcafeeinfo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def self.detect()
if !File.file?(@detectedPath)
return false
end
if ( @mcafeeName == nil || @mcafeeName != "McAfee Endpoint Security for Linux Threat Prevention")
if ( @mcafeeName == nil)
return false
elsif ( @mcafeeVersion == nil || @mcafeeVersion.split(".")[0].to_i < 10)
return false
Expand Down Expand Up @@ -93,7 +93,7 @@ def self.getprotectionstatus()
else
quickscanarray = taskcmd[$i].split(" ")
quickscanStatus = 'NA'
quickscan, quickscanStatus = parseMcAfeeDateTime(quickscanarray , @mcafeeVersion)
quickscan, quickscanStatus = parseMcAfeeDateTime(taskcmd[$i], quickscanarray , @mcafeeVersion)
if quickscan == "NA"
protectionStatusDetailsArray.push("Fail to parse quickscan date: " + taskcmd[$i])
end
Expand All @@ -108,7 +108,7 @@ def self.getprotectionstatus()
else
fullscanarray = taskcmd[$i].split(" ")
fullscanStatus = 'NA'
fullscan, fullscanStatus = parseMcAfeeDateTime(fullscanarray, @mcafeeVersion)
fullscan, fullscanStatus = parseMcAfeeDateTime(taskcmd[$i], fullscanarray, @mcafeeVersion)
if fullscan == "NA"
protectionStatusDetailsArray.push("Fail to parse fullscan date: " + taskcmd[$i])
end
Expand All @@ -122,7 +122,7 @@ def self.getprotectionstatus()
else
datengupdatearray = taskcmd[$i].split(" ")
datengupdateStatus = 'NA'
datengupdate, datengupdateStatus = parseMcAfeeDateTime(datengupdatearray, @mcafeeVersion)
datengupdate, datengupdateStatus = parseMcAfeeDateTime(taskcmd[$i], datengupdatearray, @mcafeeVersion)
if datengupdate == "NA"
protectionStatusDetailsArray.push("Fail to parse DAT Engine update date: " + taskcmd[$i])
end
Expand Down Expand Up @@ -249,11 +249,11 @@ def self.getprotectionstatus()
return ret
end

def self.parseMcAfeeDateTime(datearray , mcafeeVersion)
def self.parseMcAfeeDateTime(taskcmd, datearray , mcafeeVersion)
begin
mcafeeVersionSplit = mcafeeVersion.to_s.split(".")
if (mcafeeVersionSplit[1].to_i > 6) || (mcafeeVersionSplit[1].to_i == 6 && mcafeeVersionSplit[2].to_i >=6 )
return parseMcAfeeDateTimeForSixPointSixVersionAndNewer(datearray)
return parseMcAfeeDateTimeForSixPointSixVersionAndNewer(taskcmd, datearray)
else
return parseMcAfeeDateTimeSixPointFiveVersionAndOlder(datearray)
end
Expand Down Expand Up @@ -285,14 +285,15 @@ def self.parseMcAfeeDateTimeSixPointFiveVersionAndOlder(datearray)
return scandate, scanstatus
end

def self.parseMcAfeeDateTimeForSixPointSixVersionAndNewer(datearray)
def self.parseMcAfeeDateTimeForSixPointSixVersionAndNewer(taskcmd, datearray)
$l = datearray.length
scandate = 'NA'
scanstatus = 'NA'
scandate = datearray[$l-6] + " " + datearray[$l-5] + " " + datearray[$l-4] + " " + datearray[$l-3] + " " + datearray[$l-2] + " " + datearray[$l-1]
scandate = Time.strptime(scandate, '%a %b %d %H:%M:%S %Y')
scandate.utc.strftime("%d/%m/%y %H:%M:%S %Z")
scanstatus = datearray[9]
return scandate, scanstatus
regularexpressionforscanstatus = /\b(Not Started|Running|Completed|Aborted)\b/
scandatestring = datearray[$l-6] + " " + datearray[$l-5] + " " + datearray[$l-4] + " " + datearray[$l-3] + " " + datearray[$l-2] + " " + datearray[$l-1]
scandateparsed = Time.parse(scandatestring)
scandateparsed.utc.strftime('%m/%d/%Y %H:%M:%S')
scanstatus = (regularexpressionforscanstatus.match(taskcmd))
return scandateparsed, scanstatus.to_s
end
end