forked from jamf/Jamf-Nation-Extension-Attributes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Firewall.xml
36 lines (36 loc) · 1.29 KB
/
Firewall.xml
1
<?xml version="1.0" encoding="UTF-8"?><extensionAttribute> <displayName>Firewall</displayName> <displayInCategory>System Information</displayInCategory> <description>This attribute displays whether or not the system firewall is enabled. This attribute applies to both Mac and Windows.</description> <dataType>string</dataType> <scriptContentsMac>#!/bin/shOS=`/usr/bin/sw_vers -productVersion | /usr/bin/colrm 5`if [[ "$OS" < "10.5" ]]; then result=`/usr/bin/defaults read /Library/Preferences/com.apple.sharing.firewall state`if [ "$result" == "YES" ]; then echo "<result>On</result>"elif [ "$result" == "NO" ]; then echo "<result>Off</result>"fielseresult=`/usr/bin/defaults read /Library/Preferences/com.apple.alf globalstate`if [ "$result" == "0" ]; then echo "<result>Off</result>"else echo "<result>On</result>"fifi </scriptContentsMac> <scriptTypeWindows>VBScript</scriptTypeWindows> <scriptContentsWindows>On Error Resume Next Set objFirewall = CreateObject("HNetCfg.FwMgr")Set objPolicy = objFirewall.LocalPolicy.CurrentProfileIf objPolicy.FirewallEnabled = True ThenstrStatus = "On"ElsestrStatus = "Off"End IfWScript.Echo "<result>" & strStatus & "</result>"</scriptContentsWindows></extensionAttribute>