📄 machinetrackertemplate.tmpl
字号:
#encoding UTF-8## $Id: MachineTrackerTemplate.tmpl 3825 2007-01-26 14:52:44Z jodal $#### Copyright 2003, 2004 Norwegian University of Science and Technology## Copyright 2006 UNINETT AS#### This file is part of Network Administration Visualized (NAV)#### NAV 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.#### NAV 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 NAV; if not, write to the Free Software## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA###### Author: Magnar Sveen <magnars@idi.ntnu.no>## Sigurd Gartmann <sigurd-nav@brogar.org>###extends MainTemplate#from nav.web import escape#attr $path = [("Home", "/"), ("Machine Tracker", "/machinetracker/")]#block content<div id="machinetracker" style="font-size: 13px;"><h1>Machine Tracker</h1><p><a href="ip">IP Search</a>| <a href="mac">MAC Search</a>| <a href="swp">Switch Search</a></p>#if len($errors) > 0<div class="errors"> <ul>#for $error in $errors <li>$escape($error)</li>#end for </ul></div>#end if<div id="forms">#if $form.dns=="on"#set $checked="checked"#else#set $checked=""#end if #if $form.aip=="on"#set $activechecked="checked"#else#set $activechecked=""#end if #if $form.naip=="on"#set $inactivechecked="checked"#else#set $inactivechecked=""#end if #if $form.search=="mac"<form id="macform" action="" method="get"> <label>MAC </label><input type="text" name="mac" value="$escape($form.mac)">## <input type=checkbox name=aip $activechecked><label>active</label>## <input type=checkbox name=naip $inactivechecked><label>inactive</label> <input type="checkbox" name="dns" $checked><label>dns</label>#if $form.days <input type="text" size="3" style="text-align: center;" name="days" value="$form.days"><label> days</label>#else <input type="text" size="3" style="text-align: center;" name="days" value="7"><label> days</label>#end if <input type="submit" name="send" value="Search"></form>#elif $form.search=="swp"<form id="swpform" action="" method="get"> <label>Switch </label><input type="text" name="switch" value="$escape($form.switch)"> <label>Module </label><input type="text" name="module" size="3" value="$form.module"> <label>Port </label><input type="text" name="port" size="3" value="$form.port">## <input type=checkbox name=aip $activechecked><label>active</label>## <input type=checkbox name=naip $inactivechecked><label>inactive</label> <input type="checkbox" name="dns" $checked><label>dns</label>#if $form.days <input type="text" size="3" style="text-align: center;" name="days" value="$form.days"><label> days</label>#else <input type="text" size="3" style="text-align: center;" name="days" value="7"><label> days</label>#end if <input type="submit" name="send" value="Search"></form>#else<form id="ipform" action="" method="get"> <label>IP from </label><input type="text" name="from_ip" value="$escape($form.ip_from)"> <label>to </label><input type="text" name="to_ip" value="$escape($form.ip_to)"> <input type="checkbox" name="aip" $activechecked><label>active</label> <input type="checkbox" name="naip" $inactivechecked><label>inactive</label> <input type="checkbox" name="dns" $checked><label>dns</label>#if $form.days <input type="text" size="3" style="text-align: center;" name="days" value="$form.days"><label> days</label>#else <input type="text" size="3" style="text-align: center;" name="days" value="7"><label> days</label>#end if <input type="submit" name="send" value="Search"></form>#end if</div> <!-- forms --><br />#def tableTitle($title, $hits, $columnCount) #set $columnCount += 1<table class="horiztable"> <caption> <span class="cornerkludge"></span> $title<br /> <span class="subtitle">$hits hits</span> </caption>#end def#def tableHeader($rowCount, $columns) #set $rowCount = $rowCount + 1 <tr class="header"> <td class="leftkludge" rowspan="$rowCount"></td> #for $column in $columns <th>$column</th> #end for <td class="rightkludge" rowspan="$rowCount"></td> </tr>#end def#def arpTable($table) #if $form.dns == "on": #set $columns = ('DNS', 'IP', '', 'MAC', 'Start time', 'End time') #else #set $columns = ('IP', '', 'MAC', 'Start time', 'End time') #end if #set $columnCount = len($columns) $tableTitle("IP Search results", len($table), $columnCount) $tableHeader(len($table), $columns) #for $row in $table <tr class="$rowcycler"> #if $form.dns=="on": <td>$row.dnsname</td> #end if <td><a href="ip?from_ip=$row.ipaddr&days=$form.days&dns=$form.dns" title="Search again for this IP address">$row.ipaddr</a></td> <td>#slurp #if $row.ipaddr <a href="/ipinfo/?ip=${row.ipaddr}" title="Show information about this particular IP address"><img src="$imagefolder/arpcam/ipinfolink.png" width="11" height="11" alt="IP Info"></a> #end if </td> #if type($row.mac) is str #set $macformatted = '%s:%s:%s:%s:%s:%s' % ($row.mac[0:2], $row.mac[2:4], $row.mac[4:6], $row.mac[6:8], $row.mac[8:10], $row.mac[10:12]) #else #set $macformatted = $row.mac #end if <td><a href="mac?mac=$row.mac&days=$form.days&dns=$form.dns" title="Search for this MAC address">$macformatted</a></td> <td>$row.start_time</td> <td>$row.end_time</td> </tr> #end for</table>#end def#def camTable($table) #set $columns = ('MAC', 'Switch', 'Module', 'Port', 'Start time', 'End time') #set $columnCount = len($columns) $tableTitle("MAC Search results", len($table), $columnCount) $tableHeader(len($table), $columns) #for $row in $table <tr class="$rowcycler"> #if type($row.mac) is str #set $macformatted = '%s:%s:%s:%s:%s:%s' % ($row.mac[0:2], $row.mac[2:4], $row.mac[4:6], $row.mac[6:8], $row.mac[8:10], $row.mac[10:12]) #else #set $macformatted = $row.mac #end if <td><a href="mac?mac=$row.mac&days=$form.days&dns=$form.dns" title="Search again for this MAC address">$macformatted</a></td> <td><a href="/browse/$row.switch" title="Browse this switch (IP device)">$row.switch</a></td> <td style="text-align: center;">$row.module</td> <td style="text-align: center;"><a href="swp?switch=$row.switch&module=$row.module&port=$row.port&days=$form.days&dns=$form.dns" title="Search for other machines on this port">$row.port</a></td> <td>$row.start_time</td> <td>$row.end_time</td> </tr> #end for</table>#end def<div id="results">#if $tableCam $camTable($tableCam.table)#end if#if $tableArp $arpTable($tableArp.table)#end if#if $tableSwp $camTable($tableSwp.table)#end if#if not $tableCam and not $tableArp and not $tableSwp #set $noresults = 0 #if $form.search == "mac" #if $form.mac #set $noresults = 1 #end if #elif $form.search == "swp" #if $form.switch #set $noresults = 1 #end if #else #if $form.ip_from #set $noresults = 1 #end if #end if #if $noresults<p>Your search did not return any results</p> #else<div class="infobox"><h2>Machine Tracker Search Hints</h2><ul> <li>MAC search allows wildcard searching, e.g. you can search for "<tt>00aabbcc*</tt>"</li> <li>Switch search will search for switches having a sysname that starts with whatever you enter as switch name. E.g. searching for "<tt>blapp-sw</tt>" will retrieve both "<tt>blapp-sw.ntnu.no</tt>" and "<tt>blapp-sw2.ntnu.no</tt>"</li> <li>Leaving the <i>module</i> or <i>port</i> fields empty in the switch search will find any module or port that have matching records for your selected switch.</li></ul><h2>Accuracy of the Machine Tracker Results</h2><ul> <li>IP search results are based on ARP data from routers. Typically ARP data entries are kept by the routers 4 hours after the last packet seen. Also keep in mind, the ARP collector only runs twice an hour (0,30). Subtracting 4-4.5 hours from the end time gives you a fairly good idea.</li> <li>MAC search results are based on switch bridge tables. Default timeout for bridge table entries may vary, in many cases it is 5 minutes. The bridge table collector runs every 15 minutes (11,26,41,59) which also introduces some inaccuracy. In other words, the results may be 5-20 minutes off.</li></ul></div> #end if#end if</div> <!-- results --></div> <!-- machinetracker -->#end block content#block additionalCSS$default_table_CSS<link rel="stylesheet" type="text/css" href="/style/machinetracker.css" />#end block additionalCSS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -