mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
(ids) work in progress suricata IDS component (frontend/middleware)
This commit is contained in:
parent
775ffffb26
commit
2d5ea55411
@ -96,7 +96,6 @@ class SettingsController extends ApiControllerBase
|
||||
$searchPhrase .= "classtype/".$this->request->getPost("classtype", "string", '').' ';
|
||||
}
|
||||
|
||||
|
||||
// request list of installed rules
|
||||
$backend = new Backend();
|
||||
$response = $backend->configdpRun("ids list installedrules", array($itemsPerPage,
|
||||
@ -138,7 +137,42 @@ class SettingsController extends ApiControllerBase
|
||||
|
||||
if ($data != null && array_key_exists("rows", $data) && count($data['rows'])>0) {
|
||||
$row = $data['rows'][0];
|
||||
// set current enable status (default + registered offset)
|
||||
$row['enabled'] = $this->getModel()->getRuleStatus($row['sid'], $row['enabled']);
|
||||
if (isset($row['reference']) && $row['reference'] != '') {
|
||||
// browser friendly reference data
|
||||
$row['reference_html'] = '';
|
||||
foreach (explode("\n", $row['reference']) as $ref) {
|
||||
$ref = trim($ref);
|
||||
$item_html = '<small><a href="%url%" target="_blank">%ref%</a></small>';
|
||||
if (substr($ref, 0, 4) == 'url,') {
|
||||
$item_html = str_replace("%url%", 'http://'.substr($ref, 4), $item_html);
|
||||
$item_html = str_replace("%ref%", substr($ref, 4), $item_html);
|
||||
} elseif (substr($ref, 0, 7) == "system,") {
|
||||
$item_html = str_replace("%url%", substr($ref, 7), $item_html);
|
||||
$item_html = str_replace("%ref%", substr($ref, 7), $item_html);
|
||||
} elseif (substr($ref, 0, 8) == "bugtraq,") {
|
||||
$item_html = str_replace("%url%", "http://www.securityfocus.com/bid/".
|
||||
substr($ref, 8), $item_html);
|
||||
$item_html = str_replace("%ref%", "bugtraq ".substr($ref, 8), $item_html);
|
||||
} elseif (substr($ref, 0, 4) == "cve,") {
|
||||
$item_html = str_replace("%url%", "http://cve.mitre.org/cgi-bin/cvename.cgi?name=".
|
||||
substr($ref, 4), $item_html);
|
||||
$item_html = str_replace("%ref%", substr($ref, 4), $item_html);
|
||||
} elseif (substr($ref, 0, 7) == "nessus,") {
|
||||
$item_html = str_replace("%url%", "http://cgi.nessus.org/plugins/dump.php3?id=".
|
||||
substr($ref, 7), $item_html);
|
||||
$item_html = str_replace("%ref%", 'nessus '.substr($ref, 7), $item_html);
|
||||
} elseif (substr($ref, 0, 7) == "mcafee,") {
|
||||
$item_html = str_replace("%url%", "http://vil.nai.com/vil/dispVirus.asp?virus_k=".
|
||||
substr($ref, 7), $item_html);
|
||||
$item_html = str_replace("%ref%", 'macafee '.substr($ref, 7), $item_html);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
$row['reference_html'] .= $item_html.'<br/>';
|
||||
}
|
||||
}
|
||||
return $row;
|
||||
} else {
|
||||
return array();
|
||||
|
||||
@ -37,6 +37,8 @@ class IndexController extends \OPNsense\Base\IndexController
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->title = "IDS";
|
||||
// link dialog
|
||||
$this->view->formDialogRule = $this->getForm("dialogRule");
|
||||
// choose template
|
||||
$this->view->pick('OPNsense/IDS/index');
|
||||
}
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
<form>
|
||||
<field>
|
||||
<id>sid</id>
|
||||
<label>sid</label>
|
||||
<type>info</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>gid</id>
|
||||
<label>gid</label>
|
||||
<type>info</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>classtype</id>
|
||||
<label>classtype</label>
|
||||
<type>info</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>msg</id>
|
||||
<label>alert message</label>
|
||||
<type>info</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>reference_html</id>
|
||||
<label>reference</label>
|
||||
<type>info</type>
|
||||
</field>
|
||||
</form>
|
||||
@ -39,23 +39,31 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
}
|
||||
|
||||
$("#grid-installedrules").UIBootgrid(
|
||||
{ 'search':'/api/ids/settings/searchinstalledrules',
|
||||
'options':{
|
||||
'requestHandler':addFilters,
|
||||
'formatters':{
|
||||
"rowtoggle": function (column, row) {
|
||||
{ search:'/api/ids/settings/searchinstalledrules',
|
||||
get:'/api/ids/settings/getRuleInfo/',
|
||||
set:'/api/ids/settings/setRuleInfo/',
|
||||
options:{
|
||||
multiSelect:false,
|
||||
selection:false,
|
||||
requestHandler:addFilters,
|
||||
formatters:{
|
||||
rowtoggle: function (column, row) {
|
||||
if (parseInt(row[column.id], 2) == 1) {
|
||||
return "<span class=\"fa fa-check-square-o command-toggle\" data-value=\"1\" data-row-id=\"" + row.sid + "\"></span>";
|
||||
var toggle = "<span style=\"cursor: pointer;\" class=\"fa fa-check-square-o command-toggle\" data-value=\"1\" data-row-id=\"" + row.sid + "\"></span>";
|
||||
} else {
|
||||
return "<span class=\"fa fa-square-o command-toggle\" data-value=\"0\" data-row-id=\"" + row.sid + "\"></span>";
|
||||
var toggle = "<span style=\"cursor: pointer;\" class=\"fa fa-square-o command-toggle\" data-value=\"0\" data-row-id=\"" + row.sid + "\"></span>";
|
||||
}
|
||||
toggle += " <button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.sid + "\"><span class=\"fa fa-info-circle\"></span></button> ";
|
||||
return toggle;
|
||||
}
|
||||
}
|
||||
},
|
||||
'toggle':'/api/ids/settings/toggleRule/'
|
||||
toggle:'/api/ids/settings/toggleRule/'
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
// list all known classtypes and add to selection box
|
||||
ajaxGet(url="/api/ids/settings/listRuleClasstypes",sendData={}, callback=function(data, status) {
|
||||
if (status == "success") {
|
||||
@ -77,12 +85,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
</script>
|
||||
|
||||
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
|
||||
<li class="active"><a data-toggle="tab" href="#item1">{{ lang._('Item1') }}</a></li>
|
||||
<li class="active"><a data-toggle="tab" href="#rules">{{ lang._('Rules') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#item2">{{ lang._('Item2') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#item3">{{ lang._('Item3') }}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content content-box tab-content">
|
||||
<div id="item1" class="tab-pane fade in active">
|
||||
<div id="rules" class="tab-pane fade in active">
|
||||
<div class="bootgrid-header container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 actionBar">
|
||||
@ -93,27 +101,18 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
</div>
|
||||
|
||||
<!-- tab page "installed rules" -->
|
||||
<table id="grid-installedrules" class="table table-condensed table-hover table-striped table-responsive">
|
||||
<table id="grid-installedrules" class="table table-condensed table-hover table-striped table-responsive" data-editDialog="DialogRule">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="sid" data-type="number" data-visible="true" data-identifier="true" >sid</th>
|
||||
<th data-column-id="source" data-type="string">Source</th>
|
||||
<th data-column-id="classtype" data-type="string">ClassType</th>
|
||||
<th data-column-id="msg" data-type="string">Message</th>
|
||||
<th data-column-id="enabled" data-formatter="rowtoggle" data-sortable="false">enabled</th>
|
||||
<th data-column-id="enabled" data-formatter="rowtoggle" data-sortable="false">enabled / info</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
|
||||
<button data-action="deleteSelected" type="button" class="btn btn-xs btn-default"><span class="fa fa-trash-o"></span></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div id="item2" class="tab-pane fade in">
|
||||
@ -127,3 +126,5 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<button class="btn btn-primary" id="reconfigureAct" type="button"><b>Apply</b><i id="reconfigureAct_progress" class=""></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogRule,'id':'DialogRule','label':'Rule details','hasSaveBtn':'false','msgzone_width':1])}}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user