host_list.inc - Added method to increase finding count

system.inc - fixed typo
parse_excel_echecklist.php - added functionality to assign OS and checklists based on worksheet contents
database.inc - Added a couple methods to support changes for #25
export.php - Minor change to OS listing and added add_cell_comment method to migrate scanner notes to a comment instead of the main note (separating the scanner and anaylst comments)
This commit is contained in:
2018-11-08 17:26:27 -05:00
parent 7e44403d93
commit ca89e02c4e
5 changed files with 160 additions and 12 deletions

View File

@ -29,6 +29,7 @@
* fixed invalid function call to stringFromColumnIndex as it was moved to a different class and changed to 1-based instead of 0-based,
* syntax updates, updated PDF writer to Tcpdf class, added die if constant ECHECKLIST_FORMAT is not set as expected
* - Jan 15, 2018 - Formatting, updated use statements, not seeing behavior explained in #373
* - Nov 8, 2018 - Minor change to OS listing and added add_cell_comment method to migrate scanner notes to a comment instead of the main note (separating the scanner and anaylst comments)
*/
include_once 'config.inc';
include_once 'database.inc';
@ -377,9 +378,10 @@ function updateHostHeader($sheet, $tgts, &$db) {
foreach ($tgts as $tgt_name => $col_id) {
$log->notice("tgt_name: $tgt_name\tcol_id: $col_id");
$tgt = $db->get_Target_Details($ste_id, $tgt_name)[0];
/** @var software $os */
$os = $db->get_Software($tgt->get_OS_ID())[0];
$oses[] = "{$os->man} {$os->name} {$os->ver}";
$oses[] = $os->get_SW_String();
$host_names[] = $tgt->get_Name();
if (is_array($tgt->interfaces) && count($tgt->interfaces)) {
@ -505,3 +507,27 @@ function deduplicateString($str)
return $ret;
}
/**
* Method to add a comment to a particular cell
*
* @param PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $sheet
* @param string $cell
* @param string $note
*/
function add_cell_comment(&$sheet, $cell, $note)
{
$sheet->getActiveSheet()
->getComment($cell)
->setAuthor(CREATOR);
$commentRichText = $sheet->getActiveSheet()
->getComment($cell)
->getText()->createTextRun('Scanner Notes:');
$commentRichText->getFont()->setBold(true);
$sheet->getActiveSheet()
->getComment($cell)
->getText()->createTextRun("\r\n");
$sheet->getActiveSheet()
->getComment($cell)
->getText()->createTextRun($note);
}