Last active
November 14, 2017 14:28
-
-
Save entelechyIT/944f608ea639e0f46e67def18d53de0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# download and unzip your benchmark from DIA NISTA | |
# from: http://iase.disa.mil/stigs/compilations/Pages/index.aspx | |
$BenchMarkFilePath = '~\Documents\U_Windows_2012_and_2012_R2_MS_STIG_V2R6_Manual-xccdf.xml' | |
# Download and unzip the latest control list | |
# from: http://iase.disa.mil/stigs/cci/Pages/index.aspx | |
$CCIControlFile = '~\Documents\U_CCI_List.xml' | |
# This is the NIST Revision we are wanting to reference: | |
$CCIFilter = 'NIST SP 800-53 Revision 4' | |
# Load the content as XML | |
[xml]$Stigx = Get-Content -Path $BenchMarkFilePath -EA Stop | |
[xml]$CCIx = Get-Content -Path $CCIControlFile -EA Stop | |
# start by parsing the xccdf benchmark | |
if($Stigx){ | |
$StigCollection = @() | |
# loop through the xccdf benchmark collecting data into an object collection | |
foreach ($rule in $StigX.Benchmark.Group.Rule){ | |
# create a new PSObject collecting and stripping out as required. | |
$STIG = New-Object -TypeName PSObject -Property ([ordered]@{ | |
RuleID = $rule. id | |
RuleTitle = $rule.title | |
Severity = $rule.severity | |
VulnerabilityDetails = $($($($rule.description) -split '</VulnDiscussion>')[0] -replace '<VulnDiscussion>', '') | |
Check = $rule.check.'check-content' | |
Fix = $rule.fixtext.'#text' | |
ControlIdentifier = $rule.ident.'#text' | |
Control = $null # control is null as it will be added from the CCI List | |
}) | |
$StigCollection += $STIG | |
}# close foreach | |
}# close if | |
# loop through the Stig Collection updating the Control information pulled from the U_CCI_List.xml | |
foreach($StigObj in $StigCollection){ | |
foreach($CciItem in $CCIX.cci_list.cci_items.cci_item){ | |
if($CciItem.Id -EQ $StigObj.ControlIdentifier){ | |
# filter the control version by the title | |
if($CciItem.references.reference.title -EQ $CCIFilter){ | |
$StigObj.Control = $CciItem.references.reference.index | |
} | |
} | |
} | |
} | |
# let's review our results. | |
$StigCollection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment