diff --git a/Providers/Modules/Plugins/Antimalware/plugin/collectmcafeeinfo.rb b/Providers/Modules/Plugins/Antimalware/plugin/collectmcafeeinfo.rb index 839f1c5f5..94eec337e 100644 --- a/Providers/Modules/Plugins/Antimalware/plugin/collectmcafeeinfo.rb +++ b/Providers/Modules/Plugins/Antimalware/plugin/collectmcafeeinfo.rb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 \ No newline at end of file