Add ROLE to .ckl ASSET Tag and delete HOST_GUID

These changes make the .ckl exports compatible with the latest STIG Viewer 2.8.
This commit is contained in:
Jeff Odegard 2018-10-29 19:42:36 -06:00 committed by GitHub
parent 5d8711d494
commit f1cab13251
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,6 +73,8 @@ $xml = new Array2XML();
$xml->standalone = true;
$xml->formatOutput = true;
$chk_comp_count = 0;
$tgt_comp_count = 0;
$total_chk_count = 0;
$total_stigs = 0;
@ -83,6 +85,7 @@ if ($tgt_count = count($tgts)) {
$host_ip = (is_array($tgt->interfaces) && count($tgt->interfaces) ? current($tgt->interfaces)->get_IPv4() : null);
$host_fqdn = (is_array($tgt->interfaces) && count($tgt->interfaces) ? current($tgt->interfaces)->get_FQDN() : null);
$host_mac = (is_array($tgt->interfaces) && count($tgt->interfaces) ? current($tgt->interfaces)->get_MAC() : null);
//$host_mac = (count($tgt->interfaces) ? current($tgt->interfaces)->get_Mac() : null);
print "Target: {$tgt->get_Name()}" . PHP_EOL;
@ -119,8 +122,8 @@ if ($tgt_count = count($tgts)) {
$arr = [
'@comment' => "CyberPerspectives Sagacity v" . VER,
'ASSET' => [
'ROLE' => 'None',
'ASSET_TYPE' => 'Computing',
'ROLE' => 'None',
'ASSET_TYPE' => 'Computing',
'HOST_NAME' => $tgt->get_Name(),
'HOST_IP' => $host_ip,
'HOST_MAC' => $host_mac,
@ -217,7 +220,7 @@ if ($tgt_count = count($tgts)) {
}
// decoding because check contents are already encoded
//$cc = str_replace("\\n", "\n", htmlentities(html_entity_decode($pdi['check_contents'])));
$cc = str_replace("\\n", "<br />", htmlentities(html_entity_decode($pdi['check_contents'])));
$stig_data = array_merge([
[
@ -254,11 +257,11 @@ if ($tgt_count = count($tgts)) {
],
[
'VULN_ATTRIBUTE' => 'Check_Content',
'ATTRIBUTE_DATA' => htmlentities(str_replace("\\n", "\n", html_entity_decode(html_entity_decode($pdi['check_contents']))))
'ATTRIBUTE_DATA' => $cc
],
[
'VULN_ATTRIBUTE' => 'Fix_Text',
'ATTRIBUTE_DATA' => htmlentities(str_replace("\\n", "\n", html_entity_decode(html_entity_decode($pdi['fix_text']))))
'ATTRIBUTE_DATA' => htmlentities($pdi['fix_text'])
],
[
'VULN_ATTRIBUTE' => 'False_Positives',
@ -298,11 +301,7 @@ if ($tgt_count = count($tgts)) {
],
[
'VULN_ATTRIBUTE' => 'Check_Content_Ref',
'ATTRIBUTE_DATA' => 'M'
],
[
'VULN_ATTRIBUTE' => 'Weight',
'ATTRIBUTE_DATA' => '10.0'
'ATTRIBUTE_DATA' => ''
],
[
'VULN_ATTRIBUTE' => 'Class',
@ -322,7 +321,6 @@ if ($tgt_count = count($tgts)) {
$notes = '';
if (is_a($find, 'finding')) {
/** @var finding $find */
$status = $status_map[$find->get_Finding_Status_String()];
$notes = $find->get_Notes();
}