This commit is contained in:
Ryan Prather 2018-10-16 12:24:10 -04:00
parent 479c34ca5d
commit fc22e6875e
2 changed files with 17 additions and 11 deletions

View File

@ -59,6 +59,16 @@ else {
print "Destination: $dest" . PHP_EOL; print "Destination: $dest" . PHP_EOL;
$status_map = [
'Not Reviewed' => 'Not_Reviewed',
'Not a Finding' => 'NotAFinding',
'Open' => 'Open',
'Not Applicable' => 'Not_Applicable',
'No Data' => 'Not_Reviewed',
'Exception' => 'Open',
'False Positive' => 'NotAFinding'
];
$xml = new Array2XML(); $xml = new Array2XML();
$xml->standalone = true; $xml->standalone = true;
$xml->formatOutput = true; $xml->formatOutput = true;
@ -110,6 +120,7 @@ if ($tgt_count = count($tgts)) {
} }
$arr = [ $arr = [
'@comment' => "CyberPerspectives Sagacity v" . VER,
'ASSET' => [ 'ASSET' => [
'ASSET_TYPE' => 'Computing', 'ASSET_TYPE' => 'Computing',
'HOST_NAME' => $tgt->get_Name(), 'HOST_NAME' => $tgt->get_Name(),
@ -306,20 +317,11 @@ if ($tgt_count = count($tgts)) {
] ]
], $cci_list); ], $cci_list);
$status = "Not_Reviewed"; $status = 'Not_Reviewed';
$notes = ''; $notes = '';
if (is_a($find, 'finding')) { if (is_a($find, 'finding')) {
$status = $find->get_Finding_Status_String(); $status = $status_map[$find->get_Finding_Status_String()];
if ($status == 'Not a Finding' || $status == 'False Positive') {
$status = "NotAFinding";
}
elseif($status == 'Exception') {
$status = 'Open';
}
else {
$status = str_replace(" ", "_", $status);
}
$notes = $find->get_Notes(); $notes = $find->get_Notes();
} }

View File

@ -103,6 +103,10 @@ class Array2XML {
//return from recursion, as a note with cdata cannot have child nodes. //return from recursion, as a note with cdata cannot have child nodes.
return $node; return $node;
} }
elseif(isset($arr['@comment']) && is_string($arr['@comment'])) {
$node->appendChild($xml->createComment(self::bool2str($arr['@comment'])));
unset($arr['@comment']);
}
} }
//create subnodes using recursion //create subnodes using recursion