CN106254246B - A kind of method and router of sniff wireless terminal MAC information - Google Patents

A kind of method and router of sniff wireless terminal MAC information Download PDF

Info

Publication number
CN106254246B
CN106254246B CN201610835639.0A CN201610835639A CN106254246B CN 106254246 B CN106254246 B CN 106254246B CN 201610835639 A CN201610835639 A CN 201610835639A CN 106254246 B CN106254246 B CN 106254246B
Authority
CN
China
Prior art keywords
mac
sniff
router
function
data frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610835639.0A
Other languages
Chinese (zh)
Other versions
CN106254246A (en
Inventor
高静
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanxi Luyu Technology Co.,Ltd.
Original Assignee
Shanghai Feixun Data Communication Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Feixun Data Communication Technology Co Ltd filed Critical Shanghai Feixun Data Communication Technology Co Ltd
Priority to CN201610835639.0A priority Critical patent/CN106254246B/en
Publication of CN106254246A publication Critical patent/CN106254246A/en
Application granted granted Critical
Publication of CN106254246B publication Critical patent/CN106254246B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/10Mapping addresses of different types
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The present invention provides the method and router of a kind of sniff wireless terminal MAC information, and wherein method includes: the wireless data frame entrance prepackage MAC sniff functional module in router;When router receives wireless data frame, if MAC sniff function is opened, the MAC sniff functional module obtains the MAC information carried in the wireless data frame;If not finding the MAC information in the router, the MAC information is stored in the router.In the case that the present invention can turn off screen when wireless terminal opens radio function, router also can sniff to wireless terminal MAC information.

Description

一种嗅探无线终端MAC信息的方法和路由器A method and router for sniffing wireless terminal MAC information

技术领域technical field

本发明实施方式涉及通讯技术领域,尤其涉及一种嗅探无线终端MAC信息的方法和路由器。The embodiments of the present invention relate to the technical field of communication, and in particular, to a method and a router for sniffing MAC information of a wireless terminal.

背景技术Background technique

随着互联网和无线网络的快速发展,无线网络接入点和形形色色的无线随身设备充斥着人们的生活。在这样的环境下,无线MAC(Media Access Control,媒体访问控制)嗅探可以为大数据的无线终端提供有力支持,例如:可以为警方办案提供有力的证据证明某个人在某某时间在什么地方,或者追踪某个无线终端也是不错的选择;根据MAC信息可以分析出终端类型,能大致分析出某个地方的人们生活水平状况,为商家投资提供有力的参考数据。因此,在大数据时代,无线终端的网络接入数据会越来越重要。With the rapid development of the Internet and wireless networks, wireless network access points and various wireless portable devices are flooding people's lives. In such an environment, wireless MAC (Media Access Control, Media Access Control) sniffing can provide strong support for big data wireless terminals, for example: it can provide strong evidence for the police to prove where a person is at a certain time , or tracking a certain wireless terminal is also a good choice; according to the MAC information, the type of terminal can be analyzed, and the living standard of people in a certain place can be roughly analyzed, providing powerful reference data for business investment. Therefore, in the era of big data, network access data of wireless terminals will become more and more important.

无线MAC嗅探通过无线终端中的WIFI(Wireless Fidelity,无线保真)模块所发出的无线广播信号进行设备的感知,关键过程是发现WLAN(Wireless Local Area Network,即无线局域网)并连接到它。首先,WLAN网络通过发送携带有SSID(Service SetIdentifier,服务集标识)的Beacons(信标)帧来通知它的存在,然后客户端为了连接WLAN,发送Probe(探测)帧。Wireless MAC sniffing detects the device through the wireless broadcast signal sent by the WIFI (Wireless Fidelity) module in the wireless terminal. The key process is to discover WLAN (Wireless Local Area Network, ie wireless local area network) and connect to it. First, the WLAN network notifies its existence by sending a Beacons (beacon) frame carrying an SSID (Service Set Identifier, Service Set Identifier), and then the client sends a Probe (detection) frame in order to connect to the WLAN.

目前,在无线功能WiFi开启的时候,无线终端会发出Probe帧,并在Probe帧的入口处可以获取无线终端的MAC信息,但是在无线终端屏幕关闭的情况下,即使无线功能WiFi开启,也不会发出Probe帧,导致该情况下无法获取无线终端的MAC信息。At present, when the wireless function WiFi is turned on, the wireless terminal will send a Probe frame, and the MAC information of the wireless terminal can be obtained at the entrance of the Probe frame, but when the wireless terminal screen is turned off, even if the wireless function WiFi is turned on, it will not A Probe frame will be sent, so that the MAC information of the wireless terminal cannot be obtained in this case.

发明内容Contents of the invention

针对上述问题,本发明实施方式的目的在于提供一种嗅探无线终端MAC信息的方法和路由器,能够在无线终端开启无线功能时,即使关闭屏幕的情况下,也能嗅探到无线终端MAC信息。In view of the above problems, the purpose of the embodiments of the present invention is to provide a method and a router for sniffing the MAC information of the wireless terminal, which can sniff the MAC information of the wireless terminal even when the screen is turned off when the wireless function is enabled on the wireless terminal .

为实现上述目的,本发明实施方式提供一种嗅探无线终端MAC信息的方法,应用于路由器,包括:在路由器的无线数据帧入口预装MAC嗅探功能模块;当接收到无线数据帧时,如果MAC嗅探功能开启,所述MAC嗅探功能模块获取所述无线数据帧中携带的MAC信息;如果在所述路由器中没有查找到所述MAC信息,则将所述MAC信息存储在所述路由器中。In order to achieve the above object, the embodiment of the present invention provides a method for sniffing MAC information of a wireless terminal, which is applied to a router, including: pre-installing a MAC sniffing function module at the entrance of a wireless data frame of the router; when receiving a wireless data frame, If the MAC sniffing function is turned on, the MAC sniffing function module obtains the MAC information carried in the wireless data frame; if the MAC information is not found in the router, the MAC information is stored in the in the router.

进一步地,所述在路由器的无线数据帧入口预装MAC嗅探功能模块,包括:在路由器的无线数据帧接收模块中添加MAC嗅探功能模块的入口函数,并把所述无线数据帧接收模块接收的无线数据帧传给所述MAC嗅探的入口函数。Further, the pre-installation of the MAC sniffing function module at the entrance of the wireless data frame of the router includes: adding the entry function of the MAC sniffing function module in the wireless data frame receiving module of the router, and adding the wireless data frame receiving module The received wireless data frame is passed to the entry function of the MAC sniffing.

进一步地,所述当路由器接收到无线数据帧时,如果MAC嗅探功能开启,所述MAC嗅探功能函数获取所述无线数据帧中携带的MAC信息,包括:当无线数据帧进入所述无线数据帧接收模块时,,判断所述MAC嗅探功能是否开启;如果所述MAC嗅探功能开启,则所述无线数据帧进入所述MAC嗅探功能模块的入口函数,所述MAC嗅探功能模块的入口函数获取所述无线数据帧中携带的MAC信息。Further, when the router receives the wireless data frame, if the MAC sniffing function is enabled, the MAC sniffing function obtains the MAC information carried in the wireless data frame, including: when the wireless data frame enters the wireless During the data frame receiving module, it is judged whether the MAC sniffing function is turned on; if the MAC sniffing function is turned on, then the wireless data frame enters the entry function of the MAC sniffing function module, and the MAC sniffing function The entry function of the module obtains the MAC information carried in the wireless data frame.

进一步地,所述如果在所述路由器中没有查找到所述MAC信息,则将所述MAC信息存储在所述路由器中,包括:采用哈希算法查找路由器的哈希表,所述哈希表用于存储无线终端的MAC信息;如果在所述哈希表中没有查找到获取的MAC信息,则将所述MAC信息存储在所述路由器的哈希表中。Further, if the MAC information is not found in the router, storing the MAC information in the router includes: using a hash algorithm to search for a hash table of the router, and the hash table It is used to store the MAC information of the wireless terminal; if the obtained MAC information is not found in the hash table, then store the MAC information in the hash table of the router.

进一步地,所述方法还包括:预先在路由器中设置MAC嗅探的用户态进程,所述MAC嗅探的用户态进程中包括消息接收函数以及所述消息接收函数的定时器;所述消息接收函数用于在所述定时器开启期间监听MAC嗅探的配置信息。Further, the method further includes: pre-setting a user state process of MAC sniffing in the router, the user state process of MAC sniffing includes a message receiving function and a timer of the message receiving function; the message receiving The function is used to monitor the configuration information of MAC sniffing during the start of the timer.

进一步地,所述方法还包括:如果监听到MAC嗅探的配置信息发生了改变,则关闭所述消息接收函数的定时器,重新运行所述消息接收函数;如果监听到MAC嗅探的配置信息没有发生改变,当所述MAC嗅探功能开启时,获取所述路由器的哈希表中的MAC信息,并将获取的MAC信息上传给所述用户态进程;当所述MAC嗅探功能关闭或者接收到关闭MAC嗅探功能的消息时,保持所述用户态进程的运行,关闭所述消息接收函数的定时器。Further, the method further includes: if it is detected that the configuration information of MAC sniffing has changed, then closing the timer of the message receiving function and re-running the message receiving function; if the configuration information of MAC sniffing is monitored No change occurs, when the MAC sniffing function is turned on, obtain the MAC information in the hash table of the router, and upload the obtained MAC information to the user mode process; when the MAC sniffing function is turned off or When the message of closing the MAC sniffing function is received, the running of the user mode process is kept, and the timer of the message receiving function is closed.

为实现上述目的,本发明实施方式还提供一种嗅探无线终端MAC信息的路由器,包括:第一处理模块,用于在无线数据帧入口预装MAC嗅探功能模块;第二处理模块,用于当接收到无线数据帧时,如果MAC嗅探功能开启,所述MAC嗅探功能模块获取所述无线数据帧中携带的MAC信息;第三处理模块,用于如果在所述路由器中没有查找到所述MAC信息,则将所述MAC信息存储在所述路由器中。In order to achieve the above object, the embodiment of the present invention also provides a router for sniffing the MAC information of the wireless terminal, including: a first processing module for pre-installing a MAC sniffing function module at the entrance of the wireless data frame; a second processing module for When a wireless data frame is received, if the MAC sniffing function is turned on, the MAC sniffing function module acquires the MAC information carried in the wireless data frame; the third processing module is used to find if there is no MAC information in the router. If the MAC information is received, the MAC information is stored in the router.

由上可见,本发明实施方式提供的一种嗅探无线终端MAC信息的方法和路由器,通过把MAC嗅探模块从现有的探测帧入口移到所有无线数据帧入口处,使无线终端开启WiFi且关闭屏幕的情况下也能嗅探到无线终端MAC信息;路由器采用哈希算法查找哈希表,查找快速准确;此外,当MAC嗅探功能关闭时,无线数据帧无法进入MAC嗅探模块,最大程度的减少CPU的消耗。It can be seen from the above that a method and a router for sniffing the MAC information of a wireless terminal provided in the embodiments of the present invention enable the wireless terminal to turn on the WiFi by moving the MAC sniffing module from the entrance of the existing detection frame to the entrance of all wireless data frames. And when the screen is turned off, the MAC information of the wireless terminal can also be sniffed; the router uses the hash algorithm to search the hash table, and the search is fast and accurate; in addition, when the MAC sniffing function is turned off, the wireless data frame cannot enter the MAC sniffing module, Minimize CPU consumption.

附图说明Description of drawings

为了更清楚地说明本发明实施方式或现有技术中的技术方案,下面将对实施方式或现有技术描述中所需要使用的附图逐一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art one by one. Obviously, the drawings in the following description are For some implementations of the present invention, those skilled in the art can also obtain other drawings based on these drawings without making creative efforts.

图1为本发明实施方式提供的嗅探无线终端MAC信息的方法的流程示意图;FIG. 1 is a schematic flowchart of a method for sniffing MAC information of a wireless terminal provided in an embodiment of the present invention;

图2为本发明实施方式提供的嗅探无线终端MAC信息的方法的一个具体流程示意图;FIG. 2 is a schematic flowchart of a method for sniffing MAC information of a wireless terminal provided in an embodiment of the present invention;

图3为本发明实施方式提供的嗅探无线终端MAC信息的方法的另一个具体流程示意图;FIG. 3 is another specific flow diagram of a method for sniffing MAC information of a wireless terminal provided in an embodiment of the present invention;

图4为本发明实施方式提供的嗅探无线终端MAC信息的系统的示意图;FIG. 4 is a schematic diagram of a system for sniffing MAC information of a wireless terminal provided by an embodiment of the present invention;

图5为本发明实施方式提供的嗅探无线终端MAC信息的路由器的功能结构示意图。FIG. 5 is a schematic diagram of a functional structure of a router for sniffing MAC information of a wireless terminal provided by an embodiment of the present invention.

具体实施方式Detailed ways

为使本发明实施方式的目的、技术方案和优点更加清楚,下面将结合本发明实施方式中的附图,对本发明实施方式中的技术方案进行清楚、完整地描述,显然,所描述的实施方式是本发明一部分实施方式,而不是全部的实施方式。基于本发明中的实施方式,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施方式,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments It is some embodiments of the present invention, but not all of them. Based on the implementation manners in the present invention, all other implementation manners obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

本发明实施方式提供一种嗅探无线终端MAC信息的方法。请参阅图1,所述方法应用于路由器,包括:The embodiment of the present invention provides a method for sniffing MAC information of a wireless terminal. Referring to Figure 1, the method described is applied to a router, including:

步骤S11,在路由器的无线数据帧入口预装MAC嗅探功能模块;Step S11, pre-installing a MAC sniffing function module at the wireless data frame entrance of the router;

步骤S12,当接收到无线数据帧时,如果MAC嗅探功能开启,所述MAC嗅探功能模块获取所述无线数据帧中携带的MAC信息;Step S12, when the wireless data frame is received, if the MAC sniffing function is enabled, the MAC sniffing function module acquires the MAC information carried in the wireless data frame;

步骤S13,如果在所述路由器中没有查找到所述MAC信息,则将所述MAC信息存储在所述路由器中。Step S13, if the MAC information is not found in the router, store the MAC information in the router.

基于图1,图2为本发明实施方式提供的嗅探无线终端MAC信息的方法的一个具体流程示意图。如图2所示,所述方法应用于路由器,可以包括以下步骤:Based on FIG. 1 , FIG. 2 is a schematic flow chart of a method for sniffing MAC information of a wireless terminal provided in an embodiment of the present invention. As shown in Figure 2, the method is applied to a router, and may include the following steps:

步骤S21,在路由器的无线数据帧入口预装MAC嗅探功能模块。Step S21, pre-installing a MAC sniffing function module at the entrance of the wireless data frame of the router.

在本步骤中,在路由器的无线数据帧入口扩展无线数据帧接收模块,例如在无线数据帧接收模块装载无线数据帧接收函数IEEE80211_input(),进一步地,在IEEE80211_input()中添加MAC嗅探功能模块的入口函数(STA_MAC_sniff()),并把IEEE80211_input()的WBUF和NI中的RSSI(Received Signal Strength Indication,接收的信号强度指示)传给(STA_MAC_sniff())。In this step, expand the wireless data frame receiving module at the wireless data frame entrance of the router, for example, load the wireless data frame receiving function IEEE80211_input() in the wireless data frame receiving module, and further add a MAC sniffing function module in IEEE80211_input() The entry function (STA_MAC_sniff()), and pass the WBUF of IEEE80211_input() and the RSSI (Received Signal Strength Indication, received signal strength indication) in NI to (STA_MAC_sniff()).

步骤S22,当接收到无线数据帧时,路由器判断MAC嗅探功能是否开启,如果是,进行步骤S23;如果否,对所述无线数据帧不做处理。Step S22, when receiving the wireless data frame, the router judges whether the MAC sniffing function is enabled, if yes, proceed to step S23; if not, do not process the wireless data frame.

在本步骤中,当一个无线数据帧进入IEEE80211_input()时,判断是否了开启MAC嗅探功能。In this step, when a wireless data frame enters IEEE80211_input(), it is judged whether the MAC sniffing function is enabled.

如果没开启,则该数据帧无法进入STA_MAC_sniff(),以防止消耗CPU资源,对所述无线数据帧不做处理。If it is not enabled, the data frame cannot enter STA_MAC_sniff() to prevent CPU resource consumption, and the wireless data frame will not be processed.

步骤S23,所述无线数据帧进入MAC嗅探功能模块,所述MAC嗅探功能模块获取所述无线数据帧中携带的MAC信息。Step S23, the wireless data frame enters the MAC sniffing function module, and the MAC sniffing function module obtains the MAC information carried in the wireless data frame.

在本步骤中,如果开启了MAC嗅探功能,所述无线数据帧进入STA_MAC_sniff()中,STA_MAC_sniff()获取所述无线数据帧中携带的MAC信息。In this step, if the MAC sniffing function is enabled, the wireless data frame enters STA_MAC_sniff(), and STA_MAC_sniff() obtains the MAC information carried in the wireless data frame.

步骤S24,判断路由器是否已经存储了所述MAC信息,如果是,对所述无线数据帧的MAC信息不做处理;如果否,进入步骤S25。Step S24, judge whether the router has stored the MAC information, if yes, do not process the MAC information of the wireless data frame; if no, go to step S25.

在本步骤中,采用Hash查找路由器的Hash表,所述哈希表用于存储无线终端的MAC信息。In this step, Hash is used to look up the Hash table of the router, and the Hash table is used to store the MAC information of the wireless terminal.

根据获取的MAC信息中的MAC地址,判断是否已经存储了所述MAC信息。According to the MAC address in the acquired MAC information, it is judged whether the MAC information has been stored.

如果查找到,则Hash表已经存储了所述MAC信息,对所述无线数据帧的MAC信息不做处理。If found, the Hash table has stored the MAC information, and the MAC information of the wireless data frame is not processed.

步骤S25,将所述MAC信息存储在所述路由器的Hash表中。Step S25, storing the MAC information in the Hash table of the router.

在本步骤中,如果Hash表没有存储所述MAC信息,将所述MAC信息存储在所述路由器的Hash表中。In this step, if the Hash table does not store the MAC information, store the MAC information in the Hash table of the router.

所述MAC信息可以包括:MAC,RSSI,timeSTAmp(时间戳)等,其中timeSTAmp用内核中的函数do_gettimeofday()获取内核时间,将tv_sec传给timeSTAmp,这样用户态进程get到终端数据后就可以计算出终端接入时间。The MAC information may include: MAC, RSSI, timeSTAmp (time stamp), etc., wherein timeSTAmp uses the function do_gettimeofday () in the kernel to obtain the kernel time, and passes tv_sec to timeSTAmp, so that the user mode process can be calculated after getting the terminal data Outgoing terminal access time.

图3为本发明实施方式提供的嗅探无线终端MAC信息的方法的另一个具体流程示意图。在本发明实施方式中,如图3所示,为了防止内存消耗过大,还可以包括以下步骤:FIG. 3 is another specific flowchart of the method for sniffing MAC information of a wireless terminal provided by an embodiment of the present invention. In the embodiment of the present invention, as shown in FIG. 3, in order to prevent excessive memory consumption, the following steps may also be included:

步骤S31,预先在路由器中设置MAC嗅探的用户态进程,所述MAC嗅探的用户态进程中包括消息接收函数以及该消息接收函数的定时器。Step S31 , pre-setting a user state process of MAC sniffing in the router, and the user state process of MAC sniffing includes a message receiving function and a timer of the message receiving function.

在本步骤中,预先在路由器中设置MAC嗅探的用户态进程,例如:macsniffer,该MAC嗅探的用户态进程中可以包括消息接收函数以及用于为消息接收函数定时的定时器,该消息接收函数可以例如是getMacSnifferList()。其中该消息接收函数用于在定时器开启期间监听MAC嗅探的配置信息。In this step, the user state process of MAC sniffing is set in the router in advance, for example: macsniffer, and the user state process of this MAC sniffing can include a message receiving function and a timer for timing the message receiving function. The receiving function may eg be getMacSnifferList(). The message receiving function is used to monitor the configuration information of MAC sniffing during the timer start period.

步骤S32,监听接收到MAC嗅探的配置信息是否发生改变,如果是,进行步骤S33;如果否,进行步骤S34。Step S32, monitor whether the received MAC sniffing configuration information has changed, if yes, go to step S33; if not, go to step S34.

在本步骤中,通过getMacSnifferList()能够监听路由器中MDM(Master DataManagement,主数据管理)模块或其他模块接收到MAC嗅探的配置信息是否发生改变。In this step, the MDM (Master Data Management, master data management) module or other modules in the router can monitor whether the configuration information received by MAC sniffing has changed through getMacSnifferList().

MAC嗅探的配置信息可以包括:MAC嗅探功能是否开启、上报给服务器的周期、FTP(File Transfer Protocol)服务器的地址等信息。The configuration information of the MAC sniffing may include: whether the MAC sniffing function is enabled, the period of reporting to the server, the address of the FTP (File Transfer Protocol) server, and other information.

步骤S33,关闭定时器,且重新运行消息接收函数,然后进行S34。Step S33, turn off the timer, and rerun the message receiving function, and then go to S34.

在本步骤中,如果监听到MAC嗅探的配置信息发生了改变,则关闭定时器,重新运行getMacSnifferList()。In this step, if it is detected that the configuration information of MAC sniffing has changed, the timer is turned off, and getMacSnifferList() is run again.

步骤S34,判断MAC嗅探是否开启,如果是,进行步骤S35;如果否,进行步骤S37。Step S34, judging whether MAC sniffing is enabled, if yes, proceed to step S35; if not, proceed to step S37.

在本步骤中,可以通过读取MDM模块或其他模块接收到MAC嗅探的配置信息,来判断MAC嗅探是否开启。In this step, whether MAC sniffing is enabled can be determined by reading the configuration information received by the MDM module or other modules for MAC sniffing.

步骤S35,获取所述路由器的Hash表中的MAC信息,将获取的MAC信息上传给所述MAC嗅探的用户态进程,并清空所述HASH表。Step S35, obtaining the MAC information in the Hash table of the router, uploading the obtained MAC information to the user state process of MAC sniffing, and clearing the HASH table.

在本步骤中,可以采用BOARD_IOCTL函数从内核获取Hash表中存入的嗅探到的MAC信息,然后将获取的MAC信息上传给MAC嗅探的用户态进程。In this step, the BOARD_IOCTL function can be used to obtain the sniffed MAC information stored in the Hash table from the kernel, and then upload the obtained MAC information to the MAC sniffing user mode process.

MAC嗅探的用户态进程获取内核Hash表中存入的嗅探到的MAC信息后,将该Hash表内容清除,防止内存消耗过大。After the user mode process of MAC sniffing obtains the sniffed MAC information stored in the kernel Hash table, it clears the content of the Hash table to prevent excessive memory consumption.

步骤S36,设置定时器,判断定时器的时长是否达到,如果是,返回步骤S34;如果否,继续执行步骤S36。Step S36, setting a timer, judging whether the duration of the timer is reached, if yes, returning to step S34; if not, continuing to execute step S36.

在本步骤中,设置定时器,设定时器的时长为X。In this step, a timer is set, and the duration of the timer is set to X.

当定时器X时长到达时,返回步骤S34判断MAC嗅探是否开启;When the timer X duration arrives, return to step S34 to judge whether MAC sniffing is turned on;

当定时器X时长未到达时,继续执行步骤S36判断定时器的时长是否达到。When the duration of the timer X has not reached, continue to execute step S36 to determine whether the duration of the timer has reached.

即,每个X时长重复上面动作。That is, repeat the above action every X duration.

步骤S37,保持用户态进程的运行,关闭用户态进程中消息接收函数的定时器。Step S37, keep the running of the user state process, and close the timer of the message receiving function in the user state process.

在本步骤中,如果MAC嗅探关闭,或者消息接收函数监听到关闭MAC嗅探功能的消息,则关闭getMacSnifferList()的定时器。需要住的是的,用户态进程还是运行的,以便随时接收MAC嗅探开启的消息重新运行getMacSnifferList()。In this step, if the MAC sniffing is turned off, or the message receiving function hears the message that the MAC sniffing function is turned off, the timer of getMacSnifferList() is turned off. What needs to be lived is that the user mode process is still running, so as to receive the message that MAC sniffing is turned on at any time and re-run getMacSnifferList().

图4为本发明实施方式提供的嗅探无线终端MAC信息的系统的示意图。请参阅图4,该系统包括:FIG. 4 is a schematic diagram of a system for sniffing MAC information of a wireless terminal provided by an embodiment of the present invention. See Figure 4, the system consists of:

客户端,用于发送无线数据帧;The client is used to send wireless data frames;

路由器,用于预先将MAC嗅探功能模块到接收所有无线数据帧的入口;当接收到客户端发送的无线数据帧时,如果MAC嗅探功能开启,所述MAC嗅探功能模块获取所述无线数据帧中携带的MAC信息;如果在所述路由器中没有查找到所述MAC信息,则将所述MAC信息存储在所述路由器中。The router is used to pre-connect the MAC sniffing function module to the entrance to receive all wireless data frames; when receiving the wireless data frame sent by the client, if the MAC sniffing function is enabled, the MAC sniffing function module acquires the wireless MAC information carried in the data frame; if the MAC information is not found in the router, then store the MAC information in the router.

所述路由器在IEEE80211_input()中添加(STA_MAC_sniff()),并把IEEE80211_input()的WBUF和NI中接收的信号强度指示传给(STA_MAC_sniff())。当无线数据帧进入IEEE80211_input()并到达STA_MAC_sniff()时,判断所述MAC嗅探功能是否开启;如果所述MAC嗅探功能没有开启,则所述无线数据帧无法进入STA_MAC_sniff();如果所述MAC嗅探功能开启,则所述无线数据帧进入STA_MAC_sniff(),STA_MAC_sniff()获取所述无线数据帧中携带的MAC信息。The router adds (STA_MAC_sniff()) to IEEE80211_input(), and sends the signal strength indication received in WBUF and NI of IEEE80211_input() to (STA_MAC_sniff()). When a wireless data frame enters IEEE80211_input () and arrives at STA_MAC_sniff (), it is judged whether the MAC sniffing function is enabled; if the MAC sniffing function is not enabled, then the wireless data frame cannot enter STA_MAC_sniff (); if the When the MAC sniffing function is enabled, the wireless data frame enters STA_MAC_sniff(), and STA_MAC_sniff() acquires the MAC information carried in the wireless data frame.

所述路由器采用哈希Hash算法查找Hash表;如果在所述Hash表中没有查找到获取的MAC信息,则将所述MAC信息存储在所述路由器的Hash表中。The router uses a Hash algorithm to look up a Hash table; if the obtained MAC information is not found in the Hash table, then store the MAC information in the Hash table of the router.

图5为本发明实施方式提供的嗅探无线终端MAC信息的路由器的功能结构示意图。请参阅图5,该路由器包括:FIG. 5 is a schematic diagram of a functional structure of a router for sniffing MAC information of a wireless terminal provided by an embodiment of the present invention. See Figure 5, the router includes:

第一处理模块,用于在无线数据帧入口预装MAC嗅探功能模块;The first processing module is used to pre-install a MAC sniffing function module at the entrance of the wireless data frame;

具体地,在IEEE80211_input()中添加(STA_MAC_sniff()),并把IEEE80211_input()的WBUF和NI中接收的信号强度指示传给(STA_MAC_sniff())。Specifically, add (STA_MAC_sniff()) to IEEE80211_input(), and pass the signal strength indication received in WBUF and NI of IEEE80211_input() to (STA_MAC_sniff()).

第二处理模块,用于当接收到无线数据帧时,如果MAC嗅探功能开启,所述MAC嗅探功能模块获取所述无线数据帧中携带的MAC信息;The second processing module is configured to obtain the MAC information carried in the wireless data frame by the MAC sniffing function module if the MAC sniffing function is enabled when the wireless data frame is received;

具体地,当无线数据帧进入IEEE80211_input()并到达STA_MAC_sniff()时,判断所述MAC嗅探功能是否开启;如果所述MAC嗅探功能没有开启,则所述无线数据帧无法进入STA_MAC_sniff();如果所述MAC嗅探功能开启,则所述无线数据帧进入STA_MAC_sniff()函数,STA_MAC_sniff()获取所述无线数据帧中携带的MAC信息。Specifically, when the wireless data frame enters IEEE80211_input() and arrives at STA_MAC_sniff(), it is judged whether the MAC sniffing function is enabled; if the MAC sniffing function is not enabled, the wireless data frame cannot enter STA_MAC_sniff(); If the MAC sniffing function is enabled, the wireless data frame enters the STA_MAC_sniff() function, and STA_MAC_sniff() acquires the MAC information carried in the wireless data frame.

第三处理模块,用于如果在所述路由器中没有查找到所述MAC信息,则将所述MAC信息存储在所述路由器中;A third processing module, configured to store the MAC information in the router if the MAC information is not found in the router;

具体地,采用哈希Hash算法查找路由器的Hash表;如果在所述Hash表中没有查找到获取的MAC信息,则将所述MAC信息存储在所述路由器的Hash表中。Specifically, a Hash algorithm is used to search the Hash table of the router; if the acquired MAC information is not found in the Hash table, then the MAC information is stored in the Hash table of the router.

所述路由器还包括:The router also includes:

第四处理模块,用于在路由器中设置MAC嗅探的用户态进程,所述MAC嗅探的用户态进程中包括消息接收函数以及所述消息接收函数的定时器;所述消息接收函数为getMacSnifferList(),用于在定时器开启期间监听MAC嗅探的配置信息。The fourth processing module is used to set the user state process of MAC sniffing in the router, and the user state process of MAC sniffing includes a message receiving function and a timer of the message receiving function; the message receiving function is getMacSnifferList (), used to monitor MAC sniffing configuration information during the timer start.

第五处理模块,用于如果监听到MAC嗅探的配置信息发生了改变,则关闭所述消息接收函数的定时器,重新运行所述消息接收函数;如果监听到MAC嗅探的配置信息没有发生改变,当所述MAC嗅探功能开启时,获取所述路由器的Hash表中的MAC信息,并将获取的MAC信息上传给所述用户态进程;当所述MAC嗅探功能关闭或者接收到关闭MAC嗅探功能的消息时,保持所述用户态进程的运行,关闭所述消息接收函数的定时器。The fifth processing module is used to close the timer of the message receiving function and rerun the message receiving function if it is monitored that the configuration information of MAC sniffing has changed; if it is detected that the configuration information of MAC sniffing does not occur Change, when the MAC sniffing function is turned on, obtain the MAC information in the Hash table of the router, and upload the acquired MAC information to the user mode process; when the MAC sniffing function is turned off or receives a closed When the message of the MAC sniffing function, keep the operation of the user mode process, and close the timer of the message receiving function.

上述的涉及到的嗅探无线终端MAC信息的系统和嗅探无线终端MAC信息的路由器中的具体技术细节和嗅探无线终端MAC信息的方法中的类似,故不再具体赘述。The specific technical details of the above-mentioned system for sniffing the MAC information of the wireless terminal and the router for sniffing the MAC information of the wireless terminal are similar to those of the method for sniffing the MAC information of the wireless terminal, so details are not repeated here.

由上可见,本发明实施方式提供的一种嗅探无线终端MAC信息的方法、路由器和系统,通过把MAC嗅探函数从现有的探测帧入口移到所有无线数据帧入口处,使无线终端开启WiFi且关闭屏幕的情况下也能嗅探到无线终端MAC信息;路由器采用哈希Hash算法查找Hash表,查找快速准确;用户态进程进程获取MAC信息后,将Hash表中的内容清除,防止内存消耗过大;此外,当MAC嗅探功能关闭时,无线数据帧无法进入MAC嗅探函数,最大程度的减少CPU的消耗。It can be seen from the above that a method, a router and a system for sniffing the MAC information of a wireless terminal provided by the embodiments of the present invention move the MAC sniffing function from the entrance of the existing detection frame to the entrance of all wireless data frames, so that the wireless terminal The MAC information of the wireless terminal can also be sniffed when the WiFi is turned on and the screen is turned off; the router uses the Hash algorithm to search the Hash table, and the search is fast and accurate; after the user mode process obtains the MAC information, the content in the Hash table is cleared to prevent The memory consumption is too large; in addition, when the MAC sniffing function is turned off, wireless data frames cannot enter the MAC sniffing function, which minimizes CPU consumption.

本说明书中的各个实施方式均采用递进的方式描述,各个实施方式之间相同相似的部分互相参见即可,每个实施方式重点说明的都是与其他实施方式的不同之处。Each implementation in this specification is described in a progressive manner, the same and similar parts of each implementation can be referred to each other, and each implementation focuses on the differences from other implementations.

最后应说明的是:上面对本发明的各种实施方式的描述以描述的目的提供给本领域技术人员。其不旨在是穷举的、或者不旨在将本发明限制于单个公开的实施方式。如上所述,本发明的各种替代和变化对于上述技术所属领域技术人员而言将是显而易见的。因此,虽然已经具体讨论了一些另选的实施方式,但是其它实施方式将是显而易见的,或者本领域技术人员相对容易得出。本发明旨在包括在此已经讨论过的本发明的所有替代、修改、和变化,以及落在上述申请的精神和范围内的其它实施方式。Finally, it should be noted that the above description of various embodiments of the present invention is provided for the purpose of description to those skilled in the art. It is not intended to be exhaustive or to limit the invention to a single disclosed embodiment. As described above, various alterations and modifications of the present invention will be apparent to those skilled in the art to which the above techniques pertain. Thus, while a few alternative implementations have been discussed in detail, other implementations will be apparent, or relatively readily arrived at, by those skilled in the art. The present invention is intended to embrace all alternatives, modifications, and variations of the present invention that have been discussed herein, as well as other embodiments that fall within the spirit and scope of the above application.

Claims (8)

1. a kind of method of sniff wireless terminal MAC information is applied to router characterized by comprising
The User space process of MAC sniff is set in the router in advance, is connect in the User space process of the MAC sniff including message The timer of function and the message sink function is received, wherein the message sink function is used to open the phase in the timer Between monitor MAC sniff configuration information;
MAC sniff functional module is pre-installed in the wireless data frame entrance of router;
When router receives wireless data frame, if MAC sniff function is opened, the MAC sniff functional module obtains institute State the MAC information carried in wireless data frame;
If not finding the MAC information in the router, the MAC information is stored in the router In.
2. the method for sniff wireless terminal MAC information according to claim 1, which is characterized in that described in router Wireless data frame entrance pre-installs MAC sniff functional module, comprising:
The entrance function of MAC sniff functional module is added in the wireless data frame receiving module of router, and described wireless The received wireless data frame of data frame receipt module is transmitted to the entrance function of the MAC sniff functional module.
3. the method for sniff wireless terminal MAC information according to claim 2, which is characterized in that described when router connects When receiving wireless data frame, if MAC sniff function is opened, the MAC sniff functional module is obtained in the wireless data frame The MAC information of carrying, comprising:
When wireless data frame enters the wireless data frame receiving module, judge whether the MAC sniff function opens;
If the MAC sniff function is opened, the wireless data frame enters the entrance letter of the MAC sniff functional module Number, the entrance function of the MAC sniff functional module obtain the MAC information carried in the wireless data frame.
4. the method for sniff wireless terminal MAC information according to claim 1, which is characterized in that if described described The MAC information is not found in router, then the MAC information is stored in the router, comprising:
The Hash table of router is searched using hash algorithm, the Hash table is used to store the MAC information of wireless terminal;
If not finding the MAC information of acquisition in the Hash table, the MAC information is stored in the router Hash table in.
5. the method for sniff wireless terminal MAC information according to claim 1, which is characterized in that the method also includes:
If the configuration information for listening to MAC sniff is changed, the timer of the message sink function is closed, again Run the message sink function;
If no change has taken place for the configuration information of MAC sniff in snoop procedure, when the MAC sniff function is opened, obtain MAC information in the Hash table of the router, and the MAC information that will acquire is uploaded to the User space process;As the MAC When the message for closing MAC sniff function is closed or received to sniff function, the operation of the User space process is kept, closes institute State the timer of message sink function.
6. a kind of router of sniff wireless terminal MAC information characterized by comprising
First processing module, for pre-installing MAC sniff functional module in wireless data frame entrance;
Second processing module, for when receiving wireless data frame, if MAC sniff function is opened, the MAC sniff function Module obtains the MAC information carried in the wireless data frame;
Third processing module, if for not finding the MAC information in the router, by the MAC information It is stored in the router;
Fourth processing module, for being arranged the User space process of MAC sniff in the router, the User space of the MAC sniff into It include the timer of message sink function and the message sink function in journey;The message sink function is used for described fixed When device open during monitor MAC sniff configuration information.
7. the router of sniff wireless terminal MAC information according to claim 6, which is characterized in that first processing Module is specifically used for: the entrance function of MAC sniff functional module is added in wireless data frame receiving module, and the nothing Line data frame receiving module received signal intensity indicates the entrance function for being transmitted to the MAC sniff functional module;
The Second processing module, is specifically used for: when wireless data frame enters the wireless data frame receiving module, judging institute State whether MAC sniff function opens;If the MAC sniff function is opened, the wireless data frame enters the MAC sniff The entrance function of the entrance function of functional module, the MAC sniff functional module obtains the MAC carried in the wireless data frame Information;
The third processing module, is specifically used for: the Hash table of router is searched using hash algorithm, the Hash table is for depositing Store up the MAC information of wireless terminal;If not finding the MAC information of acquisition in the Hash table, by the MAC information It is stored in the Hash table of the router.
8. the router of sniff wireless terminal MAC information according to claim 7, which is characterized in that the router is also Include:
5th processing module closes the message sink if the configuration information for listening to MAC sniff is changed The timer of function reruns the message sink function;If listening to the configuration information of MAC sniff, there is no changing The MAC letter for becoming, when the MAC sniff function is opened, obtaining the MAC information in the Hash table of the router, and will acquire Breath is uploaded to the User space process;When the message of closing MAC sniff function is closed or received to the MAC sniff function When, the operation of the User space process is kept, the timer of the message sink function is closed.
CN201610835639.0A 2016-09-20 2016-09-20 A kind of method and router of sniff wireless terminal MAC information Active CN106254246B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610835639.0A CN106254246B (en) 2016-09-20 2016-09-20 A kind of method and router of sniff wireless terminal MAC information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610835639.0A CN106254246B (en) 2016-09-20 2016-09-20 A kind of method and router of sniff wireless terminal MAC information

Publications (2)

Publication Number Publication Date
CN106254246A CN106254246A (en) 2016-12-21
CN106254246B true CN106254246B (en) 2019-11-29

Family

ID=57600282

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610835639.0A Active CN106254246B (en) 2016-09-20 2016-09-20 A kind of method and router of sniff wireless terminal MAC information

Country Status (1)

Country Link
CN (1) CN106254246B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108173668A (en) * 2018-01-30 2018-06-15 北京坤腾畅联科技有限公司 The method and apparatus that WIFI probes based on Openwrt are realized
CN109089301B (en) * 2018-07-19 2021-01-15 深圳云盈网络科技有限公司 Network data processing system and method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101123641A (en) * 2007-09-14 2008-02-13 东南大学 Monitoring method of wireless Internet phone monitoring device based on distributed architecture
CN101917670A (en) * 2010-05-20 2010-12-15 中兴通讯股份有限公司 A method and system for transmitting wireless multicast data
CN103581029A (en) * 2012-08-03 2014-02-12 盛乐信息技术(上海)有限公司 Router and method for opening navigation page automatically
CN105872733A (en) * 2016-04-14 2016-08-17 深圳市百米生活股份有限公司 Internet application method based on video terminal, video terminal therein and video terminal system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101123641A (en) * 2007-09-14 2008-02-13 东南大学 Monitoring method of wireless Internet phone monitoring device based on distributed architecture
CN101917670A (en) * 2010-05-20 2010-12-15 中兴通讯股份有限公司 A method and system for transmitting wireless multicast data
CN103581029A (en) * 2012-08-03 2014-02-12 盛乐信息技术(上海)有限公司 Router and method for opening navigation page automatically
CN105872733A (en) * 2016-04-14 2016-08-17 深圳市百米生活股份有限公司 Internet application method based on video terminal, video terminal therein and video terminal system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"网络监听技术及其对策分析";巫喜红;《中国优秀硕士学位论文全文数据库》;20040915(第3期);I139-144 *

Also Published As

Publication number Publication date
CN106254246A (en) 2016-12-21

Similar Documents

Publication Publication Date Title
US8644828B2 (en) Method and system for selecting a wireless network
BE1021362B1 (en) IDENTIFICATION OF COVER HOLES USING INTER-RAT TRANSFER MEASUREMENTS.
US9167606B2 (en) Network connection control method and apparatus of mobile terminal
RU2628324C2 (en) Method and device for signal transmission control and electronic device
US20150156709A1 (en) Methods and apparatus for neighborhood area network detection
US20160021560A1 (en) Systems, methods, and devices for social proximity fine timing measurement requests multicast signaling
CN110177393A (en) The wireless network connection and registration of power saving for low power consuming devices
KR20180050389A (en) A smart co-processor for optimizing service discovery power consumption in wireless service platforms
US9407522B2 (en) Initiating data collection based on WiFi network connectivity metrics
CN115943660A (en) Radio Resource Management Slack for Radio Resource Control Connected Mode
JP2015505219A (en) System and method for service discovery
CN116094632A (en) Method and device for realizing perception service
US11582706B2 (en) Determine abnormal clock
JP7821903B2 (en) Method, device and equipment for determining candidate members
CN110121183A (en) Information processing method and device and computer readable storage medium
WO2016074138A1 (en) Congestion notification method, related device and system
WO2024000166A1 (en) Sensing data providing methods and apparatuses, device, storage medium and program product
CN104363262A (en) Wireless access device, server, service information push system and service information push method
WO2023165480A1 (en) Data transmission method and apparatus, and terminal, device and storage medium
US20170171809A1 (en) Wireless access point power save mode
US10133754B2 (en) Peer-to-peer picture sharing using custom based rules for minimal power consumption and better user experience
CN106254246B (en) A kind of method and router of sniff wireless terminal MAC information
EP3617922A1 (en) Apparatus and methods for deriving fingerprints of communications devices
CN109392078B (en) Signal detection and transmission method and device, and remote user equipment
WO2022061675A1 (en) Data analysis method and apparatus

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201201

Address after: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee after: Hangzhou Jiji Intellectual Property Operation Co.,Ltd.

Address before: 201616 Shanghai city Songjiang District Sixian Road No. 3666

Patentee before: Phicomm (Shanghai) Co.,Ltd.

TR01 Transfer of patent right

Effective date of registration: 20201216

Address after: 233000 3rd floor, Dong'an Market, Fengyang West Road, Longzihu District, Bengbu City, Anhui Province

Patentee after: Bengbu 309 Technology Consulting Co.,Ltd.

Address before: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee before: Hangzhou Jiji Intellectual Property Operation Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20210203

Address after: 313001 room 1019, Xintiandi office building, Yishan street, Wuxing District, Huzhou, Zhejiang, China

Patentee after: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Address before: 233000 3rd floor, Dong'an Market, Fengyang West Road, Longzihu District, Bengbu City, Anhui Province

Patentee before: Bengbu 309 Technology Consulting Co.,Ltd.

PE01 Entry into force of the registration of the contract for pledge of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A method and router for sniffing MAC information of wireless terminals

Effective date of registration: 20230111

Granted publication date: 20191129

Pledgee: Huzhou Wuxing Rural Commercial Bank Co.,Ltd. high tech Zone Green sub branch

Pledgor: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Registration number: Y2023330000072

PC01 Cancellation of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right

Date of cancellation: 20231205

Granted publication date: 20191129

Pledgee: Huzhou Wuxing Rural Commercial Bank Co.,Ltd. high tech Zone Green sub branch

Pledgor: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Registration number: Y2023330000072

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20260212

Address after: 030000 Taiyuan City, Xiaodian District, Jinyang Street No. 84, Building B, 14th and 15th floors (Taiyuan Kai Zhuo Business Service Co., Ltd., B-1683) cluster registration

Patentee after: Shanxi Luyu Technology Co.,Ltd.

Country or region after: China

Address before: 313001 room 1019, Xintiandi office building, Yishan street, Wuxing District, Huzhou, Zhejiang, China

Patentee before: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Country or region before: China