diff --git a/exec/export-ckl.php b/exec/export-ckl.php index 7022b80..9a56d9a 100644 --- a/exec/export-ckl.php +++ b/exec/export-ckl.php @@ -59,6 +59,16 @@ else { 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->standalone = true; $xml->formatOutput = true; @@ -110,6 +120,7 @@ if ($tgt_count = count($tgts)) { } $arr = [ + '@comment' => "CyberPerspectives Sagacity v" . VER, 'ASSET' => [ 'ASSET_TYPE' => 'Computing', 'HOST_NAME' => $tgt->get_Name(), @@ -306,20 +317,11 @@ if ($tgt_count = count($tgts)) { ] ], $cci_list); - $status = "Not_Reviewed"; + $status = 'Not_Reviewed'; $notes = ''; if (is_a($find, 'finding')) { - $status = $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); - } + $status = $status_map[$find->get_Finding_Status_String()]; $notes = $find->get_Notes(); } diff --git a/inc/array2xml.inc b/inc/array2xml.inc index 8a96a9e..b7797de 100644 --- a/inc/array2xml.inc +++ b/inc/array2xml.inc @@ -103,6 +103,10 @@ class Array2XML { //return from recursion, as a note with cdata cannot have child nodes. 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