Parsing simple html in Python
Posted by jpluimers on 2018/11/29
Was working to get fritzcap to emit a list of interfaces so I could specify which one to capture.
For that I needed to parse the output of http://fritz.box/capture.lua which consists of HTML fragments like below.
What I needed was for each consecutive entries of [WayBack] th and first [WayBack] button tags:
- content of the
th
tag - content of the
value
attribute of thebutton
tag having atype="submit"
attribute andname=start
attribute
So before starting to work on it, I created [WayBack] In order to fix #5, print a list of available interfaces to potentially capture from · Issue #6 · jpluimers/fritzcap
The goal was to get a series of key/value pairs:
4-138 = AP2 (2.4 + 5 GHz, ath1) - Interface 1
4-137 = AP2 (2.4 + 5 GHz, ath1) - Interface 0
4-132 = AP (2.4 GHz, ath0) - Interface 1
4-131 = AP (2.4 GHz, ath0) - Interface 0
4-129 = HW (2.4 GHz, wifi0) - Interface 0
4-128 = WLAN Management Traffic - Interface 0a
So I built a class descending from [WayBack] HTMLParser — Simple HTML and XHTML parser that ships with the [WayBack] Python standard libraries.
If in the future I need more complex HTML parsing, then these links will help me choosing more feature rich parsers:
- [WayBack] Python HTML Parser Performance
- [WayBack] HTML Scraping — The Hitchhiker’s Guide to Python
- [WayBack] Parsing HTML using Python – Stack Overflow
Back to the HTMLParser descendant in interfaces_dumper.py which can basically be condensed down to the code below.
handle_data
is called for both start tags and end tags. Theth
value indata
is only present in the start tag (at the time of end tag thedata
is empty), so you need to keep track of bothlast_start_tag
andlast_end_tag
.handle_endtag
maintainslast_end_tag
to helphandle_data
.handle_starttag
maintainslast_start_tag
to helphandle_data
and also handles thebutton
behaviour.- The
button
is only relevant if it hastype="submit"
andname="start"
and avalue
attribute in that order. - Output is in
data
which is an array ofkey
/value
pairs.
- The
class CaptureLuaHtmlParser(HTMLParser): def __init__(self): HTMLParser.__init__(self) self.last_end_tag = "" self.last_start_tag = "" self.last_th_data = "" self.data = [] # output list of (key,value) pairs self.recording = 0 def handle_starttag(self, tag, attrs): self.last_start_tag = tag if tag != 'button': return button_attribute_type_submit = False button_attribute_name_start = False for name, value in attrs: if (name == 'type') and (value == 'submit'): button_attribute_type_submit = True if button_attribute_type_submit and (name == 'name') and (value == 'start'): button_attribute_name_start = True if button_attribute_type_submit and button_attribute_name_start and (name == 'value'): self.data.append((value, self.last_th_data)) # (button value value, th content) def handle_endtag(self, tag): self.last_end_tag = tag def handle_data(self, data): if (self.last_start_tag == 'th') and (self.last_end_tag != 'th'): self.last_th_data = data
With all that, it’s pretty simple to get the data out and display the key value pairs using a loop:
parser = CaptureLuaHtmlParser() parser.feed(html_content) self.logger.info("Fritz!Box interfaces from %s: key = value" % url) keyValuePairs = sorted(parser.data) for (key, value) in keyValuePairs: self.logger.info(" %-*s= %s" % (20,key, value))
First it sorts the output, which does not use a key as sorted gets that by itself: [WayBack] 2. Built-in Functions — sorted
This uses the built in precent string formatting operator explained here:
- [WayBack] 5. Built-in Types — String Formatting Operations
- [WayBack] Python spacing and aligning strings – Stack Overflow
<h3>WLAN</h3><table class="zebra"> | |
<tr> | |
<th>AP (2.4 GHz, ath0) – Interface 1</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_132" value="4-132">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_132"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_132" value="4;132;AP (2.4 GHz, ath0)">Stop</button></td> | |
</tr> | |
<tr> | |
<th>AP (2.4 GHz, ath0) – Interface 0</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_131" value="4-131">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_131"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_131" value="4;131;AP (2.4 GHz, ath0)">Stop</button></td> | |
</tr> | |
<tr> | |
<th>HW (2.4 GHz, wifi0) – Interface 0</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_129" value="4-129">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_129"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_129" value="4;129;HW (2.4 GHz, wifi0)">Stop</button></td> | |
</tr> | |
<tr> | |
<th>WLAN Management Traffic – Interface 0</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_128" value="4-128">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_128"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_128" value="4;128;WLAN Management Traffic">Stop</button></td> | |
</tr> | |
</table> |
–jeroen
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv=content-type content="text/html; charset=utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Packet Trace</title> | |
<link rel="stylesheet" type="text/css" href="/css/default/main.css"/> | |
<link rel="stylesheet" type="text/css" href="/css/default/sso_dropdown.css"/> | |
<link rel="stylesheet" type="text/css" href="/css/default/print.css" media="print"/> | |
<!–[if lte IE 8]> | |
<link rel="stylesheet" type="text/css" href="/css/default/ie_fix.css"/> | |
<![endif]–> | |
<!–[if IE]> | |
<style type="text/css"> | |
.hide_ftp_link {display: none;} | |
</style> | |
<![endif]–> | |
<script type="text/javascript" src="/js/jxl.js"></script> | |
<script type="text/javascript" src="/js/ready.js"></script> | |
<script type="text/javascript" src="/js/help.js"></script> | |
<script type="text/javascript" src="/js/popup.js?lang=en"></script> | |
<script type="text/javascript" src="/js/zebra.js"></script> | |
<script type="text/javascript" src="/js/ajax.js"></script> | |
<script type="text/javascript" src="/js/sso_dropdown.js"></script> | |
<!–[if lt IE 8]> | |
<script type="text/javascript" src="/js/imgbuttonfixer.js"></script> | |
<![endif]–> | |
<script type="text/javascript"> | |
if (window.location.search.indexOf("&popupwnd=1")!=-1) { | |
ready.onReady(popup.prepareHeader); | |
} | |
ready.onReady(help.show); | |
ready.onReady(zebra); | |
</script> | |
<link rel="stylesheet" type="text/css" href="/css/default/capture.css"/> | |
<script type="text/javascript" src="/js/ajax.js"></script> | |
<!–[if lt IE 8]> | |
<script type="text/javascript"> | |
var start_val = { | |
"_eth0": "1-eth0", | |
"_132": "4-132", | |
"_eth1": "1-eth1", | |
"_wifi0": "1-wifi0", | |
"_1": "2-1", | |
"_128": "4-128", | |
"_ptm_vr9": "1-ptm_vr9", | |
"_ath0": "1-ath0", | |
"_131": "4-131", | |
"_eth2": "1-eth2", | |
"_eth3": "1-eth3", | |
"_guest": "1-guest", | |
"_161": "5-161", | |
"_guest_ct1": "1-guest_ct1", | |
"_162": "5-162", | |
"_129": "4-129", | |
"_tunl0": "1-tunl0", | |
"_lan": "1-lan" | |
}; | |
var stop_val = { | |
"_eth0": "1;-1;eth0", | |
"_132": "4;132;AP (2.4 GHz, ath0)", | |
"_eth1": "1;-1;eth1", | |
"_wifi0": "1;-1;wifi0", | |
"_1": "2;1;internet,voip", | |
"_128": "4;128;WLAN Management Traffic", | |
"_ptm_vr9": "1;-1;ptm_vr9", | |
"_ath0": "1;-1;ath0", | |
"_131": "4;131;AP (2.4 GHz, ath0)", | |
"_eth2": "1;-1;eth2", | |
"_eth3": "1;-1;eth3", | |
"_guest": "1;-1;guest", | |
"_161": "5;161;usb1", | |
"_guest_ct1": "1;-1;guest_ct1", | |
"_162": "5;162;usb2", | |
"_129": "4;129;HW (2.4 GHz, wifi0)", | |
"_tunl0": "1;-1;tunl0", | |
"_lan": "1;-1;lan" | |
}; | |
function fixButtons() { | |
var btns = document.getElementsByTagName("button"); | |
for (var i=0; i<btns.length; i++) { | |
if (btns[i].name) { | |
if (btns[i].name.indexOf("start") == 0) { | |
btns[i].innerHTML = '<span style="display:none;">'+start_val['_'+btns[i].id.substr(8)]+'</span> ' + btns[i].innerHTML; | |
} else if (btns[i].name.indexOf("stop") == 0) { | |
btns[i].innerHTML = '<span style="display:none;">'+stop_val['_'+btns[i].id.substr(7)]+'</span> ' + btns[i].innerHTML; | |
} | |
} | |
} | |
} | |
function getBtnValue(btn) { | |
var span = jxl.walkDom(btn, 'span'); | |
if (span && span.length) { | |
return span[0].innerText; | |
} | |
else { | |
return btn.value; | |
} | |
} | |
ready.onReady(fixButtons); | |
</script> | |
<![endif]–> | |
<script type="text/javascript"> | |
// — im IE < 8 haben wir die Funktion oben definiert, für alle anderen hier | |
if (typeof getBtnValue != 'function') { | |
getBtnValue = function(b){return b.value;}; | |
} | |
var gQueryVars = { | |
sessions: { query: "capture:settings/session/list(displayname,ifacename,minor,type)" }, | |
dtrace: { query: "capture:settings/dtrace_running" }, | |
dfileold: { query: "capture:settings/dtrace_old" }, | |
dfilenew: { query: "capture:settings/dtrace_new" }, | |
lte: { query: "lted:settings/trace/status" } | |
}; | |
var g_active = {}; | |
var g_dactive = false; | |
var g_lactive = false; | |
var g_seq = 0; | |
var g_ajaxSubmit = false; | |
function init() { | |
disableStopButtons(); | |
jxl.addEventHandler("uiStopAll", "click", uiDoOnStopAllClicked); | |
jxl.addEventHandler("uiStart_dtrace", "click", uiDoOnStartDTraceClicked); | |
jxl.addEventHandler("uiStop_dtrace", "click", uiDoOnStopDTraceClicked); | |
addStartButtonHandlers(); | |
var form = jxl.get("uiMainForm"); | |
if (form) form.onsubmit = uiDoOnMainFormSubmit; | |
ajaxWait(gQueryVars, "ca0ebbb296fb2016", 5000, cbState); | |
} | |
function uiDoOnMainFormSubmit() { | |
if (g_ajaxSubmit) { | |
g_ajaxSubmit = false; | |
return false; | |
} | |
return true; | |
} | |
function disableStopButtons() { | |
var b = document.getElementsByTagName("button"); | |
for (var i=0; i < b.length; i++) { | |
if (b[i].name.indexOf("stop")!=-1) { | |
jxl.disable(b[i]); | |
} | |
if (b[i].name.indexOf("stop") == 0) { | |
jxl.addEventHandler(b[i], "click", uiDoOnStopClicked); | |
} | |
} | |
} | |
function uiDoOnStopClicked(evt) { | |
var btn = jxl.evtTarget(evt); | |
if (btn) { | |
var p = getBtnValue(btn).split(";"); | |
ajaxGet("/cgi-bin/capture_notimeout?iface="+p[2]+"&minor="+p[1]+"&type="+p[0]+"&capture=Stop&sid=ca0ebbb296fb2016", cbStop); | |
g_ajaxSubmit = true; | |
} | |
} | |
function uiDoOnStopAllClicked() { | |
ajaxGet("/cgi-bin/capture_notimeout?iface=stopall&capture=Stop&sid=ca0ebbb296fb2016", cbStopAll); | |
g_ajaxSubmit = true; | |
} | |
function uiDoOnStartDTraceClicked() { | |
var pstr = jxl.getValue("uiDtraceParams"); | |
if (pstr.length == 0) { | |
ajaxGet("/cgi-bin/capture_notimeout?dtracetype=1&dtrace=Start&sid=ca0ebbb296fb2016", cbStartDTrace); | |
} else { | |
ajaxGet("/cgi-bin/capture_notimeout?dtracetype=3&dtraceparam="+encodeURIComponent(pstr)+"&dtrace=Start&sid=ca0ebbb296fb2016", cbStartDTrace); | |
} | |
g_ajaxSubmit = true; | |
} | |
function uiDoOnStopDTraceClicked() { | |
ajaxGet("/cgi-bin/capture_notimeout?dtrace=Stop&sid=ca0ebbb296fb2016", cbStopDTrace); | |
g_ajaxSubmit = true; | |
} | |
function uiDoOnStopLTEClicked() { | |
ajaxGet( | |
"/cgi-bin/rpcstreamcap_notimeout?name=lted&action=stop&wv=lted:settings/trace/status&sid=ca0ebbb296fb2016", | |
cbStopLte | |
); | |
g_ajaxSubmit = true; | |
} | |
function uiOnReconnectLte(evt) { | |
jxl.disable("uiReconnect_lte"); | |
ajaxGet( | |
"/capture.lua?sid=ca0ebbb296fb2016&lreconnect=", | |
function(xhr) { | |
jxl.enable("uiReconnect_lte"); | |
} | |
); | |
return jxl.cancelEvent(evt); | |
} | |
function cbStop() { | |
} | |
function cbStopAll() { | |
} | |
function cbStartDTrace() { | |
jxl.disable("uiStart_dtrace"); | |
jxl.enable("uiStop_dtrace"); | |
jxl.setHtml("uiImage_dtrace", '<img src="/css/default/images/wait.gif" alt="DTrace running">'); | |
g_dactive = true; | |
} | |
function cbStopDTrace() { | |
jxl.enable("uiStart_dtrace"); | |
jxl.disable("uiStop_dtrace"); | |
if (g_dactive) { | |
jxl.setHtml("uiImage_dtrace", '<img src="/css/default/images/finished_ok_green.gif" alt="DTrace stopped">'); | |
} | |
} | |
function cbStopLte() { | |
jxl.enable("uiStart_lte"); | |
jxl.disable("uiStop_lte"); | |
if (g_lactive) { | |
jxl.setHtml("uiImage_lte", '<img src="/css/default/images/finished_ok_green.gif" alt="LTE logger stopped">'); | |
} | |
} | |
function cbState() { | |
g_seq++; | |
for (var i=0; i < gQueryVars.sessions.value.length; i++) { | |
var suffix = gQueryVars.sessions.value[i].minor; | |
if (suffix=="-1") suffix = gQueryVars.sessions.value[i].ifacename; | |
jxl.disable("uiStart_"+suffix); | |
jxl.enable("uiStop_"+suffix); | |
jxl.setHtml("uiImage_"+suffix, '<img src="/css/default/images/wait.gif" alt="Recording">'); | |
g_active[suffix] = g_seq; | |
} | |
for (var suffix in g_active) { | |
if (g_active[suffix] != g_seq) { | |
jxl.enable("uiStart_"+suffix); | |
jxl.disable("uiStop_"+suffix); | |
jxl.setHtml("uiImage_"+suffix, '<img src="/css/default/images/finished_ok_green.gif" alt="Recording stopped">'); | |
g_active[suffix] = null; | |
} | |
} | |
if (gQueryVars.sessions.value.length > 0) { | |
jxl.enable("uiStopAll"); | |
} else { | |
jxl.disable("uiStopAll"); | |
} | |
if (gQueryVars.dtrace.value == "1") { | |
jxl.disable("uiStart_dtrace"); | |
jxl.enable("uiStop_dtrace"); | |
jxl.setHtml("uiImage_dtrace", '<img src="/css/default/images/wait.gif" alt="DTrace running">'); | |
g_dactive = true; | |
} else { | |
jxl.enable("uiStart_dtrace"); | |
jxl.disable("uiStop_dtrace"); | |
if (g_dactive) { | |
jxl.setHtml("uiImage_dtrace", '<img src="/css/default/images/finished_ok_green.gif" alt="DTrace stopped">'); | |
} | |
} | |
if (gQueryVars.dfilenew.value != "") { | |
jxl.setHtml("uiFile_new", gQueryVars.dfilenew.value); | |
jxl.enable("uiFile_new"); | |
} | |
if (gQueryVars.dfileold.value != "") { | |
jxl.setHtml("uiFile_old", gQueryVars.dfileold.value); | |
jxl.enable("uiFile_old"); | |
} | |
/* poll forever*/ | |
return false; | |
} | |
function addStartButtonHandlers() { | |
var src = "/cgi-bin/capture_notimeout?sid=ca0ebbb296fb2016&capture=Start"; | |
var ltesrc = "/cgi-bin/rpcstreamcap_notimeout?name=lted&action=start&wv=lted:settings/trace/status"; | |
var iFrame = {}; | |
function onStart(evt) { | |
var btn = jxl.evtTarget(evt); | |
if (btn && btn.id) { | |
//– LTE: wenn geändert, musss setlog gesetzt werden, deshalb Seite neu laden | |
if (btn.name.indexOf("lstart") == 0) { | |
if (g_lteSetlog != jxl.getValue("uiLteSetlog")) { | |
g_ajaxSubmit = false; | |
return true; | |
} | |
} | |
if (!iFrame[btn.id]) { | |
iFrame[btn.id] = document.createElement('iframe'); | |
iFrame[btn.id].style.display = "none"; | |
document.body.appendChild(iFrame[btn.id]); | |
} | |
if (btn.name.indexOf("lstart") == 0) { | |
iFrame[btn.id].src = ltesrc; | |
} | |
else { | |
iFrame[btn.id].src = src + '&snaplen='+ jxl.getValue("uiLen") + '&ifaceorminor=' + getBtnValue(btn); | |
} | |
return jxl.cancelEvent(evt); | |
} | |
} | |
(function() { | |
var b = document.getElementsByTagName('button'); | |
var len = b && b.length || 0; | |
for (var i = 0; i < len; i++) { | |
if (b[i].name) { | |
if (b[i].name.indexOf("start") == 0) { | |
jxl.addEventHandler(b[i], 'click', onStart); | |
} | |
if (b[i].name.indexOf("lstart") == 0) { | |
jxl.addEventHandler(b[i], 'click', onStart); | |
} | |
} | |
} | |
})(); | |
} | |
ready.onReady(init); | |
</script> | |
</head> | |
<body> | |
<!– pagename:/capture.lua–> | |
<div id="main_page_all"> | |
<div id="intro_bar_box"> | |
<div id="intro_bar"> | |
<div id="intro_bar_left" class="oemlogo_avme"> | |
<img src="/css/default/images/leer.gif" usemap="#logo"> | |
<map name="logo"> | |
<area shape="rect" coords="0,0,250,77" href="/" target="_top"> | |
</map> | |
</div> | |
<div id="intro_boxinfo"> | |
<p></p> | |
</div> | |
<div id="intro_bar_middle"></div> | |
</div> | |
</div> | |
<div class="clear_float"></div> | |
<div id="menu_content_box"> | |
<div id="page_content_no_menu_box"> | |
<div id="contentTitle" class="blue_bar_back"> | |
<h2 id="uiPageTitle">Packet Trace</h2> | |
</div> | |
<div id="page_content" class="page_content"> | |
<div id="uiValidationWait" style="display:none;"> | |
<div class="wait"> | |
<p> | |
Checking your entries; please wait. | |
</p> | |
<p class="waitimg"> | |
<img src="/css/default/images/wait.gif"> | |
</p> | |
</div> | |
<div class="btn_form_foot"> | |
</div> | |
</div> | |
<div id="uiValidationDone" style="display:none;"> | |
<div class="wait"> | |
<p> | |
Entry check successful. | |
</p> | |
<p class="waitimg"> | |
<img src="/css/default/images/finished_ok_green.gif"> | |
</p> | |
</div> | |
<div class="btn_form_foot"> | |
<button type="button" id="uiValidationDoneOk"> | |
OK | |
</button> | |
</div> | |
</div> | |
<p>For the purpose of diagnostics, FRITZ!Box can record all data packets in <a href="http://www.wireshark.org/" target="_blank">Wireshark</a> format when the FRITZ!Box is configured as a router. Multiple traces can be started at the same time. They assist AVM Support in a precise analysis of complex problems with the Internet connection. Keep in mind that traces may contain your confidential passwords.</p> | |
<hr> | |
<p>Start the packet trace by clicking the corresponding "Start" button and save the file to the hard disk. End the trace by clicking "Stop" or the "Stop All Traces" button.</p> | |
<p><b>Important</b>: If you want to end the trace, do not interrupt the saving of the file on the hard drive in the browser. Click the corresponding "Stop" button instead!</p> | |
<p>Click the "Refresh" button if the buttons to stop the trace are not displayed.</p> | |
<hr> | |
<form action="/capture.lua" method="POST" id="uiMainForm"> | |
<h3>Internet</h3><table class="zebra"> | |
<tr> | |
<th>1. Internet connection</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_1" value="2-1">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_1"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_1" value="2;1;internet,voip">Stop</button></td> | |
</tr> | |
</table><h3>Network Interfaces</h3> | |
<div class="formular"> | |
<label for="uiLen">Limitation of length per packet</label> | |
<input type="text" id="uiLen" name="len" size="7" value="1600"> Bytes | |
</div> | |
<table class="zebra"> | |
<tr> | |
<th>tunl0</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_tunl0" value="1-tunl0">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_tunl0"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_tunl0" value="1;-1;tunl0">Stop</button></td> | |
</tr> | |
<tr> | |
<th>eth0</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_eth0" value="1-eth0">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_eth0"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_eth0" value="1;-1;eth0">Stop</button></td> | |
</tr> | |
<tr> | |
<th>eth1</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_eth1" value="1-eth1">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_eth1"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_eth1" value="1;-1;eth1">Stop</button></td> | |
</tr> | |
<tr> | |
<th>eth2</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_eth2" value="1-eth2">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_eth2"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_eth2" value="1;-1;eth2">Stop</button></td> | |
</tr> | |
<tr> | |
<th>eth3</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_eth3" value="1-eth3">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_eth3"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_eth3" value="1;-1;eth3">Stop</button></td> | |
</tr> | |
<tr> | |
<th>lan</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_lan" value="1-lan">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_lan"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_lan" value="1;-1;lan">Stop</button></td> | |
</tr> | |
<tr> | |
<th>guest</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_guest" value="1-guest">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_guest"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_guest" value="1;-1;guest">Stop</button></td> | |
</tr> | |
<tr> | |
<th>ptm_vr9</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_ptm_vr9" value="1-ptm_vr9">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_ptm_vr9"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_ptm_vr9" value="1;-1;ptm_vr9">Stop</button></td> | |
</tr> | |
<tr> | |
<th>wifi0</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_wifi0" value="1-wifi0">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_wifi0"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_wifi0" value="1;-1;wifi0">Stop</button></td> | |
</tr> | |
<tr> | |
<th>ath0</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_ath0" value="1-ath0">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_ath0"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_ath0" value="1;-1;ath0">Stop</button></td> | |
</tr> | |
<tr> | |
<th>guest_ct1</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_guest_ct1" value="1-guest_ct1">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_guest_ct1"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_guest_ct1" value="1;-1;guest_ct1">Stop</button></td> | |
</tr> | |
</table><h3>WLAN</h3><table class="zebra"> | |
<tr> | |
<th>AP (2.4 GHz, ath0) – Interface 1</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_132" value="4-132">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_132"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_132" value="4;132;AP (2.4 GHz, ath0)">Stop</button></td> | |
</tr> | |
<tr> | |
<th>AP (2.4 GHz, ath0) – Interface 0</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_131" value="4-131">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_131"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_131" value="4;131;AP (2.4 GHz, ath0)">Stop</button></td> | |
</tr> | |
<tr> | |
<th>HW (2.4 GHz, wifi0) – Interface 0</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_129" value="4-129">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_129"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_129" value="4;129;HW (2.4 GHz, wifi0)">Stop</button></td> | |
</tr> | |
<tr> | |
<th>WLAN Management Traffic – Interface 0</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_128" value="4-128">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_128"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_128" value="4;128;WLAN Management Traffic">Stop</button></td> | |
</tr> | |
</table><h3>USB</h3><table class="zebra"> | |
<tr> | |
<th>usb2</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_162" value="5-162">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_162"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_162" value="5;162;usb2">Stop</button></td> | |
</tr> | |
<tr> | |
<th>usb1</th> | |
<td class="buttonrow"> | |
<button type="submit" name="start" id="uiStart_161" value="5-161">Start</button> | |
</td> | |
<td class="imgcol" id="uiImage_161"></td> | |
<td class="buttonrow"><button type="submit" name="stop" id="uiStop_161" value="5;161;usb1">Stop</button></td> | |
</tr> | |
</table> | |
<h3>DTrace</h3> | |
<table class="zebra"> | |
<tr> | |
<td class="paramcell"> | |
<label for="uiDtraceParams">Additional parameters</label> | |
<input type="text" id="uiDtraceParams" name="dparams"> | |
</td> | |
<td class="buttonrow"><button type="submit" name="dstart" id="uiStart_dtrace">Start</button></td> | |
<td class="imgcol" id="uiImage_dtrace"></td> | |
<td class="buttonrow"><button type="submit" name="dstop" id="uiStop_dtrace">Stop</button></td> | |
</tr> | |
<tr> | |
<th>New result</th> | |
<td></td> | |
<td></td> | |
<td class="buttonrow"><button type="submit" name="dfile_new" id="uiFile_new" disabled>Empty</button></td> | |
</tr> | |
<tr> | |
<th>Old result</th> | |
<td></td> | |
<td></td> | |
<td class="buttonrow"><button type="submit" name="dfile_old" id="uiFile_old" disabled>Empty</button></td> | |
</tr> | |
</table> | |
<div class="formular"> | |
<p>If you do not select any parameters, dtrace will be started with the following parameters:</p> | |
<blockquote><code>-D -s -m -i256 -dect -dlc -c1 -c2 -c3 -c4 -c5 -nt3 -d2 -d3</code></blockquote> | |
<p>If you select additional parameters, the following parameters are always set:</p> | |
<blockquote><code>-D -s -m -i256</code></blockquote> | |
</div> | |
<div id="btn_form_foot"> | |
<input type="hidden" name="sid" value="ca0ebbb296fb2016"> | |
<button type="submit" name="stopall" id="uiStopAll">Stop All</button> | |
<button type="submit" name="refresh">Refresh</button> | |
</div> | |
</form> | |
<!– de-first -begin –> | |
<p id="page_needs_js_txt" style="display:none;"> | |
The functions on this page require JavaScript. Enable JavaScript in your browser and reload the page. | |
</p> | |
<span id="uiLuatime"></span> | |
</div> | |
<div class="clear_float"></div> | |
</div> | |
</div> | |
</div> | |
<div id="logqueries" style="clear:both; display:none;"> | |
<pre> | |
script = /capture.lua | |
GET = { | |
} | |
POST = { | |
} | |
QUERIES = { | |
["box:settings/hostname"] = "", | |
["box:settings/opmode"] = "opmode_eth_ipclient", | |
["box:status/localtime"] = "12:48:31 24.06.2017", | |
["boxusers:settings/compatibility_mode"] = "0", | |
["boxusers:settings/last_homenetwork_username"] = "jeroenp", | |
["boxusers:settings/skip_auth_from_homenetwork"] = "0", | |
["capture:settings/dtrace_new"] = "", | |
["capture:settings/dtrace_old"] = "", | |
["capture:settings/dtrace_running"] = "0", | |
["lted:settings/trace/status"] = "nil", | |
["rights:status/BoxAdmin"] = "2", | |
["rights:status/boxuser_UID"] = "boxuser10", | |
["rights:status/userid"] = "10", | |
["rights:status/username"] = "jeroenp" | |
} | |
MQUERIES = { | |
["capture:settings/iface/list(name,minor,type,if_nr)"] = { | |
[1] = { | |
["_node"] = "iface0", | |
["if_nr"] = "1", | |
["minor"] = "1", | |
["name"] = "internet,voip", | |
["type"] = "2" | |
}, | |
[2] = { | |
["_node"] = "iface1", | |
["if_nr"] = "-1", | |
["minor"] = "-1", | |
["name"] = "tunl0", | |
["type"] = "1" | |
}, | |
[3] = { | |
["_node"] = "iface2", | |
["if_nr"] = "-1", | |
["minor"] = "-1", | |
["name"] = "eth0", | |
["type"] = "1" | |
}, | |
[4] = { | |
["_node"] = "iface3", | |
["if_nr"] = "-1", | |
["minor"] = "-1", | |
["name"] = "eth1", | |
["type"] = "1" | |
}, | |
[5] = { | |
["_node"] = "iface4", | |
["if_nr"] = "-1", | |
["minor"] = "-1", | |
["name"] = "eth2", | |
["type"] = "1" | |
}, | |
[6] = { | |
["_node"] = "iface5", | |
["if_nr"] = "-1", | |
["minor"] = "-1", | |
["name"] = "eth3", | |
["type"] = "1" | |
}, | |
[7] = { | |
["_node"] = "iface6", | |
["if_nr"] = "-1", | |
["minor"] = "-1", | |
["name"] = "lan", | |
["type"] = "1" | |
}, | |
[8] = { | |
["_node"] = "iface7", | |
["if_nr"] = "-1", | |
["minor"] = "-1", | |
["name"] = "guest", | |
["type"] = "1" | |
}, | |
[9] = { | |
["_node"] = "iface8", | |
["if_nr"] = "-1", | |
["minor"] = "-1", | |
["name"] = "ptm_vr9", | |
["type"] = "1" | |
}, | |
[10] = { | |
["_node"] = "iface9", | |
["if_nr"] = "-1", | |
["minor"] = "-1", | |
["name"] = "wifi0", | |
["type"] = "1" | |
}, | |
[11] = { | |
["_node"] = "iface10", | |
["if_nr"] = "-1", | |
["minor"] = "-1", | |
["name"] = "ath0", | |
["type"] = "1" | |
}, | |
[12] = { | |
["_node"] = "iface11", | |
["if_nr"] = "-1", | |
["minor"] = "-1", | |
["name"] = "guest_ct1", | |
["type"] = "1" | |
}, | |
[13] = { | |
["_node"] = "iface12", | |
["if_nr"] = "0", | |
["minor"] = "162", | |
["name"] = "usb2", | |
["type"] = "5" | |
}, | |
[14] = { | |
["_node"] = "iface13", | |
["if_nr"] = "0", | |
["minor"] = "161", | |
["name"] = "usb1", | |
["type"] = "5" | |
}, | |
[15] = { | |
["_node"] = "iface14", | |
["if_nr"] = "1", | |
["minor"] = "132", | |
["name"] = "AP (2.4 GHz, ath0)", | |
["type"] = "4" | |
}, | |
[16] = { | |
["_node"] = "iface15", | |
["if_nr"] = "0", | |
["minor"] = "131", | |
["name"] = "AP (2.4 GHz, ath0)", | |
["type"] = "4" | |
}, | |
[17] = { | |
["_node"] = "iface16", | |
["if_nr"] = "0", | |
["minor"] = "129", | |
["name"] = "HW (2.4 GHz, wifi0)", | |
["type"] = "4" | |
}, | |
[18] = { | |
["_node"] = "iface17", | |
["if_nr"] = "0", | |
["minor"] = "128", | |
["name"] = "WLAN Management Traffic", | |
["type"] = "4" | |
} | |
}, | |
["capture:settings/session/list(displayname,ifacename,minor,type)"] = { | |
} | |
} | |
CONFIG = { | |
["BETA_RELEASE"] = 0, | |
["DOCSIS"] = false, | |
["GUI_6360_WLAN_INCOMPLETE"] = false, | |
["GUI_AUTOUPDATETAB"] = true, | |
["GUI_HAS_11AC"] = false, | |
["GUI_IS_POWERLINE"] = false, | |
["GUI_IS_REPEATER"] = false, | |
["GUI_LAN_GUEST"] = true, | |
["GUI_NEW_FAX"] = false, | |
["GUI_REMOTE_TMP"] = false, | |
["GUI_SIP_READ_ONLY"] = true, | |
["RELEASE"] = 1, | |
["SESSIONID"] = true, | |
["WEBCM_INTERPRETER"] = true, | |
["WLAN"] = { | |
}, | |
["country"] = "031", | |
["gu_type"] = "release", | |
["isDebug"] = false, | |
["is_6360"] = false, | |
["isp_mac_needed"] = true, | |
["language"] = "en", | |
["language_is_de"] = false, | |
["need_reboot"] = false, | |
["no_ir_pc_rss_samples"] = true, | |
["no_number_area"] = true, | |
["oem"] = "avme", | |
["sip_packetsize"] = true, | |
["sip_provider_international"] = true, | |
["static_net"] = true, | |
["timezone"] = true, | |
["use_nat"] = true | |
} | |
</pre> | |
</div> | |
</body> | |
</html> | |
Leave a Reply