Some formatting
Die if installer.php fails to create password file
Update target counts after importing eChecklist and CKL
This commit is contained in:
2018-10-25 17:48:57 -04:00
parent d43775b26f
commit 7f2f6a9046
8 changed files with 26 additions and 11 deletions

View File

@ -181,7 +181,9 @@ function save_Database($params)
* CREATE DB PASSWORD FILE
* --------------------------------- */
$enc_pwd = my_encrypt($params['web-pwd']);
file_put_contents(DOC_ROOT . "/" . PWD_FILE, $enc_pwd);
if(!file_put_contents(DOC_ROOT . "/" . PWD_FILE, $enc_pwd)) {
die(json_encode(['error' => "Could not create the password file"]));
}
if (isset($params['conf-root-pwd']) && $params['conf-root-pwd'] == $params['root-pwd']) {
$db = new mysqli(DB_SERVER, $params['root-uname'], '', 'mysql');

View File

@ -347,6 +347,13 @@ $scan->isTerminated();
}
}
/**
* @var host_list $h
*/
foreach($host_list as $h) {
$db->update_Target_Counts($h->getTargetId());
}
unset($objSS);
$db->update_Scan_Host_List($scan, $host_list);
if (!isset($cmd['debug'])) {

View File

@ -296,6 +296,8 @@ foreach ($vulns as $vul) {
$vuln_count++;
}
$db->update_Target_Counts($tgt->get_ID());
unset($xml);
if (!isset($cmd['debug'])) {
rename($cmd['f'], TMP . "/stig_viewer/$base_name");

View File

@ -601,6 +601,7 @@ if (isset($cmd['stig'])) {
'stig-progress' => 0,
'stig-count' => 0
]);
check_path(TMP . "/stigs");
$path = TMP . "/stigs/zip";
check_path($path);
$stigUrlArray = [];
@ -639,6 +640,11 @@ if (isset($cmd['stig'])) {
$log->debug("Match count: " . count($stigUrlArray));
print "Downloading " . count($stigUrlArray) . PHP_EOL;
$stigUrlArray = array_unique(array_map(function($url){return str_replace("http://", "https://", $url);}, $stigUrlArray);
sort($stigUrlArray);
$log->debug("stig array", $stigUrlArray);
if(is_array($stigUrlArray) && count($stigUrlArray)) {
foreach($stigUrlArray as $url) {
$stigFname = basename($url);