|
本帖最后由 m765555 于 2015-6-25 22:08 编辑
读取本局域网一无线路由器网址源码,提取所有在线用户的mac地址,老是匹配不正确,总是有多余的出现,大家帮我看看是错在哪里,
我用的正则是
(([0-9A-Fa-f]{2}\:){5}?([0-9A-Fa-f]{2})?)\,
au3全源码如下:#include <array.au3>
#include <IE.au3>
$oIE = _IECreate ("http://192.168.11.1/st_wireless.asp")
$sText = _IEDocReadHTML ($oIE)
$arr = StringRegExp($sText,'(([0-9A-Fa-f]{2}\:){5}?([0-9A-Fa-f]{2})?)\,',3)
_ArrayDisplay($arr)
我得到的结果如下:
我的目的是只想看到几个真正的mac地址,其它的不需要。其实只需要15,16,17行前端的12位mac地址,这只是一次保存,有可能不只三个无线mac在线,所以有可能获取更多,反正只要这个位置的所有mac地址。
下面我贴出我的一次保存的网页源码,参考如下:<HTML><HEAD><TITLE>D-LINK | 无线路由</TITLE>
<SCRIPT language=JavaScript src="public.js"></SCRIPT>
<SCRIPT language=JavaScript src="configutil.js"></SCRIPT>
<SCRIPT language=JavaScript src="page.js"></SCRIPT>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META content=10;url=st_wireless.asp http-equiv=Refresh><LINK rel=STYLESHEET type=text/css href="css_router.css">
<SCRIPT>
document.write("<title>"+titl+"</title>");
h_ver = "A1";
f_ver = "v1.00CN";
var wl0_assoclist = new Array(
"74:2F:68:49:E6:F2,00:06:21,1,65000,26000,307,52,144,0,0,0,,,,",
"30:9B:AD:2D:2A:A1,00:22:21,1,1000,72223,1056,11,630,11,0,1,,,,",
"C4:6A:B7:6C:EE:37,01:13:00,1,54000,54000,428,22,232,6,0,1,,,,"
);
</SCRIPT>
</HEAD>
<BODY leftMargin=0 rightMargin=0 topMargin=1 bgColor=#757575>
<FORM name=form1>
<SCRIPT>
page_head(cPage);
</SCRIPT>
<TABLE id=header_container border=0 cellSpacing=0 cellPadding=5 width=838 align=center>
<TBODY>
<TR>
<TD width="100%">产品名 : <A href="http://www.dlink.com.cn/webapp/dlinkweb/servenetwork/servenetwork_view.jsp?ll_Id=1"><FONT size=2>DIR-600M</FONT></A></TD>
<TD noWrap align=right>硬件版本: A1 </TD>
<TD noWrap align=right>软件版本: v1.00CN</TD></TR></TBODY></TABLE>
<TABLE id=topnav_container border=0 cellSpacing=0 cellPadding=0 width=838 align=center>
<TBODY>
<TR>
<TD vAlign=center align=middle><IMG border=0 src="router_logo.jpg" width=836 height=92 useMap=#Map1> <MAP name=Map1><AREA href="http://www.dlink.com.cn" shape=rect coords=11,20,161,71></MAP></TD></TR></TBODY></TABLE>
<TABLE border=0 cellSpacing=1 cellPadding=2 width=838 bgColor=#ffffff align=center>
<TBODY>
<TR id=topnav_container>
<TD><IMG border=0 src="router_title.jpg" width=125 height=25 useMap=#Map4> <MAP name=Map4><AREA href="http://www.dlink.com.cn/webapp/dlinkweb/servenetwork/servenetwork_view.jsp?ll_Id=1" shape=rect coords=5,4,119,21></MAP></TD>
<TD id=topnavoff><A href="index.asp">设置</A></TD>
<TD id=topnavoff><A href="adv_portforward.asp">高级</A></TD>
<TD id=topnavoff><A href="tools_admin.asp">工具</A></TD>
<TD id=topnavon><A href="st_device.asp">状态</A></TD>
<TD id=topnavoff><A href="support_men.asp">帮助</A></TD></TR></TBODY></TABLE>
<TABLE border=1 cellSpacing=0 borderColorDark=#ffffff cellPadding=2 width=838 bgColor=#ffffff align=center height="100%">
<TBODY>
<TR>
<TD id=sidenav_container vAlign=top width=125 align=right>
<TABLE border=0 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD id=sidenav_container>
<DIV id=sidenav>
<UL>
<LI>
<DIV id=sidenavon><A href="st_device.asp">系统信息</A></DIV>
<LI>
<DIV id=sidenavon><A href="st_log.asp">系统日志</A></DIV>
<LI>
<DIV id=sidenavon><A href="st_stats.asp">流量统计</A></DIV>
<LI>
<DIV id=sidenavoff>无线用户列表</DIV></LI></UL></DIV></TD></TR></TBODY></TABLE></TD>
<TD id=maincontent_container vAlign=top>
<DIV id=maincontent>
<DIV id=box_header>
<H1>无线通信客户端列表</H1>显示链接到路由器的无线客户端状态。<BR></DIV>
<DIV class=box>
<H2>无线客户端状态 : </H2>
<TABLE border=1 cellSpacing=1 borderColor=#ffffff cellPadding=2 width=525 bgColor=#dfdfdf>
<TBODY>
<TR>
<TD width="20%" align=middle><STRONG>MAC 地址</STRONG></TD>
<TD width="10%" align=middle><STRONG>时间</STRONG></TD>
<TD width="9%" align=middle><STRONG>RX 速率</STRONG></TD>
<TD width="9%" align=middle><STRONG>TX 速率</STRONG></TD>
<TD width="9%" align=middle><STRONG>RX 数据包</STRONG></TD>
<TD width="9%" align=middle><STRONG>TX 数据包</STRONG></TD>
<TD width="8%" align=middle><STRONG>WME</STRONG></TD></TR>
<SCRIPT>
var out = "";
var i;
var list;
for (i=0;i<wl0_assoclist.length;i++) {
list = wl0_assoclist[i].split(",");
out += "<tr>\n";
out += "<td align="center">"+list[0].toUpperCase()+"</td>\n";
out += "<td align="center">"+list[1]+"</td>\n";
out += "<td align="center">"+list[3]+"</td>\n";
out += "<td align="center">"+list[4]+"</td>\n";
out += "<td align="center">"+(parseInt(list[5])+parseInt(list[6]))+"</td>\n";
out += "<td align="center">"+list[7]+"</td>\n";
out += "<td align="center">"+(list[9] == "1" ? SHARE.YES : SHARE.NO)+"</td>\n";
out += "</tr>\n";
}
document.write(out);
</SCRIPT>
<TR>
<TD align=middle>74:2F:68:49:E6:F2</TD>
<TD align=middle>00:06:21</TD>
<TD align=middle>65000</TD>
<TD align=middle>26000</TD>
<TD align=middle>359</TD>
<TD align=middle>144</TD>
<TD align=middle>否</TD></TR>
<TR>
<TD align=middle>30:9B:AD:2D:2A:A1</TD>
<TD align=middle>00:22:21</TD>
<TD align=middle>1000</TD>
<TD align=middle>72223</TD>
<TD align=middle>1067</TD>
<TD align=middle>630</TD>
<TD align=middle>否</TD></TR>
<TR>
<TD align=middle>C4:6A:B7:6C:EE:37</TD>
<TD align=middle>01:13:00</TD>
<TD align=middle>54000</TD>
<TD align=middle>54000</TD>
<TD align=middle>450</TD>
<TD align=middle>232</TD>
<TD align=middle>否</TD></TR></TBODY></TABLE></DIV></DIV></TD>
<TD id=sidehelp_container vAlign=top width=150 align=left>
<TABLE border=0 cellSpacing=0 cellPadding=2 bgColor=#ffffff>
<TBODY>
<TR>
<TD id=help_text>
<TD id=help_text><STRONG>帮助...</STRONG><BR>
<P>显示当前无线客户端链接到路由器的链接状态。</P></TD></TR></TBODY></TABLE></TD>
<SCRIPT>
page_bottom();
</SCRIPT>
</TR></TBODY></TABLE>
<TABLE id=footer_container border=0 cellSpacing=0 cellPadding=0 width=838 align=center>
<TBODY>
<TR>
<TD width=125 align=middle> <IMG src="wireless_bottom.gif" width=114 height=35></TD>
<TD width=10> </TD>
<TD> </TD></TR></TBODY></TABLE><BR>
<DIV align=center>版权所有 ? 2004-2010友讯网络版权所有</DIV><BR></FORM></BODY></HTML>
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入
×
|