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

Commit 63acb6d

Browse files
authored
McaFee time format changes and version update (#896)
1 parent eba9482 commit 63acb6d

File tree

3 files changed

+32
-28
lines changed

3 files changed

+32
-28
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ nxOMSGenerateInventoryMof:
541541

542542
nxOMSPlugin:
543543
rm -rf output/staging; \
544-
VERSION="3.70"; \
544+
VERSION="3.71"; \
545545
PROVIDERS="nxOMSPlugin"; \
546546
STAGINGDIR="output/staging/$@/DSCResources"; \
547547
cat Providers/Modules/$@.psd1 | sed "s@<MODULE_VERSION>@$${VERSION}@" > intermediate/Modules/$@.psd1; \

Providers/Modules/Plugins/Antimalware/plugin/collectmcafeeinfo.rb

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def self.findMcAfeePath()
1414
paths = ['/opt/McAfee/ens/tp/bin/mfetpcli','/opt/isec/ens/threatprevention/bin/isecav']
1515
for path in paths
1616
if File.file?(path)
17-
@detectedPath = path
17+
@detectedPath = path
1818
detectioncmd = `#{path} --version 2>&1`.lines.map(&:chomp)
1919
@mcafeeName = detectioncmd[0]
2020
@mcafeeVersion = detectioncmd[1].split(" : ")[1]
@@ -25,22 +25,22 @@ def self.findMcAfeePath()
2525

2626
def self.detect()
2727
begin
28-
findMcAfeePath()
28+
findMcAfeePath()
2929
if !File.file?(@detectedPath)
30-
return false
30+
return false
3131
end
32-
if ( @mcafeeName == nil || @mcafeeName != "McAfee Endpoint Security for Linux Threat Prevention")
33-
return false
34-
elsif ( @mcafeeVersion == nil || @mcafeeVersion.split(".")[0].to_i < 10)
35-
return false
32+
if (@mcafeeName == nil)
33+
return false
34+
elsif (@mcafeeVersion == nil || @mcafeeVersion.split(".")[0].to_i < 10)
35+
return false
3636
end
3737
return true
38-
rescue => e
39-
return false
38+
rescue => e
39+
return false
4040
end
4141
end
4242

43-
def self.getprotectionstatus()
43+
def self.getprotectionstatus()
4444
ret = {}
4545

4646
mcafeeName = @mcafeeName
@@ -93,7 +93,7 @@ def self.getprotectionstatus()
9393
else
9494
quickscanarray = taskcmd[$i].split(" ")
9595
quickscanStatus = 'NA'
96-
quickscan, quickscanStatus = parseMcAfeeDateTime(quickscanarray , @mcafeeVersion)
96+
quickscan, quickscanStatus = parseMcAfeeDateTime(taskcmd[$i], quickscanarray , @mcafeeVersion)
9797
if quickscan == "NA"
9898
protectionStatusDetailsArray.push("Fail to parse quickscan date: " + taskcmd[$i])
9999
end
@@ -108,7 +108,7 @@ def self.getprotectionstatus()
108108
else
109109
fullscanarray = taskcmd[$i].split(" ")
110110
fullscanStatus = 'NA'
111-
fullscan, fullscanStatus = parseMcAfeeDateTime(fullscanarray, @mcafeeVersion)
111+
fullscan, fullscanStatus = parseMcAfeeDateTime(taskcmd[$i], fullscanarray, @mcafeeVersion)
112112
if fullscan == "NA"
113113
protectionStatusDetailsArray.push("Fail to parse fullscan date: " + taskcmd[$i])
114114
end
@@ -122,7 +122,7 @@ def self.getprotectionstatus()
122122
else
123123
datengupdatearray = taskcmd[$i].split(" ")
124124
datengupdateStatus = 'NA'
125-
datengupdate, datengupdateStatus = parseMcAfeeDateTime(datengupdatearray, @mcafeeVersion)
125+
datengupdate, datengupdateStatus = parseMcAfeeDateTime(taskcmd[$i], datengupdatearray, @mcafeeVersion)
126126
if datengupdate == "NA"
127127
protectionStatusDetailsArray.push("Fail to parse DAT Engine update date: " + taskcmd[$i])
128128
end
@@ -249,11 +249,11 @@ def self.getprotectionstatus()
249249
return ret
250250
end
251251

252-
def self.parseMcAfeeDateTime(datearray , mcafeeVersion)
252+
def self.parseMcAfeeDateTime(taskcmd, datearray , mcafeeVersion)
253253
begin
254254
mcafeeVersionSplit = mcafeeVersion.to_s.split(".")
255255
if (mcafeeVersionSplit[1].to_i > 6) || (mcafeeVersionSplit[1].to_i == 6 && mcafeeVersionSplit[2].to_i >=6 )
256-
return parseMcAfeeDateTimeForSixPointSixVersionAndNewer(datearray)
256+
return parseMcAfeeDateTimeForSixPointSixVersionAndNewer(taskcmd, datearray)
257257
else
258258
return parseMcAfeeDateTimeSixPointFiveVersionAndOlder(datearray)
259259
end
@@ -285,14 +285,18 @@ def self.parseMcAfeeDateTimeSixPointFiveVersionAndOlder(datearray)
285285
return scandate, scanstatus
286286
end
287287

288-
def self.parseMcAfeeDateTimeForSixPointSixVersionAndNewer(datearray)
289-
$l = datearray.length
290-
scandate = 'NA'
291-
scanstatus = 'NA'
292-
scandate = datearray[$l-6] + " " + datearray[$l-5] + " " + datearray[$l-4] + " " + datearray[$l-3] + " " + datearray[$l-2] + " " + datearray[$l-1]
293-
scandate = Time.strptime(scandate, '%a %b %d %H:%M:%S %Y')
294-
scandate.utc.strftime("%d/%m/%y %H:%M:%S %Z")
295-
scanstatus = datearray[9]
296-
return scandate, scanstatus
288+
# function to handle version 10.6.6 and above for mcafee
289+
def self.parseMcAfeeDateTimeForSixPointSixVersionAndNewer(taskcmd, datearray)
290+
begin
291+
$l = datearray.length
292+
scandate = 'NA'
293+
scanstatus = 'NA'
294+
regularexpressionforscanstatus = /\b(Not Started|Running|Completed|Aborted)\b/
295+
scandatestring = datearray[$l-6] + " " + datearray[$l-5] + " " + datearray[$l-4] + " " + datearray[$l-3] + " " + datearray[$l-2] + " " + datearray[$l-1]
296+
scandateparsed = Time.parse(scandatestring)
297+
scandateparsed.utc.strftime('%m/%d/%Y %H:%M:%S')
298+
scanstatus = (regularexpressionforscanstatus.match(taskcmd))
299+
return scandateparsed, scanstatus.to_s
300+
end
297301
end
298302
end

installbuilder/datafiles/Base_DSC.data

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ SHLIB_EXT: 'so'
102102
/opt/microsoft/omsconfig/module_packages/nxOMSContainers_1.0.zip; release/nxOMSContainers_1.0.zip; 755; ${{RUN_AS_USER}}; root
103103
/opt/microsoft/omsconfig/module_packages/nxOMSCustomLog_1.0.zip; release/nxOMSCustomLog_1.0.zip; 755; ${{RUN_AS_USER}}; root
104104
/opt/microsoft/omsconfig/module_packages/nxOMSGenerateInventoryMof_1.5.zip; release/nxOMSGenerateInventoryMof_1.5.zip; 755; ${{RUN_AS_USER}}; root
105-
/opt/microsoft/omsconfig/module_packages/nxOMSPlugin_3.70.zip; release/nxOMSPlugin_3.70.zip; 755; ${{RUN_AS_USER}}; root
105+
/opt/microsoft/omsconfig/module_packages/nxOMSPlugin_3.71.zip; release/nxOMSPlugin_3.71.zip; 755; ${{RUN_AS_USER}}; root
106106
/opt/microsoft/omsconfig/module_packages/nxOMSWLI_1.46.zip; release/nxOMSWLI_1.46.zip; 755; ${{RUN_AS_USER}}; root
107107
#endif
108108

@@ -418,7 +418,7 @@ if [ "$pythonVersion" = "python3" ]; then
418418
su - omsagent -c "/opt/microsoft/omsconfig/Scripts/python3/InstallModule.py /opt/microsoft/omsconfig/module_packages/nxOMSContainers_1.0.zip 0"
419419
su - omsagent -c "/opt/microsoft/omsconfig/Scripts/python3/InstallModule.py /opt/microsoft/omsconfig/module_packages/nxOMSCustomLog_1.0.zip 0"
420420
su - omsagent -c "/opt/microsoft/omsconfig/Scripts/python3/InstallModule.py /opt/microsoft/omsconfig/module_packages/nxOMSGenerateInventoryMof_1.5.zip 0"
421-
su - omsagent -c "/opt/microsoft/omsconfig/Scripts/python3/InstallModule.py /opt/microsoft/omsconfig/module_packages/nxOMSPlugin_3.70.zip 0"
421+
su - omsagent -c "/opt/microsoft/omsconfig/Scripts/python3/InstallModule.py /opt/microsoft/omsconfig/module_packages/nxOMSPlugin_3.71.zip 0"
422422
su - omsagent -c "/opt/microsoft/omsconfig/Scripts/python3/InstallModule.py /opt/microsoft/omsconfig/module_packages/nxOMSWLI_1.46.zip 0"
423423
else
424424
echo "Running python2 python version is ", $pythonVersion
@@ -428,7 +428,7 @@ else
428428
su - omsagent -c "/opt/microsoft/omsconfig/Scripts/InstallModule.py /opt/microsoft/omsconfig/module_packages/nxOMSContainers_1.0.zip 0"
429429
su - omsagent -c "/opt/microsoft/omsconfig/Scripts/InstallModule.py /opt/microsoft/omsconfig/module_packages/nxOMSCustomLog_1.0.zip 0"
430430
su - omsagent -c "/opt/microsoft/omsconfig/Scripts/InstallModule.py /opt/microsoft/omsconfig/module_packages/nxOMSGenerateInventoryMof_1.5.zip 0"
431-
su - omsagent -c "/opt/microsoft/omsconfig/Scripts/InstallModule.py /opt/microsoft/omsconfig/module_packages/nxOMSPlugin_3.70.zip 0"
431+
su - omsagent -c "/opt/microsoft/omsconfig/Scripts/InstallModule.py /opt/microsoft/omsconfig/module_packages/nxOMSPlugin_3.71.zip 0"
432432
su - omsagent -c "/opt/microsoft/omsconfig/Scripts/InstallModule.py /opt/microsoft/omsconfig/module_packages/nxOMSWLI_1.46.zip 0"
433433
#endif
434434

0 commit comments

Comments
 (0)