Last Nessus – Tenable scan report date Jamf Extension Attribute

A Bash Script – Jamf Extension Attribute that reports the Last Nessus – Tenable scan report date Jamf Extension Attribute


#!/bin/bash
lastScan=$(/Library/NessusAgent/run/sbin/nessuscli agent status | grep -m 1 "set:" | awk '{ print $0}' | sed 's/Plugin set: //')
lastScanDate=$(date -r $lastScan)
if [[ $lastScan == "" ]]; then
echo "<result>UNKNOWN Last Nessus Tenable scan report date</result>"
else
echo "<result>$lastScan – $lastScanDate</result>"
fi

A Bash Script – Jamf Extension Attribute that reports the Last Nessus – Tenable scan report day Jamf Extension Attribute


#!/bin/bash
# This will convert from epoch time
lastScanned=$(/Library/NessusAgent/run/sbin/nessuscli agent status | grep -m 1 "scanned:" | awk '{ print $0}' | sed 's/Last scanned: //')
lastScannedDate=$(date -j -r $lastScanned)
if [[ $lastScanned == "" ]]; then
echo "<result>UNKNOWN</result>"
else
echo "<result>$lastScannedDate</result>"
fi
echo "<result>$lastScan</result>"
fi

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *