Update to fix some of the improper working of the results page. This does not fix the SCC result parsing...still working on that.

This commit is contained in:
Ryan Prather 2018-10-17 19:44:37 -04:00
parent 3ffd9b971e
commit 1645914d32
4 changed files with 218 additions and 170 deletions

View File

@ -4269,13 +4269,13 @@ class db
public function get_Finding_Count_By_Status($cat_id, $status, $cat = null, $ctrl = null) public function get_Finding_Count_By_Status($cat_id, $status, $cat = null, $ctrl = null)
{ {
$joins = [ $joins = [
"LEFT JOIN sagacity.target_checklist tc ON t.id=tc.tgt_id", "JOIN target_checklist tc ON t.id = tc.tgt_id",
"LEFT JOIN sagacity.pdi_checklist_lookup pcl ON pcl.checklist_id=tc.chk_id", "JOIN pdi_checklist_lookup pcl ON pcl.checklist_id = tc.chk_id",
"LEFT JOIN sagacity.findings f ON f.pdi_id=pcl.pdi_id AND t.id=f.tgt_id", "LEFT JOIN findings f ON f.pdi_id = pcl.pdi_id AND t.id = f.tgt_id",
"LEFT JOIN sagacity.findings_status fs ON fs.id=f.findings_status_id" "LEFT JOIN findings_status fs ON fs.id = f.findings_status_id"
]; ];
if (!is_null($ctrl)) { if (!is_null($ctrl)) {
$joins[] = "JOIN `sagacity`.`finding_controls` fc ON fc.`finding_id`=f.`id`"; $joins[] = "JOIN finding_controls fc ON fc.finding_id = f.id";
} }
$where = [ $where = [
@ -4323,20 +4323,20 @@ class db
} }
$field = ($status == 'Not Reviewed' ? "COUNT(DISTINCT(pcl.pdi_id)) AS 'count'" : "COUNT(DISTINCT(f.id)) AS 'count'"); $field = ($status == 'Not Reviewed' ? "COUNT(DISTINCT(pcl.pdi_id)) AS 'count'" : "COUNT(DISTINCT(f.id)) AS 'count'");
$this->help->select_count("sagacity.target t", $where, ['table_joins' => $joins]); $this->help->select_count("target t", $where, ['table_joins' => $joins]);
$this->help->sql = str_replace("COUNT(1) AS 'count'", $field, $this->help->sql); $this->help->sql = str_replace("COUNT(1) AS 'count'", $field, $this->help->sql);
$cnt = $this->help->execute(); $cnt = $this->help->execute();
$joins = [ $joins = [
"LEFT JOIN sagacity.pdi_checklist_lookup pcl ON pcl.checklist_id=c.id", "JOIN pdi_checklist_lookup pcl ON pcl.checklist_id = c.id",
"LEFT JOIN sagacity.findings f ON f.pdi_id=pcl.pdi_id", "JOIN findings f ON f.pdi_id = pcl.pdi_id",
"LEFT JOIN sagacity.findings_status fs ON f.findings_status_id=fs.id", "LEFT JOIN findings_status fs ON f.findings_status_id = fs.id",
"JOIN sagacity.target t ON t.id=f.tgt_id" "JOIN target t ON t.id = f.tgt_id"
]; ];
if (!is_null($ctrl) && is_a($ctrl, 'proc_ia_controls')) { if (!is_null($ctrl) && is_a($ctrl, 'proc_ia_controls')) {
$joins[] = "JOIN sagacity.finding_controls fc ON fc.finding_id=f.id"; $joins[] = "JOIN finding_controls fc ON fc.finding_id = f.id";
} }
$where = [ $where = [
@ -4388,7 +4388,7 @@ class db
]; ];
} }
$this->help->select_count("sagacity.checklist c", $where, array('table_joins' => $joins)); $this->help->select_count("checklist c", $where, array('table_joins' => $joins));
$this->help->sql = str_replace("COUNT(1) AS 'count'", $field, $this->help->sql); $this->help->sql = str_replace("COUNT(1) AS 'count'", $field, $this->help->sql);
$cnt += $this->help->execute(); $cnt += $this->help->execute();
@ -8404,8 +8404,11 @@ class db
} }
if ($del_tgts) { if ($del_tgts) {
/**
* @var host_list $host
*/
foreach ($scan->get_Host_List() as $host) { foreach ($scan->get_Host_List() as $host) {
$this->delete_Target($host->targetId); $this->delete_Target($host->getTargetId());
} }
} }
@ -9845,6 +9848,7 @@ class db
} }
/** /**
* Method to retrieve the category count data from the database for a specific category
* *
* @param ste_cat $cat * @param ste_cat $cat
*/ */
@ -9854,12 +9858,14 @@ class db
if($cat->get_ID()) { if($cat->get_ID()) {
$where[] = [ $where[] = [
'field' => 'cat_id', 'field' => 'cat_id',
'op' => '=',
'value' => $cat->get_ID() 'value' => $cat->get_ID()
]; ];
} }
else { else {
$where[] = [ $where[] = [
'field' => 'ste_id', 'field' => 'ste_id',
'op' => '=',
'value' => $cat->get_STE_ID() 'value' => $cat->get_STE_ID()
]; ];
} }
@ -11343,8 +11349,8 @@ class db
] ]
], [ ], [
'table_joins' => [ 'table_joins' => [
"LEFT JOIN target_checklist tc ON tc.tgt_id = t.id", "JOIN target_checklist tc ON tc.tgt_id = t.id",
"LEFT JOIN pdi_checklist_lookup pcl ON tc.chk_id = pcl.checklist_id", "JOIN pdi_checklist_lookup pcl ON tc.chk_id = pcl.checklist_id",
"LEFT JOIN findings f ON f.tgt_id = t.id AND f.pdi_id = pcl.pdi_id", "LEFT JOIN findings f ON f.tgt_id = t.id AND f.pdi_id = pcl.pdi_id",
"LEFT JOIN findings_status fs ON f.findings_status_id = fs.id" "LEFT JOIN findings_status fs ON f.findings_status_id = fs.id"
], ],
@ -11382,6 +11388,7 @@ class db
$na += $row['finding_count']; $na += $row['finding_count'];
break; break;
case 'Not Reviewed': case 'Not Reviewed':
case 'No Data':
$nr += $row['finding_count']; $nr += $row['finding_count'];
break; break;
case 'Open': case 'Open':
@ -11566,11 +11573,17 @@ class db
if (!$tgt->is_PP_Suspended()) { if (!$tgt->is_PP_Suspended()) {
$this->post_Processing($tgt->get_ID()); $this->post_Processing($tgt->get_ID());
} }
else {
$this->update_Target_Counts($tgt->get_ID());
}
} }
else { else {
if ($pp === true) { if ($pp === true) {
$this->post_Processing($tgt->get_ID()); $this->post_Processing($tgt->get_ID());
} }
else {
$this->update_Target_Counts($tgt->get_ID());
}
} }
$this->help->replace("target_net_meta", [ $this->help->replace("target_net_meta", [

View File

@ -55,27 +55,21 @@ set_time_limit(120);
$db = new db(); $db = new db();
$sources = $db->get_Sources();
$task_status = $db->get_Task_Statuses();
$ste_id = filter_input(INPUT_POST, 'ste', FILTER_VALIDATE_INT); $ste_id = filter_input(INPUT_POST, 'ste', FILTER_VALIDATE_INT);
if (!$ste_id) { if (! $ste_id) {
$ste_id = filter_input(INPUT_COOKIE, 'ste', FILTER_VALIDATE_INT); $ste_id = filter_input(INPUT_COOKIE, 'ste', FILTER_VALIDATE_INT);
} }
$status = filter_input(INPUT_POST, 'status', FILTER_SANITIZE_STRING); $status = filter_input(INPUT_POST, 'status', FILTER_SANITIZE_STRING);
$type = filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING); $type = filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING);
$scans = []; $scans = [];
if ($type != 'all' && $status != 'all') { if ($type != 'all' && $status != 'all') {
$scans = $db->get_ScanData($ste_id, null, $status, $type); $scans = $db->get_ScanData($ste_id, null, $status, $type);
} } elseif ($type != 'all') {
elseif ($type != 'all') {
$scans = $db->get_ScanData($ste_id, null, null, $type); $scans = $db->get_ScanData($ste_id, null, null, $type);
} } elseif ($status != 'all') {
elseif ($status != 'all') {
$scans = $db->get_ScanData($ste_id, null, $status); $scans = $db->get_ScanData($ste_id, null, $status);
} } elseif (isset($ste_id)) {
elseif (isset($ste_id)) {
$scans = $db->get_ScanData($ste_id); $scans = $db->get_ScanData($ste_id);
} }
@ -86,76 +80,81 @@ $stes = $db->get_STE();
<!-- add in page style tags for Results page size --> <!-- add in page style tags for Results page size -->
<style type="text/css"> <style type="text/css">
.scan_type { .scan_type {
width: 25px; width: 25px;
} }
#importBtn { #importBtn {
margin: auto; margin: auto;
width: 1200px; width: 1200px;
text-align: right; text-align: right;
} }
#host_list_frame { #host_list_frame {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
#progress p { #progress p {
width: 1000px; width: 1000px;
} }
/* Results Management list host button */ /* Results Management list host button */
.button-list { .button-list {
display: inline-block; display: inline-block;
outline: 0; outline: 0;
white-space: nowrap; white-space: nowrap;
background: #A4C1DD; background: #A4C1DD;
box-shadow: inset 0px 0px 0px 1px #192364, 0px 2px 3px 0px rgba(0, 0, 0, 0.25); box-shadow: inset 0px 0px 0px 1px #192364, 0px 2px 3px 0px
border: solid 1px #102D5F; rgba(0, 0, 0, 0.25);
border-radius: 6px; border: solid 1px #102D5F;
background-image: -moz-linear-gradient(top, #A4C1DD, #1D57A0); border-radius: 6px;
background-image: -webkit-linear-gradient(top, #A4C1DD, #1D57A0); background-image: -moz-linear-gradient(top, #A4C1DD, #1D57A0);
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#A4C1DD), to(#1D57A0)); background-image: -webkit-linear-gradient(top, #A4C1DD, #1D57A0);
background-image: -ms-linear-gradient(top, #A4C1DD, #1D57A0); background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#A4C1DD),
background-image: -o-linear-gradient(top, #A4C1DD, #1D57A0); to(#1D57A0));
background-image: linear-gradient(top, #A4C1DD, #1D57A0); background-image: -ms-linear-gradient(top, #A4C1DD, #1D57A0);
text-decoration: none; background-image: -o-linear-gradient(top, #A4C1DD, #1D57A0);
text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.5); background-image: linear-gradient(top, #A4C1DD, #1D57A0);
font-size: 12pt; text-decoration: none;
color: #fff; text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.5);
font-family: 'Yanone Kaffeesatz'; font-size: 12pt;
width: 70px; color: #fff;
height: 30px; font-family: 'Yanone Kaffeesatz';
} width: 70px;
height: 30px;
}
/* Button mouseover Activity for scan table */ /* Button mouseover Activity for scan table */
.mouseover-scan { .mouseover-scan {
background: #E55234; background: #E55234;
box-shadow: inset 0px 0px 0px 1px #F5AC97, 0px 2px 3px 0px rgba(0, 0, 0, 0.25); box-shadow: inset 0px 0px 0px 1px #F5AC97, 0px 2px 3px 0px
border: solid 1px #B72204; rgba(0, 0, 0, 0.25);
border-radius: 6px; border: solid 1px #B72204;
background-image: -moz-linear-gradient(top, #B41D08, #EB6541); border-radius: 6px;
background-image: -webkit-linear-gradient(top, #B41D08, #EB6541); background-image: -moz-linear-gradient(top, #B41D08, #EB6541);
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#B41D08), to(#EB6541)); background-image: -webkit-linear-gradient(top, #B41D08, #EB6541);
background-image: -ms-linear-gradient(top, #B41D08, #EB6541); background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#B41D08),
background-image: -o-linear-gradient(top, #B41D08, #EB6541); to(#EB6541));
background-image: linear-gradient(top, #B41D08, #EB6541); background-image: -ms-linear-gradient(top, #B41D08, #EB6541);
} background-image: -o-linear-gradient(top, #B41D08, #EB6541);
background-image: linear-gradient(top, #B41D08, #EB6541);
}
td span { td span {
display: none; display: none;
} }
.checklist_image { .checklist_image {
width: 32px; width: 32px;
vertical-align: middle; vertical-align: middle;
} }
</style> </style>
<script type='text/javascript'> <script type='text/javascript'>
var to; var to;
var table; var table;
var button;
<?php if (NOTIFICATIONS && file_exists("complete.mp3")) { ?> <?php if (NOTIFICATIONS && file_exists("complete.mp3")) { ?>
var audio = new Audio("complete.mp3"); var audio = new Audio("complete.mp3");
<?php } ?> <?php } ?>
@ -211,16 +210,19 @@ $stes = $db->get_STE();
for (var x in data.results) { for (var x in data.results) {
var kill = ''; var kill = '';
var scan_id = data.results[x].scan_id; var scan_id = data.results[x].scan_id;
if ($('#id-' + scan_id).length) { var row = table.row('#id-' + scan_id);
var cur_status = table.cell(table.rows('#id-' + scan_id), 5).data(); if(row.length) {
table.cell(table.rows('#id-' + scan_id), 4).data(data.results[x].run_time); var idx = row.index();
table.cell(table.rows('#id-' + scan_id), 5).data(data.results[x].status); tmp = row.data();
table.cell(table.rows('#id-' + scan_id), 6).data("<progress min='0' max='100' value='" + data.results[x].perc_comp + "' title='" + data.results[x].perc_comp + "%'></progress><span>" + data.results[x].perc_comp + "</span>"); var cur_status = tmp[5];
tmp[4] = data.results[x].run_time;
tmp[5] = data.results[x].status;
tmp[6] = "<progress min='0' max='100' value='" + data.results[x].perc_comp + "' title='" + data.results[x].perc_comp + "%'></progress><span>" + data.results[x].perc_comp + "</span>";
kill = $('#action-' + scan_id + ' .kill'); kill = $('#action-' + scan_id + ' .kill');
if (data.results[x].status === 'RUNNING' && !kill.length) { if (data.results[x].status === 'RUNNING' && !kill.length) {
$('#action-' + scan_id).append("<a class='kill-link' href='kill.php?ste=<?php print $ste_id; ?>&id=" + scan_id + "&pid=" + data.results[x].pid + "' target='_blank'>" + tmp[7] += "<a class='kill-link' href='kill.php?ste=<?php print $ste_id; ?>&id=" + scan_id + "&pid=" + data.results[x].pid + "' target='_blank'>" +
"<img class='kill checklist_image' src='/img/X.png' style='vertical-align:middle;' title='Kill' />" + "<img class='kill checklist_image' src='/img/X.png' style='vertical-align:middle;' title='Kill' />" +
"</a>"); "</a>";
} }
else if (cur_status === 'RUNNING' && data.results[x].status === 'COMPLETE') { else if (cur_status === 'RUNNING' && data.results[x].status === 'COMPLETE') {
$('#action-' + scan_id + '.kill-link').remove(); $('#action-' + scan_id + '.kill-link').remove();
@ -228,6 +230,7 @@ $stes = $db->get_STE();
audio.play(); audio.play();
<?php } ?> <?php } ?>
} }
table.row(idx).invalidate(tmp).draw(false);
} }
else { else {
if ($('#status').val() && $('#type').val()) { if ($('#status').val() && $('#type').val()) {
@ -266,25 +269,23 @@ $stes = $db->get_STE();
row.append("<td class='dt-body-center' id='action-" + scan_id + "'>" + row.append("<td class='dt-body-center' id='action-" + scan_id + "'>" +
(data.results[x].error ? "<img src='/img/error.png' class='checklist_image' onclick='javascript:List_host(" + scan_id + ");' />" : "") + (data.results[x].error ? "<img src='/img/error.png' class='checklist_image' onclick='javascript:List_host(" + scan_id + ");' />" : "") +
"<a href='javascript:void(0);' title='Host Listing' onclick='javascript:List_host(" + scan_id + ");'><img src='/img/options.png' class='checklist_image' /></a>&nbsp;" + "<a href='javascript:void(0);' title='Host Listing' onclick='javascript:List_host(" + scan_id + ");'><img src='/img/options.png' class='checklist_image' /></a>&nbsp;" +
"<form method='post' action='index.php' onsubmit='return del_scan(this);' style='display:inline;'>" + "<img src='/img/delete.png' class='checklist_image' " +
"<input type='hidden' name='ste' value='<?php print $ste_id ?>' />" + "onclick='scan_id=" + scan_id + ";del_scan($(this));' " +
"<input type='hidden' name='delete_scan' value='" + scan_id + "' />" + "title='Delete a scan file' />"
"<input type='hidden' name='delete_targets' value='0' />" + + kill
"<input type='image' class='checklist_image' src='/img/delete.png' border='0' alt='Delete' />" +
"</form>" + kill
); );
table.row.add(row[0]); table.row.add(row[0]);
} }
} }
table.order(table.order()[0]).draw(); table.order(table.order()[0]).draw(false);
$('.button-delete,.button-list').mouseover(function () { $('.button-delete,.button-list').mouseover(function () {
$(this).addClass('mouseover-scan'); $(this).addClass('mouseover-scan');
}); });
$('.button-delete,.button-list').mouseout(function () { $('.button-delete,.button-list').mouseout(function () {
$(this).removeClass('mouseover-scan'); $(this).removeClass('mouseover-scan');
}); });
if ($('#toggle_refresh').val() === 'Stop Refresh') { if ($('#toggle_refresh').val() === 'Stop Refresh' && (!$('#delete-target-confirm').dialog('isOpen') || !$('#delete-scan-confirm').dialog('isOpen'))) {
to = setTimeout(update_script_status, <?php print UPDATE_FREQ * 1000; ?>); to = setTimeout(update_script_status, <?php print UPDATE_FREQ * 1000; ?>);
} }
}, },
@ -296,8 +297,7 @@ $stes = $db->get_STE();
dataType: 'json', dataType: 'json',
//timeout: 5000, //timeout: 5000,
method: 'post' method: 'post'
} });
);
} }
/** /**
* *
@ -329,8 +329,8 @@ $stes = $db->get_STE();
<form method="post" action="index.php"> <form method="post" action="index.php">
ST&amp;E Name: ST&amp;E Name:
<select name='ste' style='width: 400px;' id="ste" <select name='ste' style='width: 400px;' id="ste"
onchange="setCookie('ste', this.value);this.form.submit();"> onchange="setCookie('ste', this.value);this.form.submit();">
<option value='0'> -- Please Select an ST&amp;E -- </option> <option value='0'>-- Please Select an ST&amp;E --</option>
<?php <?php
if (is_array($stes) && count($stes)) { if (is_array($stes) && count($stes)) {
foreach ($stes as $ste) { foreach ($stes as $ste) {
@ -348,23 +348,26 @@ $stes = $db->get_STE();
</div> </div>
<div id="importBtn"> <div id="importBtn">
<!-- Results tab Import Button --> <!-- Results tab Import Button -->
<input type='button' class="button" value='Stop Refresh' <input type='button' class="button"
id="toggle_refresh" onclick="javascript:toggle_refresh();" /> value='Stop Refresh' id="toggle_refresh"
<input type='button' class='button' value='Import' onclick="javascript:toggle_refresh();" />
onclick="javascript:add_import();" /> <input type='button' class='button'
value='Import'
onclick="javascript:add_import();" />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div style='margin:20px auto auto auto;width:1200px;'> <div style='margin: 20px auto auto auto; width: 1200px;'>
<table id="results-table" class='display compact hover' data-order='[[ 3, "desc" ]]' data-page-length='25'> <table id="results-table" class='display compact hover'
data-page-length='25'>
<thead> <thead>
<tr> <tr>
<th style='width:325px;'>Name</th> <th style='width: 325px;'>Name</th>
<th style='width:75px;'>Date</th> <th style='width: 75px;'>Date</th>
<th style='width:65px;'> <th style='width: 65px;'>
<select id='type' style='width:60px;'> <select id='type' style='width: 60px;'>
<option value=''>TYPE</option> <option value=''>TYPE</option>
<option>Data Collection</option> <option>Data Collection</option>
<option>eChecklist</option> <option>eChecklist</option>
@ -379,10 +382,10 @@ $stes = $db->get_STE();
<option>STIG Viewer</option> <option>STIG Viewer</option>
</select> </select>
</th> </th>
<th style='width:65px;'>Start</th> <th style='width: 65px;'>Start</th>
<th>Running</th> <th>Running</th>
<th style='width:80px;'> <th style='width: 80px;'>
<select id='status' style='width:75px;'> <select id='status' style='width: 75px;'>
<option value=''>STATUS</option> <option value=''>STATUS</option>
<option>IN QUEUE</option> <option>IN QUEUE</option>
<option>RUNNING</option> <option>RUNNING</option>
@ -393,8 +396,11 @@ $stes = $db->get_STE();
</th> </th>
<th>% Comp</th> <th>% Comp</th>
<th>Action&nbsp;&nbsp; <th>Action&nbsp;&nbsp;
<a href="kill.php?pid=*&ste=<?php print (isset($ste_id) ? $ste_id : '0'); ?>" target='_new'> <a href="kill.php?pid=*&ste=<?php print (isset($ste_id) ? $ste_id : '0'); ?>"
<img src='/img/X.png' class='checklist_image' style='vertical-align:middle;' title='Kill and Remove All' /> target='_new'>
<img src='/img/X.png' class='checklist_image'
style='vertical-align: middle;'
title='Kill and Remove All' />
</a> </a>
</th> </th>
</tr> </tr>
@ -406,36 +412,45 @@ $stes = $db->get_STE();
$diff = $scan->get_Last_Update()->diff($scan->get_Start_Time()); $diff = $scan->get_Last_Update()->diff($scan->get_Start_Time());
?> ?>
<tr id='<?php print "id-{$scan->get_ID()}"; ?>'> <tr id='<?php print "id-{$scan->get_ID()}"; ?>'>
<td title='<?php print $scan->get_Notes(); ?>'><?php print $scan->get_File_Name(); ?></td> <td title='<?php print $scan->get_Notes(); ?>'><?php print $scan->get_File_Name(); ?></td>
<td><?php print $scan->get_File_DateTime()->format("Y-m-d"); ?></td> <td><?php print $scan->get_File_DateTime()->format("Y-m-d"); ?></td>
<td class='dt-body-center'> <td class='dt-body-center'>
<img class='scan_type' src='/img/scan_types/<?php print $scan->get_Source()->get_Icon(); ?>' title='<?php print $scan->get_Source()->get_Name(); ?>' /><br /> <img class='scan_type' src='/img/scan_types/<?php print $scan->get_Source()->get_Icon(); ?>'
<span><?php print $scan->get_Source()->get_Name(); ?></span> title='<?php print $scan->get_Source()->get_Name(); ?>' /><br />
</td> <span><?php print $scan->get_Source()->get_Name(); ?></span>
<td><?php print $scan->get_Start_Time()->format("y-m-d H:i:s"); ?></td> </td>
<td><?php print (!is_null($diff) ? $diff->format("%H:%I:%S") : ""); ?></td> <td><?php print $scan->get_Start_Time()->format("y-m-d H:i:s"); ?></td>
<td><?php print $scan->get_Status(); ?></td> <td><?php print (!is_null($diff) ? $diff->format("%H:%I:%S") : ""); ?></td>
<td> <td><?php print $scan->get_Status(); ?></td>
<progress min='0' max='100' value='<?php print $scan->get_Percentage_Complete(); ?>' title='<?php print $scan->get_Percentage_Complete(); ?>%'></progress> <td>
<span><?php print $scan->get_Percentage_Complete(); ?></span> <progress min='0' max='100'
</td> value='<?php print $scan->get_Percentage_Complete(); ?>'
<td class='dt-body-center' id="action-<?php print $scan->get_ID(); ?>"> title='<?php print $scan->get_Percentage_Complete(); ?>%'></progress>
<?php if ($scan->isScanError()) { ?> <span><?php print $scan->get_Percentage_Complete(); ?></span>
<img src='/img/error.png' class='checklist_image' onclick='javascript:List_host(<?php print $scan->get_ID(); ?>);' />&nbsp; </td>
<?php } ?> <td class='dt-body-center' id="action-<?php print $scan->get_ID(); ?>">
<a href='javascript:void(0);' title='Host Listing' onclick='javascript:List_host(<?php print $scan->get_ID(); ?>);'> <?php if ($scan->isScanError()) { ?>
<img src='/img/options.png' class='checklist_image' title='See what hosts are on this target' /> <img src='/img/error.png' class='checklist_image'
</a> onclick='javascript:List_host(<?php print $scan->get_ID(); ?>);' />&nbsp;
&nbsp; <?php } ?>
<img src='/img/delete.png' class='checklist_image' onclick='scan_id =<?php print $scan->get_ID(); ?>;del_scan();' title='Delete a scan file' /> <a href='javascript:void(0);' title='Host Listing'
<?php if ($scan->get_Status() == 'RUNNING') { ?> onclick='javascript:List_host(<?php print $scan->get_ID(); ?>);'>
<a class='kill-link' href='kill.php?<?php print "ste={$ste_id}&id={$scan->get_ID()}&pid={$scan->get_PID()}"; ?>' target='_blank'> <img src='/img/options.png' class='checklist_image'
<img src='/img/X.png' class='kill checklist_image' style='vertical-align:middle;' title='Kill' /> title='See what hosts are on this target' />
</a> </a>&nbsp;
<?php } ?> <img src='/img/delete.png' class='checklist_image'
</td> onclick='scan_id=<?php print $scan->get_ID(); ?>;del_scan($(this));'
</tr> title='Delete a scan file' />
<?php if ($scan->get_Status() == 'RUNNING') { ?>
<a class='kill-link' target='_blank'
href='kill.php?<?php print "ste={$ste_id}&id={$scan->get_ID()}&pid={$scan->get_PID()}"; ?>'>
<img src='/img/X.png' class='kill checklist_image'
style='vertical-align: middle;' title='Kill' />
</a>
<?php } ?>
</td>
</tr>
<?php <?php
} }
} }
@ -460,6 +475,18 @@ $stes = $db->get_STE();
$(this).removeClass('mouseover-scan'); $(this).removeClass('mouseover-scan');
}); });
$('#delete-target-confirm').on('dialogclose', function(e) {
if ($('#toggle_refresh').val() === 'Stop Refresh' && !$('#delete-scan-confirm').dialog('isOpen')) {
to = setTimeout(update_script_status, <?php print UPDATE_FREQ * 1000; ?>);
}
});
$('#delete-scan-confirm').on('dialogclose', function(e) {
if ($('#toggle_refresh').val() === 'Stop Refresh') {
to = setTimeout(update_script_status, <?php print UPDATE_FREQ * 1000; ?>);
}
});
$('#delete-target-confirm').dialog({ $('#delete-target-confirm').dialog({
autoOpen: false, autoOpen: false,
resizable: false, resizable: false,
@ -473,6 +500,7 @@ $stes = $db->get_STE();
$(this).dialog('close'); $(this).dialog('close');
}, },
'No': function () { 'No': function () {
delete_targets = false;
$('#delete-scan-confirm').dialog('open'); $('#delete-scan-confirm').dialog('open');
$(this).dialog('close'); $(this).dialog('close');
} }
@ -499,7 +527,7 @@ $stes = $db->get_STE();
alert(data.error); alert(data.error);
} }
else if (data.success) { else if (data.success) {
//alert(data.success); table.row($(button).closest('tr').index()).remove().draw();
$('#id-' + scan_id).remove(); $('#id-' + scan_id).remove();
} }
}, },
@ -509,29 +537,44 @@ $stes = $db->get_STE();
dataType: 'json', dataType: 'json',
method: 'post' method: 'post'
}); });
if ($('#toggle_refresh').val() === 'Stop Refresh') {
to = setTimeout(update_script_status, <?php print UPDATE_FREQ * 1000; ?>);
}
$(this).dialog('close'); $(this).dialog('close');
}, },
Cancel: function () { Cancel: function () {
$(this).dialog('close'); $(this).dialog('close');
if ($('#toggle_refresh').val() === 'Stop Refresh') {
to = setTimeout(update_script_status, <?php print UPDATE_FREQ * 1000; ?>);
}
} }
} }
}); });
}); });
function del_scan(pressed_button) {
if ($('#toggle_refresh').val() == 'Stop Refresh') {
clearTimeout(to);
to = null;
}
button = pressed_button;
$('#delete-target-confirm').dialog('open');
}
</script> </script>
<div id='delete-target-confirm' title='Delete associated targets?'> <div id='delete-target-confirm' title='Delete associated targets?'>
<p><span class='ui-icon ui-icon-alert' style='float:left;margin:12px 12px 20px 0;'></span> Do you want to delete the associated targets?</p><br /> <p>
<p>WARNING: This will delete ALL targets in this scan and all associated data even if it was imported from another scan. This action is irreversible</p> <span class='ui-icon ui-icon-alert'
style='float: left; margin: 12px 12px 20px 0;'></span> Do
you want to delete the associated targets?
</p>
<br />
<p>WARNING: This will delete ALL targets in this scan and all
associated data even if it was imported from another scan. This
action is irreversible</p>
</div> </div>
<div id='delete-scan-confirm' title='Delete this scan?'> <div id='delete-scan-confirm' title='Delete this scan?'>
<p><span class='ui-icon ui-icon-alert' style='float:left;margin:12px 12px 20px 0;'></span> Are you sure you want to delete this scan?</p> <p>
<span class='ui-icon ui-icon-alert'
style='float: left; margin: 12px 12px 20px 0;'></span> Are
you sure you want to delete this scan?
</p>
</div> </div>
<!-- code for list button --> <!-- code for list button -->

View File

@ -66,11 +66,3 @@ function add_import() {
$('#import').css('display', 'block'); $('#import').css('display', 'block');
view_box(); view_box();
} }
function del_scan(form) {
if ($('#toggle_refresh').val() == 'Stop Refresh') {
clearTimeout(to);
to = null;
}
$('#delete-target-confirm').dialog('open');
}

View File

@ -1,2 +1,2 @@
$(function(){$(".close, .backdrop").click(function(){close_box();});});function List_host(scan_id){$("#host_list_frame").attr("src","host_list_iframe.php?ste="+$("#ste").val()+"&scan_id="+scan_id);$("#host_list_div").animate({"opacity":"1.00"},300,"linear");$("#host_list_div").css("display","block");view_box();}function close_box(){$(".backdrop, .box").animate({"opacity":"0"},300,"linear",function(){$(".backdrop, .box").css("display","none");});$(".dz-complete").remove();$(".dz-message").show();}function view_box(){$(".backdrop").animate({"opacity":".5"},300,"linear");
$(function(){$(".close, .backdrop").click(function(){close_box()})});function List_host(a){$("#host_list_frame").attr("src","host_list_iframe.php?ste="+$("#ste").val()+"&scan_id="+a);$("#host_list_div").animate({opacity:"1.00"},300,"linear");$("#host_list_div").css("display","block");view_box()}function close_box(){$(".backdrop, .box").animate({opacity:"0"},300,"linear",function(){$(".backdrop, .box").css("display","none")});$(".dz-complete").remove();$(".dz-message").show()}function view_box(){$(".backdrop").animate({opacity:".5"},300,"linear");$(".backdrop").css("display","block")}function add_import(){if($("#ste").val()<1){alert("Please select an ST&E");return}$("#add_import").val($("#ste").val());$("#import").animate({opacity:"1.00"},300,"linear");$("#import").css("display","block");view_box()}function del_scan(a){if($("#toggle_refresh").val()=="Stop Refresh"){clearTimeout(to);to=null}$("#delete-target-confirm").dialog("open")}; $(".backdrop").css("display","block");}function add_import(){if($("#ste").val()<1){alert("Please select an ST&E");return;}$("#add_import").val($("#ste").val());$("#import").animate({"opacity":"1.00"},300,"linear");$("#import").css("display","block");view_box();}