2019-03-18 08:12:54 +01:00
|
|
|
|
<%frame "frame.html"%>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<h1>Crawler</h1>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<button onclick="refreshHostTable();">!?</button>
|
|
|
|
|
<div>
|
|
|
|
|
Bezeichnung: <input type="text" id="htName" />
|
|
|
|
|
Primäre IP: <input type="text" id="htIP" />
|
|
|
|
|
<button onclick="createNewHost();">+</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="scroll fill">
|
|
|
|
|
<table id="hostTable" style="max-height: 500px;"></table>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div style="visibility: hidden;">
|
|
|
|
|
<div id="dlgCrawledHost">
|
|
|
|
|
<table>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>Bezeichnung</td>
|
|
|
|
|
<td><input type="text" id="chName"/></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>PrimäreIP</td>
|
|
|
|
|
<td>
|
|
|
|
|
<select id="chPrimaryIP" size="1">
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>IPv4 Adressen</td>
|
|
|
|
|
<td>
|
|
|
|
|
<select id="chIPs">
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colspan="2">
|
|
|
|
|
<table id="chHints">
|
|
|
|
|
</table>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
2019-03-26 12:53:42 +01:00
|
|
|
|
function scan(hostID)
|
2019-03-21 07:43:32 +01:00
|
|
|
|
{
|
2019-03-26 12:53:42 +01:00
|
|
|
|
skyapi().call("api/crawler","Crawl", [ hostID ]);
|
2019-03-21 07:43:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-26 12:53:42 +01:00
|
|
|
|
function details(crawledHost)
|
2019-03-18 08:12:54 +01:00
|
|
|
|
{
|
2019-03-26 12:53:42 +01:00
|
|
|
|
//var crawledHost = skyapi().call("api/crawler","GetHostByIP", [ primaryIP ]);
|
2019-03-18 08:12:54 +01:00
|
|
|
|
|
|
|
|
|
$("#chName").val( crawledHost.Name );
|
|
|
|
|
|
2019-03-26 12:53:42 +01:00
|
|
|
|
$("#chPrimaryIP").empty().append($("<option />").text( crawledHost.PrimaryIP ));
|
|
|
|
|
|
|
|
|
|
$("#chIPs").empty();
|
|
|
|
|
$.each( crawledHost.IPAddresses, function() {
|
|
|
|
|
$("#chIPs").append($("<option />").text(this));
|
|
|
|
|
});
|
|
|
|
|
|
2019-03-18 08:12:54 +01:00
|
|
|
|
|
|
|
|
|
$("#chHints").DataTable().clear();
|
|
|
|
|
$("#chHints").DataTable().rows.add( crawledHost.Hints ).draw();
|
|
|
|
|
|
|
|
|
|
$("#dlgCrawledHost").dialog({
|
|
|
|
|
modal: true,
|
|
|
|
|
buttons: {
|
|
|
|
|
"schliessen": function() {
|
|
|
|
|
$( this ).dialog( "close" );
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
width: "900px",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var hostTable = null;
|
|
|
|
|
|
|
|
|
|
function createNewHost()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var host = skyapi().call("api/crawler","AddHost", [ $("#htIP").val(), $("#htName").val() ]);
|
|
|
|
|
$('#hostTable').DataTable().rows.add( [ host ] ).draw();
|
|
|
|
|
} catch (e)
|
|
|
|
|
{
|
|
|
|
|
alert("Exception: " + e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function refreshHostTable()
|
|
|
|
|
{
|
|
|
|
|
var hostList = skyapi().call("api/crawler","GetHosts");
|
|
|
|
|
if (!hostList)
|
|
|
|
|
hostList = []
|
|
|
|
|
|
|
|
|
|
$('#hostTable').DataTable().clear();
|
|
|
|
|
$('#hostTable').DataTable().rows.add( hostList ).draw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var columns = [
|
|
|
|
|
{ title: "", data: null },
|
|
|
|
|
{ title: "Bezeichnung", data: "Name", sorter: "string", width: 180, editor: "input"},
|
|
|
|
|
{ title: "Primäre IP", data: "PrimaryIP", sorter: "string", width: 180 },
|
|
|
|
|
/* { title: "IP Addressen", data: "IPAddresses", sorter: "string" }, */
|
2019-03-26 12:53:42 +01:00
|
|
|
|
{ title: "Primäre HWADDR", data: "PrimaryHWAddr", sorter: "string", width: 240 },
|
2019-03-18 08:12:54 +01:00
|
|
|
|
/* { title: "HW Addresses", data: "HWAddresses", sorter: "string" }, */
|
|
|
|
|
{ title: "Zuerst gesehen", data: "FirstSeen", sorter: "", width: 180, formatter: "datetime", formatterParams: { inputFormat: "", outputFormat: "DD.MM.YYYY hh:mm:ss", invalidPlaceHolder: "-" } },
|
|
|
|
|
{ title: "Zuletzt gesehen", data: "LastSeen", sorter: "", width: 180, formatter: "datetime", formatterParams: { inputFormat: "", outputFormat: "DD.MM.YYYY hh:mm:ss", invalidPlaceHolder: "-" } },
|
|
|
|
|
{ title: "Letzter Scan", data: "LastCheck", sorter: "", width: 180, formatter: "datetime", formatterParams: { inputFormat: "", outputFormat: "DD.MM.YYYY hh:mm:ss", invalidPlaceHolder: "-" } },
|
2019-03-26 12:53:42 +01:00
|
|
|
|
{ title: "Letzte Scan Dauer", data: "LastCheckTime", sorter: "", width: 180 },
|
2019-03-18 08:12:54 +01:00
|
|
|
|
{ title: "Nächster Scan",data: "NextCheck",sorter: "",width: 180,formatter: "datetime",formatterParams: {inputFormat: "",outputFormat: "DD.MM.YYYY hh:mm:ss",invalidPlaceHolder: "-"} },
|
2019-03-21 14:06:36 +01:00
|
|
|
|
{ title: "SSH", data: "SSHDetected", width: 90 },
|
|
|
|
|
{ title: "SNMP", data: "SnmpDetected", width: 90 },
|
2019-03-21 07:43:32 +01:00
|
|
|
|
{ title: "RFC1213", data: "RFC1213Detected", width: 90 }
|
2019-03-18 08:12:54 +01:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$("#hostTable").DataTable( {
|
|
|
|
|
columns: columns,
|
|
|
|
|
select: "single",
|
|
|
|
|
columnDefs: [
|
|
|
|
|
{
|
|
|
|
|
targets: 0,
|
|
|
|
|
data: null,
|
|
|
|
|
|
2019-03-21 07:43:32 +01:00
|
|
|
|
defaultContent: "<button id='details'>Details</button><button id='scan'>Scan</button>"
|
2019-03-18 08:12:54 +01:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
2019-03-26 12:53:42 +01:00
|
|
|
|
$("#hostTable tbody").on( "click", "button#details", function(){ details( $("#hostTable").DataTable().row( $(this).parents('tr') ).data() ); } );
|
|
|
|
|
$("#hostTable tbody").on( "click", "button#scan", function(){ scan( $("#hostTable").DataTable().row( $(this).parents('tr') ).data().ID ); } );
|
2019-03-18 08:12:54 +01:00
|
|
|
|
|
|
|
|
|
refreshHostTable();
|
|
|
|
|
skyapi().addRefresh( refreshHostTable );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#chHints").DataTable({
|
|
|
|
|
columns: [
|
|
|
|
|
{ title: "Schlüssel", data: "Key" },
|
|
|
|
|
{ title: "Wert", data: "Value" }
|
|
|
|
|
],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
</script>
|