Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
a52ff529
Commit
a52ff529
authored
Jun 25, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(ids) add alert info dialog
parent
6b2a8af1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
9 deletions
+76
-9
ServiceController.php
...vc/app/controllers/OPNsense/IDS/Api/ServiceController.php
+22
-0
IndexController.php
...ense/mvc/app/controllers/OPNsense/IDS/IndexController.php
+3
-1
dialogAlert.xml
...se/mvc/app/controllers/OPNsense/IDS/forms/dialogAlert.xml
+38
-0
index.volt
src/opnsense/mvc/app/views/OPNsense/IDS/index.volt
+13
-8
No files found.
src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/ServiceController.php
View file @
a52ff529
...
...
@@ -28,6 +28,7 @@
*/
namespace
OPNsense\IDS\Api
;
use
\Phalcon\Filter
;
use
\OPNsense\Base\ApiControllerBase
;
use
\OPNsense\Core\Backend
;
use
\OPNsense\IDS\IDS
;
...
...
@@ -154,6 +155,7 @@ class ServiceController extends ApiControllerBase
}
/**
* query suricata alerts
* @return array
*/
public
function
queryAlertsAction
()
...
...
@@ -184,4 +186,24 @@ class ServiceController extends ApiControllerBase
}
return
array
();
}
/**
* fetch alert detailed info
* @param $alertId alert id, position in log file
* @return array alert info
*/
public
function
getAlertInfoAction
(
$alertId
)
{
$backend
=
new
Backend
();
$filter
=
new
Filter
();
$id
=
$filter
->
sanitize
(
$alertId
,
"int"
);
$response
=
$backend
->
configdpRun
(
"ids query alerts"
,
array
(
1
,
0
,
"filepos/"
.
$id
));
$result
=
json_decode
(
$response
,
true
);
if
(
$result
!=
null
&&
count
(
$result
[
'rows'
])
>
0
)
{
return
$result
[
'rows'
][
0
];
}
else
{
return
array
();
}
}
}
src/opnsense/mvc/app/controllers/OPNsense/IDS/IndexController.php
View file @
a52ff529
...
...
@@ -37,8 +37,10 @@ class IndexController extends \OPNsense\Base\IndexController
public
function
indexAction
()
{
$this
->
view
->
title
=
"IDS"
;
// link dialog
// link
rule
dialog
$this
->
view
->
formDialogRule
=
$this
->
getForm
(
"dialogRule"
);
// link alert info dialog
$this
->
view
->
formDialogAlert
=
$this
->
getForm
(
"dialogAlert"
);
// link IDS general settings
$this
->
view
->
formGeneralSettings
=
$this
->
getForm
(
"generalSettings"
);
// choose template
...
...
src/opnsense/mvc/app/controllers/OPNsense/IDS/forms/dialogAlert.xml
0 → 100644
View file @
a52ff529
<form>
<field>
<id>
timestamp
</id>
<label>
timestamp
</label>
<type>
info
</type>
</field>
<field>
<id>
alert
</id>
<label>
alert
</label>
<type>
info
</type>
</field>
<field>
<id>
alert_sid
</id>
<label>
alert sid
</label>
<type>
info
</type>
</field>
<field>
<id>
src_ip
</id>
<label>
source ip
</label>
<type>
info
</type>
</field>
<field>
<id>
dest_ip
</id>
<label>
destination ip
</label>
<type>
info
</type>
</field>
<field>
<id>
src_port
</id>
<label>
source port
</label>
<type>
info
</type>
</field>
<field>
<id>
dest_port
</id>
<label>
destination port
</label>
<type>
info
</type>
</field>
</form>
src/opnsense/mvc/app/views/OPNsense/IDS/index.volt
View file @
a52ff529
...
...
@@ -68,7 +68,6 @@ POSSIBILITY OF SUCH DAMAGE.
$("#grid-installedrules").UIBootgrid(
{ search:'/api/ids/settings/searchinstalledrules',
get:'/api/ids/settings/getRuleInfo/',
set:'/api/ids/settings/setRuleInfo/',
options:{
multiSelect:false,
selection:false,
...
...
@@ -91,10 +90,15 @@ POSSIBILITY OF SUCH DAMAGE.
$("#grid-alerts").UIBootgrid(
{ search:'/api/ids/service/queryAlerts',
get:'/api/ids/service/getAlert',
get:'/api/ids/service/getAlert
Info/
',
options:{
multiSelect:false,
selection:false
selection:false,
formatters:{
info: function (column, row) {
return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.filepos + "\"><span class=\"fa fa-info-circle\"></span></button> ";
}
}
}
});
...
...
@@ -168,11 +172,11 @@ POSSIBILITY OF SUCH DAMAGE.
<table id="grid-alerts" class="table table-condensed table-hover table-striped table-responsive" data-editDialog="DialogAlert">
<thead>
<tr>
<th data-column-id="timestamp" data-type="string" data-
width="14em
">timestamp</th>
<th data-column-id="src_ip" data-type="string" data-width="10em">source</th>
<th data-column-id="dest_ip" data-type="string" data-width="10em">destination</th>
<th data-column-id="alert
_sid" data-type="number" data-width="6em">sid
</th>
<th data-column-id="
alert" data-type="string">Alert
</th>
<th data-column-id="timestamp" data-type="string" data-
sortable="false
">timestamp</th>
<th data-column-id="src_ip" data-type="string" data-
sortable="false" data-
width="10em">source</th>
<th data-column-id="dest_ip" data-type="string" data-
sortable="false" data-
width="10em">destination</th>
<th data-column-id="alert
" data-type="string" data-sortable="false" >Alert
</th>
<th data-column-id="
info" data-formatter="info" data-sortable="false" data-width="4em">info
</th>
</tr>
</thead>
<tbody>
...
...
@@ -186,3 +190,4 @@ POSSIBILITY OF SUCH DAMAGE.
</div>
{{ partial("layout_partials/base_dialog",['fields':formDialogRule,'id':'DialogRule','label':'Rule details','hasSaveBtn':'false','msgzone_width':1])}}
{{ partial("layout_partials/base_dialog",['fields':formDialogAlert,'id':'DialogAlert','label':'Alert details','hasSaveBtn':'false','msgzone_width':1])}}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment