Commit d9294d87 authored by Jason Frisvold's avatar Jason Frisvold
Browse files

- Some config cleanup

- Code to output raw nmap report
- - Needs more work, code not completely dynamic
parent 19c2103b
......@@ -21,12 +21,14 @@
// httpd root
$skynet_work_dir = '/path/to/smarty/workspace';
// The http directory is the first level directory
// where the skynet distribution was uncompressed
$skynet_http_dir = '/path/to/skynet/html';
// The data directory is where skynet stores the encrypted output files
$skynet_data_dir = '/Users/xenophage/Code/skynet/data';
// The smarty directory is the location of the Smarty.class.php file
$skynet_smarty_dir = '/path/to/smarty';
// Path to the gpg binary
$skynet_gpg_cmd = '/usr/local/bin/gpg';
// Web location of nmap.xsl file
$skynet_nmap_xsl = '/nmap.xsl';
// This is the default stylesheet used by skynet
// The location of the stylesheet is relative to
......
......@@ -79,6 +79,7 @@
$result['address'] = long2ip($result['address']);
$result['start_time'] = strftime('%D %T', $result['start_time']);
$result['end_time'] = strftime('%D %T', $result['end_time']);
$result['elapsed_time'] = sprintf('%.2f', $result['elapsed_time']);
$smarty_data['result'] = $result;
......@@ -88,6 +89,34 @@
});
$app->get('/rawreport/:id', $isauthenticated(), function ($id) use ($app) {
global $smarty_data, $skynet_data_dir, $skynet_gpg_cmd;
// Pull all data from the timers table
$result = $app->db->table('results')
->select('filename', 'start_time')
->where('id', $id)
->first();
//datadir/year/month/day
$scantime = localtime($result['start_time'], TRUE);
$gpgfile = $skynet_data_dir . '/' . ($scantime['tm_year'] + 1900) . '/' . ($scantime['tm_mon'] + 1) . '/' . $scantime['tm_mday'] . '/' . $result['filename'];
$cmd = $skynet_gpg_cmd . ' --batch --no-tty --decrypt --no-default-keyring --keyring /Users/xenophage/Code/skynet/gui/app/key.pub --secret-keyring /Users/xenophage/Code/skynet/gui/app/key.sec ' . $gpgfile;
exec($cmd, $output, $returnval);
unset($output[0]);
unset($output[1]);
$smarty_data['output'] = $output;
// Output XML
$res = $app->response();
$res['Content-Type'] = 'text/xml';
prep_smarty($app);
$app->render('rawreport.tpl', $smarty_data);
});
$app->get('/resultlist/:cid/:tid/:sid', $isauthenticated(),
function ($cid, $tid, $sid) use ($app) {
global $smarty_data;
......
......@@ -31,17 +31,23 @@
<div class='container'>
<div class='page-header'>
<h1>Results for scan of {long2ip($result.address)}/{$result.cidr}</h1>
<h1>Results for scan of {$result.address}/{$result.cidr}</h1>
</div>
<p>Originating Server : {long2ip($result.server_ip)}</p>
<p>Originating Server : {$result.server_ip}</p>
<p>Scan Time : {$result.start_time}</p>
<p>{$result.end_time}</p>
<p>{printf('%.1f', $result.elapsed_time)}</p>
<p>{$result.elapsed_time}</p>
<p>{$result.xml_version}</p>
<p>Exit Status : {$result.exit_status}</p>
<p>Port Count : {$result.port_count}</p>
<p>{$result.filename}</p>
<div class="row-fluid">
<iframe class="container well well-small span6"
style="height: 400px; background-color: #f5e5c5;"
src="/rawreport/{$result.id}">
</iframe>
</div>
{include file='footer.tpl'}
</body>
......
{--* Skynet - Automated "Cloud" Security Scanner *}
{--* Copyright (C) 2014-present Jason Frisvold <friz@godshell.com> *}
{--* *}
{--* This program is free software; you can redistribute it and/or modify *}
{--* it under the terms of the GNU General Public License as published by *}
{--* the Free Software Foundation; either version 2 of the License, or *}
{--* (at your option) any later version. *}
{--* *}
{--* This program is distributed in the hope that it will be useful, *}
{--* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
{--* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
{--* GNU General Public License for more details. *}
{--* *}
{--* You should have received a copy of the GNU General Public License *}
{--* along with this program; if not, write to the Free Software *}
{--* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA*}
<?xml version="1.0"?>
<?xml-stylesheet href="{$skynet_nmap_xsl}" type="text/xsl"?>
{foreach from=$output item=line}
{$line}
{/foreach}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment