Provide NetBIOS information when available in Node and Port views
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
* [#86] Use Vendor abbrevs to enhance node display in device port view
|
||||
* [#74] Device Name / DNS mismatches report
|
||||
* [#71] Node search by date (but not time)
|
||||
* [#73] NetBIOS Poller (nbtstat and nbtwalk), NetBIOS Node Report
|
||||
* [#73] NetBIOS Poller (nbtstat and nbtwalk), NetBIOS Node Report,
|
||||
and provide information when available in Node and Port views
|
||||
* [#56] Support API call to /login
|
||||
|
||||
[ENHANCEMENTS]
|
||||
|
||||
@@ -112,6 +112,16 @@ the current Node's.
|
||||
__PACKAGE__->has_many( ips => 'App::Netdisco::DB::Result::NodeIp',
|
||||
{ 'foreign.mac' => 'self.mac', 'foreign.active' => 'self.active' } );
|
||||
|
||||
=head2 netbios
|
||||
|
||||
Returns the C<node_nbt> entry associated with this Node if one exists. That
|
||||
is, the NetBIOS information of this MAC address at the time of discovery.
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->might_have( netbios => 'App::Netdisco::DB::Result::NodeNbt',
|
||||
{ 'foreign.mac' => 'self.mac' } );
|
||||
|
||||
=head2 wireless
|
||||
|
||||
Returns the set of C<node_wireless> entries associated with this Node. That
|
||||
|
||||
@@ -48,6 +48,7 @@ hook 'before' => sub {
|
||||
var('connected_properties' => [
|
||||
{ name => 'n_age', label => 'Age Stamp', default => '' },
|
||||
{ name => 'n_ip', label => 'IP Address', default => 'on' },
|
||||
{ name => 'n_netbios', label => 'NetBIOS', default => 'on' },
|
||||
{ name => 'n_ssid', label => 'SSID', default => 'on' },
|
||||
{ name => 'n_vendor', label => 'Vendor', default => '' },
|
||||
{ name => 'n_archived', label => 'Archived Data', default => '' },
|
||||
|
||||
@@ -141,6 +141,10 @@ get '/ajax/content/device/ports' => require_login sub {
|
||||
$set = $set->search_rs({}, { prefetch => [{$nodes_name => 'wireless'}] })
|
||||
if param('c_nodes') && param('n_ssid');
|
||||
|
||||
# retrieve NetBIOS, if asked for
|
||||
$set = $set->search_rs({}, { prefetch => [{$nodes_name => 'netbios'}] })
|
||||
if param('c_nodes') && param('n_netbios');
|
||||
|
||||
# retrieve vendor, if asked for
|
||||
$set = $set->search_rs({}, { prefetch => [{$nodes_name => 'oui'}] })
|
||||
if param('c_nodes') && param('n_vendor');
|
||||
|
||||
@@ -62,6 +62,17 @@ ajax '/ajax/content/search/node' => require_login sub {
|
||||
}
|
||||
);
|
||||
|
||||
my $netbios = schema('netdisco')->resultset('NodeNbt')->search(
|
||||
{ mac => $mac->as_IEEE },
|
||||
{ order_by => { '-desc' => 'time_last' },
|
||||
'+columns' => [
|
||||
{
|
||||
time_first_stamp => \"to_char(time_first, 'YYYY-MM-DD HH24:MI')",
|
||||
time_last_stamp => \"to_char(time_last, 'YYYY-MM-DD HH24:MI')"
|
||||
}]
|
||||
}
|
||||
);
|
||||
|
||||
return unless $sightings->count
|
||||
or $ips->count
|
||||
or $ports->count;
|
||||
@@ -71,6 +82,7 @@ ajax '/ajax/content/search/node' => require_login sub {
|
||||
sightings => $sightings,
|
||||
ports => $ports,
|
||||
wireless => $wireless,
|
||||
netbios => $netbios,
|
||||
}, { layout => undef };
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -301,6 +301,12 @@
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% IF params.n_netbios %]
|
||||
[% FOREACH nbt IN node.netbios %]
|
||||
<br/> \\<a href="ip_search.html?domain=[% nbt.domain | uri %]&cmd=nbt" title="Devices in this Domain">[% nbt.domain | html %]</a>\<a href="[% search_node %]&q=[% nbt.nbname | uri %]">[% nbt.nbname | html_entity %]</a>
|
||||
<br/> [% nbt.nbuser || '[No User]' | html %]@<a href="[% search_node %]&q=[% nbt.ip | uri %]">[% nbt.ip | html_entity %]</a>
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
</td>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
[% USE date(format = '%Y-%m-%d %H:%M') %]
|
||||
<table class="table table-bordered table-hover nd_floatinghead">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -52,6 +53,41 @@
|
||||
<td>[% node.time_last_stamp | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% FOREACH nbt IN node.netbios %]
|
||||
<tr>
|
||||
<td> </td>
|
||||
[% IF params.show_vendor %]
|
||||
<td> </td>
|
||||
[% END %]
|
||||
<td>NetBIOS</td>
|
||||
<td class="nd_linkcell">\\<a href="[% uri_for('report/netbios') %]?domain=[% nbt.domain | uri %]" title="Devices in this Domain">[% nbt.domain | html %]</a>\<a href="[% search_node %]&q=[% nbt.nbname | uri %]">[% nbt.nbname | html_entity %]</a>
|
||||
<br>[% nbt.nbuser || '[No User]' | html %]@<a href="[% search_node %]&q=[% nbt.ip | uri %]">[% nbt.ip | html_entity %]</a>
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td>[% date.format(nbt.time_first) | html_entity %]</td>
|
||||
<td>[% date.format(nbt.time_last) | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
[% FOREACH wlan IN node.wireless %]
|
||||
<tr>
|
||||
<td> </td>
|
||||
[% IF params.show_vendor %]
|
||||
<td> </td>
|
||||
[% END %]
|
||||
<td>Wireless Info</td>
|
||||
<td class="nd_center-cell">SSID: [% wlan.ssid | html_entity %]<br>
|
||||
MaxRate: [% wlan.maxrate | html_entity %]Mbps TxRate: [% wlan.txrate | html_entity %]Mbps<br>
|
||||
SigStr: [% wlan.sigstrength | html_entity %] SigQual: [% wlan.sigqual | html_entity %]<br>
|
||||
Rx: [% wlan.rxpkt | format_number %] pkts, [% wlan.rxbyte | format_number %] bytes<br>
|
||||
Tx: [% wlan.txpkt | format_number %] pkts, [% wlan.txbyte | format_number %] bytes<br>
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td> </td>
|
||||
<td>[% date.format(wlan.time_last) | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% FOREACH nodeip IN row.ip_aliases(archive_filter) %]
|
||||
<tr>
|
||||
|
||||
@@ -118,6 +118,32 @@
|
||||
</tr>
|
||||
[% SET first_row = 0 %]
|
||||
[% END %]
|
||||
[% WHILE (nbt = netbios.next) %]
|
||||
<tr>
|
||||
<td>
|
||||
[% IF first_row %]
|
||||
<a class="nd_linkcell"
|
||||
href="[% search_node %]&q=[% nbt.mac | uri %]">[% nbt.mac | html_entity %]</a>
|
||||
[% ELSE %]
|
||||
|
||||
[% END %]
|
||||
</td>
|
||||
[% IF params.show_vendor %]
|
||||
<td>
|
||||
|
||||
</td>
|
||||
[% END %]
|
||||
<td>NetBIOS</td>
|
||||
<td class="nd_linkcell">\\<a href="[% uri_for('report/netbios') %]?domain=[% nbt.domain | uri %]" title="Devices in this Domain">[% nbt.domain | html %]</a>\<a href="[% search_node %]&q=[% nbt.nbname | uri %]">[% nbt.nbname | html_entity %]</a>
|
||||
<br>[% nbt.nbuser || '[No User]' | html %]@<a href="[% search_node %]&q=[% nbt.ip | uri %]">[% nbt.ip | html_entity %]</a>
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td>[% nbt.get_column('time_first_stamp') | html_entity %]</td>
|
||||
<td>[% nbt.get_column('time_last_stamp') | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% SET first_row = 0 %]
|
||||
[% END %]
|
||||
[% WHILE (wlan = wireless.next) %]
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user