ajax.php - sort checklists

background_stigs.php - change to support adding sunset STIGs to update_db.php
parse_nessus.php/parse_nmap.php - disable post processing until the end of reading the file
update_db.php - Add sunset STIGs downloading and parsing
database.inc - Removed unnecessary variables ($key, etc), fixed typo (proc_ia_control v. proc_ia_controls), fix typo line 11072, added query_type to other queries in post_Processing method, call update_Target_Count method at the end of post_Processing, convert update_Target_Count to use queries instead of get_pdi_count and get_finding_count views (caused a performance hit), removed calling update_Target_Count from save_Target method to support previously mentioned changes
index.php - removed ajax timeout when bulk removing targets
This commit is contained in:
2018-09-18 19:53:19 -04:00
parent 78e584c1b9
commit 927ae69743
7 changed files with 181 additions and 76 deletions

View File

@ -92,6 +92,7 @@ foreach ($lines as $line_num => $line) {
continue;
} # skip blank lines
$line = trim($line, "\t\n\r"); # chomp would be nice...
$matches = [];
if (!isset($filetype)) {
if (preg_match('/Starting|\-oN/', $line)) {
$filetype = "text";
@ -242,8 +243,6 @@ if ($filetype == "xml") {
$target[$ip]['description'] = $vendor;
# Iterate through ports
$ports = getValue($xml, "ports/port", $host, true);
$tcp_ports = [];
$udp_ports = [];
foreach ($ports as $portxml) {
$portid = $portxml->getAttribute("portid");
$proto = $portxml->getAttribute("protocol");
@ -284,6 +283,7 @@ if ($filetype == "xml") {
$db->update_Running_Scan($base_name, ['name' => 'host_count', 'value' => count($target)]);
$count = 0;
$tgt_ip = null;
foreach ($target as $ip => $tgt) {
# get target ID
$tgt_id = 0;
@ -302,6 +302,7 @@ foreach ($target as $ip => $tgt) {
$tgt_obj->set_STE_ID($conf['ste']);
//$tgt_obj->set_Notes("New target found by NMap");
$tgt_obj->set_OS_ID($sw->get_ID());
$tgt_obj->set_PP_Flag(true);
if ($sw->get_Shortened_SW_String()) {
$tgt_obj->set_OS_String($sw->get_Shortened_SW_String());
}
@ -344,10 +345,11 @@ foreach ($target as $ip => $tgt) {
}
}
$tgt_obj->set_ID($tgt_id = $db->save_Target($tgt_obj));
$tgt_obj->set_ID($tgt_id = $db->save_Target($tgt_obj, false));
}
else { #Update
$db_tgt = $db->get_Target_Details($conf['ste'], $tgt_id)[0];
$db_tgt->set_PP_Flag(true);
if (isset($tgt['tcp'])) {
foreach ($tgt['tcp'] as $port_num => $port) {
@ -388,7 +390,7 @@ foreach ($target as $ip => $tgt) {
}
}
$db->save_Target($db_tgt);
$db->save_Target($db_tgt, false);
}
$count++;
@ -406,6 +408,7 @@ foreach ($target as $ip => $tgt) {
$db->update_Running_Scan($base_name, ['name' => 'last_host', 'value' => $db_tgt->get_Name()]);
}
$db->post_Processing();
$db->update_Scan_Host_List($scan);
$db->update_Running_Scan($base_name, ['name' => 'perc_comp', 'value' => 100, 'complete' => 1]);
if (!isset($cmd['debug'])) {