CN104468190B - A kind of wifi data packet snapping method, device and intelligent terminal - Google Patents

A kind of wifi data packet snapping method, device and intelligent terminal Download PDF

Info

Publication number
CN104468190B
CN104468190B CN201410609863.9A CN201410609863A CN104468190B CN 104468190 B CN104468190 B CN 104468190B CN 201410609863 A CN201410609863 A CN 201410609863A CN 104468190 B CN104468190 B CN 104468190B
Authority
CN
China
Prior art keywords
data
file
wifi
wifi 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
CN201410609863.9A
Other languages
Chinese (zh)
Other versions
CN104468190A (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.)
Hisense Mobile Communications Technology Co Ltd
Original Assignee
Hisense Mobile Communications 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 Hisense Mobile Communications Technology Co Ltd filed Critical Hisense Mobile Communications Technology Co Ltd
Priority to CN201410609863.9A priority Critical patent/CN104468190B/en
Publication of CN104468190A publication Critical patent/CN104468190A/en
Application granted granted Critical
Publication of CN104468190B publication Critical patent/CN104468190B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a kind of wifi data packet snapping method, device and intelligent terminal, main contents include: the wifi data transmitted in acquisition driving layer, and the wifi data include the wifi data of received wifi data and/or transmission;It is the corresponding mac frame of 802.11MAC agreement by collected wifi data buffer storage;The mac frame of caching is formed to the file of at least one setting format according to transmission time sequence.To, the wifi data that intelligent terminal transmits in particular network environment are preserved with the file for setting format, in order to no matter the intelligent terminal whether be in front of network environment, it may be by packet capturing scheme according to the present invention and carry out accurate complete packet capturing operation, be in the action without staff by the network environment before the reproduction of the equipment such as router.Meanwhile the acquisition of data is carried out in layer by driving in wifi, it can be realized the complete acquisition of wifi data.

Description

A kind of wifi data packet snapping method, device and intelligent terminal
Technical field
The present invention relates to field of communication technology more particularly to a kind of wifi data packet snapping methods, device and intelligent terminal.
Background technique
A kind of existing method analyzed intelligent terminal network transmission data is intercepted and captured using packet catcher crawl Data packet, and the problem in network transmission is determined by the parsing to the data packet.
But for the intelligent terminal that network environment changes frequent occurrence, to obtain its transmitted data on network is to have Certain difficulty.This is because the kernel of intelligent terminal and application log can not save all numbers in network transmission process According to being accurately to analyze very much if simple grab data packet by the kernel of crawl intelligent terminal and the mode of application log Network transmission situation.Therefore, it can only be gone to by staff in the used network environment of intelligent terminal institute, using now Some packet catchers carry out the crawl of transmitted data on network.
But for more complicated network environment, or the more remote network environment that can not be reached, staff parent The acquisition for facing scene progress data packet acquires a certain degree of difficulty, and therefore, this packet capturing detection mode is infeasible.
Therefore, it in view of the limitation of network environment, needs to find a kind of scheme that can evade drawbacks described above.
Summary of the invention
The embodiment of the present invention provides a kind of wifi data packet snapping method, device and intelligent terminal, to solve the prior art Present in order to realize packet capturing detection can only carry out network environment reappear so that execute packet capturing operation the problem of.
The embodiment of the present invention uses following technical scheme:
A kind of wifi data packet snapping method, which comprises
The wifi data transmitted in acquisition driving layer, wherein the wifi data include received wifi data and/or hair The wifi data sent;
It is the corresponding mac frame of 802.11MAC agreement by collected wifi data buffer storage;
All mac frames of caching are formed to the file of at least one setting format according to transmission time sequence.
The embodiment of the invention provides a kind of packet snapping method, acquisition drives the wifi data transmitted in layer, wherein described Wifi data include the wifi data of received wifi data and transmission;According to transmission time sequence by collected wifi data buffer storage For the corresponding mac frame of 802.11MAC agreement;All mac frames of caching are formed to the file of at least one setting format.To, The file format wifi data that intelligent terminal transmits in particular network environment can all be identified with packet catcher, parsed is protected Leave come, in order to no matter the intelligent terminal whether be in front of network environment in, may be by according to the present invention The packet snapping method that technical solution provides carries out accurate complete packet capturing operation, is in the action (network rings without staff In border) by the network environment before the reproduction of the equipment such as router.Meanwhile technical solution of the present invention in wifi by driving in layer The acquisition for carrying out data, can be realized the complete acquisition of wifi data.
A kind of wifi data packet capturing device, described device include:
Acquisition unit, for acquiring the wifi data transmitted in driving layer, wherein the wifi data include received Wifi data and/or the wifi data of transmission;
Cache unit, for being the corresponding MAC of 802.11MAC agreement by the collected wifi data buffer storage of acquisition unit Frame;
Group packet unit, all mac frames for caching cache unit according to transmission time sequence form at least one setting lattice The file of formula.
The embodiment of the invention provides a kind of packet capturing device, the wifi data transmitted in acquisition unit acquisition driving layer, In, the wifi data include the wifi data of received wifi data and transmission;Then, cache unit will according to transmission time sequence The collected wifi data buffer storage of acquisition unit is the corresponding mac frame of 802.11MAC agreement;Finally, group packet unit will cache list All mac frames of member caching form the file of at least one setting format.To which the packet capturing device is by intelligent terminal in ad hoc networks The file format for the setting format that the wifi data transmitted in network environment can all be identified with packet catcher preserves, in order to No matter the intelligent terminal whether be in front of network environment in, may be by packet capturing device according to the present invention carry out it is quasi- Really complete packet capturing operation, is in the action before reappearing (in network environment) by equipment such as routers without staff Network environment.Meanwhile packet capturing device through the invention carries out the acquisition of data in wifi driving layer, can be realized wifi The complete acquisition of data.
A kind of intelligent terminal, including the packet capturing device.
The embodiment of the invention provides a kind of intelligent terminal, including a kind of packet capturing device, packet capturing device acquisition driving layers The wifi data of middle transmission, wherein the wifi data include the wifi data of received wifi data and transmission;Then, it presses According to transmission time sequence by collected wifi data buffer storage be the corresponding mac frame of 802.11MAC agreement;Finally, by all of caching Mac frame forms the file of at least one setting format.To the wifi data for transmitting intelligent terminal in particular network environment The file for the setting format that can be all identified with packet catcher preserves, before no matter whether the intelligent terminal be in Network environment in, may be by the packet capturing device that intelligent terminal of the present invention included and carry out accurate complete packet capturing operation, It is in the action (in network environment) without staff by the network environment before the reproduction of the equipment such as router.Meanwhile The packet capturing device that intelligent terminal includes through the invention carries out the acquisition of data in wifi driving layer, can be realized wifi data Complete acquisition.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly introduced, it should be apparent that, drawings in the following description are only some embodiments of the invention, for this For the those of ordinary skill in field, without any creative labor, it can also be obtained according to these attached drawings His attached drawing.
Fig. 1 is a kind of flow diagram for wifi data packet snapping method that the embodiment of the present invention one provides;
Fig. 2 is the transmission path of two transmission direction of the wifi data inside intelligent terminal;
Fig. 3 is a kind of structural schematic diagram of wifi data packet capturing device provided by Embodiment 2 of the present invention;
Fig. 4 is the structural schematic diagram of another kind wifi data packet capturing device provided by Embodiment 2 of the present invention.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention make into It is described in detail to one step, it is clear that described embodiments are only a part of the embodiments of the present invention, rather than whole implementation Example.Based on the embodiments of the present invention, obtained by those of ordinary skill in the art without making creative efforts All other embodiment, shall fall within the protection scope of the present invention.
In embodiments of the present invention, it in order to realizing accurate packet capturing during packet capturing, and avoids in network environment Packet capturing operation is carried out, the embodiment of the invention provides a kind of wifi data packet snapping method, acquisition drives the wifi number transmitted in layer According to, wherein the wifi data include the wifi data of received wifi data and transmission;It will be collected according to transmission time sequence Wifi data buffer storage is the corresponding mac frame of 802.11MAC agreement;All mac frames of caching are formed at least one setting format File.To which the wifi data that intelligent terminal transmits in particular network environment all be set with what packet catcher can identify The file for the formula that fixes preserves, in order to no matter the intelligent terminal whether be in front of network environment in, may be by Packet capturing scheme according to the present invention carries out accurate complete packet capturing operation, is in the action (network rings without staff In border) by the network environment before the reproduction of the equipment such as router.Meanwhile packet capturing scheme through the invention drives layer in wifi The middle acquisition for carrying out data, can be realized the complete acquisition of wifi data.
Technical solution of the present invention is described in detail with specific embodiment below, the present invention includes but and unlimited In following embodiment.
Embodiment one:
As shown in Figure 1, a kind of flow diagram of the wifi data packet snapping method provided for the embodiment of the present invention one, the party Method is applied in the intelligent terminal of Android system, mainly includes the following steps that unit:
Step 11: the wifi data transmitted in acquisition driving layer, wherein the wifi data include received wifi data And/or the wifi data sent.
Wherein, it can be acquired according to transmission time sequence sequence from acquisition interface when acquisition, have a received wifi number when simultaneously When according to wifi data with transmission, due to be on the time it is the same, sequence can successively acquire in no particular order.
In terminal inner, specific to the path of wifi data transmission, mainly counted by the wifi driving for being located at driving layer According to forward process, as shown in Fig. 2, include two transmission directions transmission path:
Transmitting path: when sending wifi data, transmission path are as follows: application layer → protocol layer → driving layer → firmware layer, Wifi data are sent by radio-frequency antenna after finally being handled by firmware layer.
RX path: when receiving wifi data, firstly, firmware layer receives the wifi number sent by radio-frequency antenna According to transmission path are as follows: firmware layer → driving layer → protocol layer → application layer.
Under normal circumstances, include but is not limited to from the data frame type of the driving collected wifi data of layer: control frame, The types such as management frame, data frame.Specifically, in this step 11, since the data packet of driving layer is closest to air-data packet , the actual conditions of air-data packet are best embodied, are distinguished moreover, being easiest to management frame required for will test problem. It therefore, is wifi data to be acquired from the driving layer of kernel, and the purpose that the present invention obtains wifi data is to pass through acquisition Wifi data are accurately positioned the wifi connection institute problem using third party software.It therefore, can be only in this step 11 The management frame required from the driving layer acquisition present invention is handled.
Preferably, from the transmission acquisition interface in driving layer and acquisition interface acquisition wifi data can be received respectively;
Wherein, the acquisition interface that sends can be the interface that layer is driven in transmitting path, send out for obtaining from the interface The wifi data sent;Receiving acquisition interface can be the interface that layer is driven in RX path, be used to obtain from the interface received Wifi data.
However, possible more than one interface can acquire wifi data, not homology for driving layer in transmission path System platform corresponds to different interface structure and type, therefore, by taking high-pass platform as an example, when acquiring wifi data, is only sending Path and RX path select one for obtaining the interface of wifi data respectively, and sending acquisition interface can choose LimHandle80211Frames interface, receiving acquisition interface can choose WDA_TxPacket interface.
In the transmission process of wifi data, if the MAC protocol for being located at driving layer can be the wifi by way of transmitting path The corresponding control information of data addition, such as: frame head, postamble etc. are used to control the information of transfer destination address, and finally form The format of the corresponding mac frame of 802.11MAC agreement is sent to firmware layer and is handled that (this process is generally viewed as initial data frame It is changed into the process of the corresponding mac frame of 802.11MAC agreement).Similarly, by way of RX path, then transmit it is accurate In the case of, the MAC protocol positioned at driving layer can remove corresponding control information for the wifi data, form the protocol layer in kernel The data frame format identified, and be sent to protocol layer (this process is generally viewed as the corresponding mac frame of 802.11MAC agreement and turns It is changed to the process of initial data frame).In view of the foregoing, it is sending acquisition interface or is receiving acquisition interface wifi number collected According to data frame format be possible to as initial data frame, it is also possible to for conversion after the corresponding mac frame of 802.11MAC agreement.
Therefore, in order to be convenient for carrying out the processing being directed to the wifi data of collected different data frame format, Before the multiple wifi data transmitted in acquisition driving layer, the method also includes:
The transmission acquisition interface is detected respectively and receives the type of acquisition interface.
Preferably, detection scheme according to the present invention can specifically include:
Step 1: obtaining the wifi data for sending acquisition interface and receiving acquisition interface respectively;
Step 2: the data frame format for the wifi data that will acquire data frame corresponding with 802.11MAC agreement respectively Format is compared, if matching, it is determined that the type for sending acquisition interface or receiving acquisition interface is 802.11MAC agreement Corresponding interface type;Otherwise, it determines the type for sending acquisition interface or receiving acquisition interface is non-802.11MAC agreement Corresponding interface type, and acquired according to the determining corresponding interface type determination of non-802.11MAC agreement from the interface Frame head needed for wifi data form mac frame.
Step 12: being the corresponding mac frame of 802.11MAC agreement by collected wifi data buffer storage.
Specifically, it is assumed that the t1 moment finds that transmission acquisition interface has the wifi data 1 of transmission, then acquires transmission acquisition interface Wifi data 1, the t2 moment, which finds to receive acquisition interface to have, send out received wifi data 2, then acquires reception acquisition interface Wifi data 2, t3 moment find still there is received wifi data 3 to receive acquisition interface, then acquire and receive acquisition interface Wifi data 3 successively sequentially in time, and collected each wifi data are cached according to transmission time sequence and are 802.11MAC the corresponding mac frame of agreement.
Preferably, during being cached, if collected wifi data are the corresponding number of non-802.11MAC agreement According to frame, then it is that the wifi data add frame head according to the corresponding data frame format of 802.11MAC agreement, is combined into 802.11MAC The corresponding mac frame of agreement;The mac frame being composed and collected mac frame are subjected to order buffer according to transmission time sequence.
Specifically, due to having carried out type detection to transmission acquisition interface and reception acquisition interface in advance, it is acquiring Before wifi data, just having understood will be from the data for sending acquisition interface and the reception collected wifi data of acquisition interface Frame format, if carry out frame format conversion process for the data, and to need to carry out the wifi data of frame format conversion process Institute's frame head to be added.If the interface of acquisition wifi data has determined as the corresponding data of 802.11MAC agreement when detecting Interface under frame format, then, it is not necessary to the wifi data acquired at the acquisition interface are handled;Otherwise, it needs for this All wifi data point reuse data frame formats acquired at acquisition interface, are specifically described with following examples:
The corresponding data frame format of existing 802.11MAC agreement is shown in table 1, including Preamble, PLCP, MAC, Five parts User Data and CRC;
Preamble PLCP MAC User Data CRC
Table 1
Wherein, Preamble layers are lead flag, and for receiving device, (transmission such as various terminals, server receives wifi The equipment of data) 802.11 agreements of identification;PLCP layers (that is: Physical layer convergence protocol) are to map ATM cell to physical medium Specification, the protocol parameter comprising some physical layers.MAC layer processing be frame data, specifically the format of MAC layer be table 2 shown in, Including MAC header (MAC header), frame (Frame Body) and verification three parts domain (FCS);
Table 2
Wherein, MAC header can specifically include not only: frame control domain (Frame Control) (but also specific containing type domain and son Type field represents the type of data frame), duration/mark (Duration/ID), address field (Address) (and specific packet Include: destination address, source address, receiving end address and transmitting terminal address etc.), sequence control domain (Sequence Control), clothes Quality of being engaged in control (QoS Control);The information that frame includes has all differences according to content, the type of data frame, main to use In encapsulation initial data frame, length is 0-2312 byte;Verifying domain includes 32 Cyclic Redundancy Codes.
And from sending acquisition interface or receiving the collected wifi data of acquisition interface if initial data frame, then generally should Initial data frame does not simultaneously include sufficient address domain, can not form the format of real mac frame.Therefore, it is necessary to by being former The mode of the fields such as beginning data frame addition address field (determining in such a way that initial data frame is compared with mac frame) is constituted Mac frame, the adding procedure can carry out before caching, can also directly add when acquisition, the present invention is not to this The specific execution timing of addition operation is defined, two ways.
It should be noted that according to transmission time sequence that the mac frame being composed and collected mac frame progress sequence is slow It deposits, wherein these mac frames can be buffered in preset structural body, i.e., in any idling-resource of data space, avoid Loss of data caused by the direct maloperation that carries out the combination of Pcap file and may cause.
Step 13: all mac frames of caching being formed at least one Pcap file according to transmission time sequence.
Specifically, the frame length of each mac frame of caching is calculated, and is the addition of each mac frame according to the frame length being calculated The data packet of composition is further added at least one setting format comprising file header by data packet head, composition data packet In file, and save.
Wherein, the file data packet that includes of each setting format is arranged according to transmission time sequence, and it is described at least one set The file for the formula that fixes is arranged according to transmission time sequence.
Preferably, the file for setting format is Pcap file.
Firstly, simply introducing the file format of Pcap file.
The file format of Pcap file is to specifically include that the packet of file header (Pcap Header), data packet 1 shown in table 3 Data, the packet header+data packet n data of data ... the data packet n of packet header+data packet 2 of data packet 2 of head+data packet 1.
Wherein, for Pcap file, file header is all configuration fixed value, is generally made of 24 bytes, specific to wrap It includes: the Magic being made of 4 bytes, for identifying the beginning of file;The Major being made of 2 bytes is current file master The version number wanted;The Minor being made of 2 bytes is the secondary version number of current file;It is made of 4 bytes ThisZone can take zero for the local standard time entirely;The SigFigs being made of 4 bytes is the precision of timestamp, can To take zero entirely;The SnapLen being made of 4 bytes indicates maximum memory length;The LinkType being made of 4 bytes is Linktype, and this 4 bytes are most important.
And each data packet subsequent for file header, the packet header of each data packet are made of 16 bytes, tool Body includes: the Timestamp being made of 4 bytes, is that timestamp is high-order, is accurate to the second;It is made of 4 bytes Timestamp is timestamp low level, is accurate to microsecond;The Caplen being made of 4 bytes is the length of active data area, i.e., The data frame length of collected wifi data;The Len being made of 4 bytes is off-line data length: real data in network The length of frame, generally no greater than Caplen are equal with Caplen numerical value in most cases.
Table 3
Since collected each wifi data are saved as the corresponding MAC of 802.11MAC agreement in step 12 Frame, in this step, since Pcap file has above-mentioned call format, and each mac frame saved is equivalent in Pcap file Data packet in data constitute complete data packet one by one therefore, it is necessary to add the packet header of data packet for each mac frame (packet header+data packet data of data packet).However, being and the number to be added for the packet header of each data packet It is related according to the length (size of the mac frame saved) of the data of packet, specifically, byte shared by the data of each data packet Size determines the content in the packet header of the data packet.Because for a Pcap file, it includes each data packet Packet header in configuration be essentially all it is identical, it is unique unlike indicate wifi data data frame length Caplen, The value of the parameter can intuitively reflect the length of the data of the data packet.
When packaging to n mac frame of preservation, can first to each mac frame addition data packet packet header, then for N data packet of acquisition order arrangement adds a file header, forms a Pcap file;It or is first to be arranged with acquisition order N mac frame add a file header, then the packet header of respectively each mac frame addition data packet, form a Pcap file. Above two mode, below to be briefly described for first adding the packet header of data packet.
Preferably, at least one Pcap file, the quantity for the data packet that each Pcap file includes is equal or different.
It is assumed that the configuration of the part packet header of the file header of Pcap file and data packet is as follows in the embodiment of the present invention:
File header:
Magic:0xD4 0xC3 0xB2 0xA1
Major:0x02 0x00
Minor:0x04 0x00
ThisZone:0x00 0x00 0x00 0x00
SigFigs:0x00 0x00 0x00 0x00
SnapLen:0xFF 0xFF 0x00 0x00 // this at maximum storage length can change
The LinkType:0x69 0x00 0x00 mac frame of 0x00 // 802.11 (fixation)
The packet header of data packet:
Timestamp:0x00 0x00 0x00 0x00 // be set as full 0 herein
Timestamp:0x00 0x00 0x00 0x00 // be set as full 0 herein
Caplen: the length of unknown //mac frame needs to carry out calculating according to each frame and sets Set different value
Len: the length of unknown //mac frame needs to carry out calculating and setting according to each frame Different value
Wherein, a timestamp high position and timestamp low level can be numbered according to the sequence of 1,2,3 ... n, or press It is configured according to the actual time.The present invention does not limit this specifically, as long as can embody between data packet is according to biography Defeated timing is ranked up.
It follows that for Pcap file complete for one, file header it has been determined that each data packet packet header Partial parameters have also determined that the data of data packet are the content of the mac frame saved, therefore, for each data packet Speech, the length that need to only calculate each mac frame can determine the value of Caplen and Len.And then improve the content of Pcap file, group At a complete Pcap file.
By taking two mac frames as an example:
First mac frame: 0xD4 0x00 0x00 0x00 0x24 0xE2 0x71 0x46 0xD30x40 0x00 0x00 0x00 0x00 (length of data frame is 14 bytes)
Second mac frame: 0xD4 0x00 0x02 0x00 0x38 0x83 0x45 0x9B 0xA70x56 0x00 0x00 0x00 0x00 (length of data frame is 14 bytes)
The file header of Pcap file: 0xD4 0xC3 0xB2 0xA1 0x02 0x00 0x04 0x00 0x00 0x000x00 0x00 0x00 0x00 0x00 0x00 0xFF 0xFF 0x00 0x00 0x69 0x00 0x00 0x00
For the packet header of the data packet 1 of first mac frame: 0x48 0x20 0x67 0x53 0x9C 0x1C0x00 0x00 0x0E 0x00 0x00 0x00 0x0E 0x00 0x00 0x00
For the packet header of the data packet 2 of second mac frame: 0x48 0x20 0x67 0x53 0x9C 0x1C0x00 0x00 0x0E 0x00 0x00 0x00 0x0E 0x00 0x00 0x00
Since the length of the data frame of two mac frames is 14 bytes, then in the 9th~12 byte position in the packet header of data packet Set place value be 0x0E 0x00 0x00 0x00, indicate the data of the data packet length be 14 bytes, addition file header and Behind the packet header of data packet, following Pcap files are formed, as shown in table 4 below, wherein 16 bytes of each behavior, inclined stripe region The file header of the Pcap file is represented, grid spaces represent the packet header of data packet 1, and back is the number of data packet 1 without filling region According to;Net region is the packet header of data packet 2, and back is the data of data packet 2 without filling region.
Table 4
By above-mentioned group of packet scheme, collected wifi data are saved as into the corresponding mac frame of 802.11 agreements first, so The length of each mac frame is calculated afterwards, and the packet header of data packet, multiple numbers that composition is arranged by acquisition order are added for each mac frame According to packet, finally, forming Pcap file by the file header for adding preset Pcap file for the data packet group.Moreover, can basis The quantity of collected data packet sequentially forms multiple Pcap files according to transmission time sequence, in multiple Pcap files of formation, often The quantity for the data packet that a Pcap file includes is equal or unequal.To which intelligent terminal be transmitted in particular network environment The file of setting format that can all be identified with packet catcher of wifi data preserve, in order to which no matter the intelligent terminal is It is no be in front of network environment in, may be by packet capturing scheme according to the present invention and carry out accurate complete packet capturing behaviour Make, is in the action (in network environment) without staff by the network environment before the reproduction of the equipment such as router.Together When, packet capturing scheme through the invention carries out the acquisition of data in wifi driving layer, can be realized completely adopting for wifi data Collection.
Based on same inventive concept is belonged to above-mentioned wifi data packet snapping method, the embodiment of the present invention two additionally provides one kind Wifi data packet capturing device.
Embodiment two:
As shown in figure 3, being a kind of structural schematic diagram of wifi data packet capturing device provided by Embodiment 2 of the present invention, this is grabbed Bag apparatus can integrate in the kernel of intelligent terminal, can also be used as and hangs on intelligent terminal outside a kind of self-contained unit structure, The Main functional units of the packet capturing device include:
Acquisition unit 21, for acquiring the wifi data transmitted in driving layer, wherein the wifi data include received Wifi data and/or the wifi data of transmission.
Cache unit 22 is corresponded to for caching the collected wifi data of acquisition unit respectively for 802.11MAC agreement Mac frame.
Group packet unit 23, all mac frames for caching cache unit according to transmission time sequence form at least one setting The file of format.
Preferably, this set the file of format as that can be identified by any packet catcher, the file of parsing, such as: Pcap file.
As shown in figure 4, described device further include:
Detection unit 24, for before acquisition drives the wifi data transmitted in layer, detecting the transmission acquisition respectively Interface and the type for receiving acquisition interface.
Preferably, the detection unit 24, is specifically used for: obtaining respectively and sends acquisition interface and receive acquisition interface Wifi data;The data frame format for the wifi data that will acquire respectively data frame format corresponding with 802.11MAC agreement into Row compares, if matching, it is determined that the type for sending acquisition interface or receiving acquisition interface is that 802.11MAC agreement is corresponding Interface type;Otherwise, it determines the type for sending acquisition interface or receiving acquisition interface is that non-802.11MAC agreement is corresponding Interface type, and frame head needed for the wifi data composition mac frame of the determining transmission acquisition interface or reception acquisition interface.
Preferably, cache unit 22 are specifically used for: detecting the transmission acquisition interface in detection unit or reception acquisition connects Mouthful type when being the corresponding interface type of non-802.11MAC agreement, be according to the corresponding data frame format of 802.11MAC agreement The determining frame head of wifi data addition, is combined into the corresponding mac frame of 802.11MAC agreement;By the mac frame of composition with adopt The mac frame collected is cached according to transmission time sequence.
Preferably, described group of packet unit 23, is specifically used for:
The frame length of each mac frame of caching is calculated, and is that each mac frame adds data packet according to the frame length being calculated Head, composition data packet;
The data packet of composition is added in the file of at least one setting format comprising file header, and saved;
Wherein, the file data packet that includes of each setting format is arranged according to transmission time sequence, and it is described at least one set The file for the formula that fixes is arranged according to transmission time sequence.
Preferably, in the file of at least one setting format, the file data packet that includes of each setting format Quantity is equal or different.
Preferably, the acquisition unit from the transmission acquisition interface in driving layer and receives acquisition interface acquisition wifi respectively Data;The transmission acquisition interface is limHandle80211Frames interface, and the reception acquisition interface is WDA_ TxPacket interface.
Embodiment three:
The embodiment of the invention also provides a kind of intelligent terminal, the packet capturing including wifi data involved in above-described embodiment Device, in addition, the intelligent terminal further include: the structural units such as kernel, drive module, radio-frequency module and display screen.
It should be understood by those skilled in the art that, the embodiment of the present invention can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present invention Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the present invention, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
Although preferred embodiments of the present invention have been described, it is created once a person skilled in the art knows basic Property concept, then additional changes and modifications may be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as It selects embodiment and falls into all change and modification of the scope of the invention.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art Mind and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to include these modifications and variations.

Claims (11)

1. a kind of wifi data packet snapping method, which is characterized in that the described method includes:
The wifi data transmitted in acquisition driving layer, wherein the wifi data include received wifi data and/or transmission Wifi data;
It is the corresponding mac frame of 802.11MAC agreement by collected wifi data buffer storage;
All mac frames of caching are formed to the file of at least one setting format according to transmission time sequence;
Wherein, the wifi data from the transmission acquisition interface in driving layer and receive acquisition interface acquisition respectively;
Before the wifi data transmitted in the acquisition driving layer, further includes:
The wifi data for sending acquisition interface and receiving acquisition interface are obtained respectively;
Data frame format corresponding with 802.11MAC agreement is compared the data frame format for the wifi data that will acquire respectively Compared with if matching, it is determined that the type for sending acquisition interface or receiving acquisition interface is the corresponding interface of 802.11MAC agreement Type;Otherwise, it determines the type for sending acquisition interface or receiving acquisition interface is the corresponding interface of non-802.11MAC agreement Type, and frame head needed for the wifi data composition mac frame of the determining transmission acquisition interface or reception acquisition interface.
2. the method as described in claim 1, which is characterized in that the file for setting format is Pcap file.
3. the method as described in claim 1, which is characterized in that described that collected wifi data are saved as 802.11MAC The corresponding mac frame of agreement, specifically includes:
It is the corresponding interface type of non-802.11MAC agreement determining the transmission acquisition interface or receiving the type of acquisition interface When, it is that the transmission acquisition interface or reception acquisition interface are collected according to the corresponding data frame format of 802.11MAC agreement The determining frame head of wifi data addition, the corresponding mac frame of composition 802.11MAC agreement;
The mac frame of composition and collected mac frame are cached.
4. the method as described in claim 1, which is characterized in that described to form all mac frames of caching according to transmission time sequence The file of at least one setting format, specifically includes:
The frame length of each mac frame of caching is calculated, and is that each mac frame adds data packet head, group according to the frame length being calculated At data packet;
The data packet of composition is added to the file of at least one setting format comprising file header, and is saved;
Wherein, the data packet that the file of the setting format includes is arranged according to transmission time sequence, and at least one described setting lattice The file of formula is arranged according to transmission time sequence.
5. method as claimed in claim 4, which is characterized in that in the file of at least one setting format, each setting The quantity for the data packet that the file of format includes is equal or different.
6. a kind of wifi data packet capturing device, which is characterized in that described device includes:
Acquisition unit, for acquiring the wifi data transmitted in driving layer, wherein the wifi data include received wifi number According to the wifi data with transmission;
Cache unit, for being the corresponding mac frame of 802.11MAC agreement by the collected wifi data buffer storage of acquisition unit;
Group packet unit, all mac frames for caching cache unit according to transmission time sequence form at least one setting format File;
Wherein, the acquisition unit from the transmission acquisition interface in driving layer and receives acquisition interface acquisition wifi data respectively;
Described device further include:
Detection unit, for obtaining the wifi data for sending acquisition interface and receiving acquisition interface, the wifi that will acquire respectively Data frame format corresponding with 802.11MAC agreement is compared the data frame format of data respectively, if matching, it is determined that described Sending acquisition interface or receiving the type of acquisition interface is the corresponding interface type of 802.11MAC agreement;Otherwise, it determines the hair Sending acquisition interface or receiving the type of acquisition interface is the corresponding interface type of non-802.11MAC agreement, and determines that the transmission is adopted Frame head needed for collecting interface or receiving the wifi data composition mac frame of acquisition interface.
7. device as claimed in claim 6, which is characterized in that the file for setting format is Pcap file.
8. device as claimed in claim 6, which is characterized in that cache unit is specifically used for:
It is that non-802.11MAC agreement is corresponding in the type that detection unit detects the transmission acquisition interface or receives acquisition interface It is the determining frame head of wifi data addition, group according to the corresponding data frame format of 802.11MAC agreement when interface type Synthesize the corresponding mac frame of 802.11MAC agreement;
The mac frame of composition and collected mac frame are cached.
9. device as claimed in claim 6, which is characterized in that described group of packet unit is specifically used for:
The frame length of each mac frame of caching is calculated, and is that each mac frame adds data packet head, group according to the frame length being calculated At data packet;
The data packet of composition is added in the file of at least one setting format comprising file header, and saved;
Wherein, the data packet that the file of each setting format includes is arranged according to transmission time sequence, and at least one described setting lattice The file of formula is arranged according to transmission time sequence.
10. device as claimed in claim 9, which is characterized in that in the file of at least one setting format, each setting The quantity for the data packet that the file of format includes is equal or different.
11. a kind of intelligent terminal, which is characterized in that including any packet capturing device of claim 6~10.
CN201410609863.9A 2014-11-03 2014-11-03 A kind of wifi data packet snapping method, device and intelligent terminal Active CN104468190B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410609863.9A CN104468190B (en) 2014-11-03 2014-11-03 A kind of wifi data packet snapping method, device and intelligent terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410609863.9A CN104468190B (en) 2014-11-03 2014-11-03 A kind of wifi data packet snapping method, device and intelligent terminal

Publications (2)

Publication Number Publication Date
CN104468190A CN104468190A (en) 2015-03-25
CN104468190B true CN104468190B (en) 2018-12-25

Family

ID=52913601

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410609863.9A Active CN104468190B (en) 2014-11-03 2014-11-03 A kind of wifi data packet snapping method, device and intelligent terminal

Country Status (1)

Country Link
CN (1) CN104468190B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105472640A (en) * 2015-11-13 2016-04-06 上海熙菱信息技术有限公司 WiFi information collection method and system
CN107306291B (en) * 2016-04-22 2021-04-06 中兴通讯股份有限公司 Terminal operation method and device
CN110113771B (en) * 2019-03-22 2022-06-17 深圳市飞比电子科技有限公司 Data processing method, device, gateway equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101426000A (en) * 2007-10-30 2009-05-06 北京启明星辰信息技术有限公司 General protocol parsing method and system
CN103716777A (en) * 2013-12-18 2014-04-09 厦门市美亚柏科信息股份有限公司 Wireless terminal MAC address acquisition method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
NZ506411A (en) * 2000-08-17 2003-05-30 Compudigm Int Ltd Translation of data streams between protocols for transmission through firewalls
CN102202062B (en) * 2011-06-03 2013-12-25 苏州九州安华信息安全技术有限公司 Method and apparatus for realizing access control
CN103259699B (en) * 2013-05-28 2015-11-25 华为技术有限公司 Method of testing, system and client and service end

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101426000A (en) * 2007-10-30 2009-05-06 北京启明星辰信息技术有限公司 General protocol parsing method and system
CN103716777A (en) * 2013-12-18 2014-04-09 厦门市美亚柏科信息股份有限公司 Wireless terminal MAC address acquisition method and device

Also Published As

Publication number Publication date
CN104468190A (en) 2015-03-25

Similar Documents

Publication Publication Date Title
CN105122748B (en) Realize the sensitive method and system collected of dialogue of link aggregation group
CN107612909A (en) Information interacting method, device and equipment on internet of things equipment
RU2014104375A (en) SYSTEMS AND METHODS FOR WIRELESS BEACON SIGNALS WITH A LITTLE NUMBER OF SERVICE INFORMATION WHICH HAVE COMPRESSED NETWORK IDENTIFIERS
US20140359035A1 (en) Data aggregation
CN102244593A (en) Network communication at unaddressed network devices
CN109155744A (en) Dynamic experience management in communication
CN106101011B (en) message processing method and device
CN110401624A (en) The detection method and system of source net G system mutual message exception
CN103765847A (en) Apparatus and methods for media access control header compression
CN103763695B (en) Method for evaluating safety of internet of things
CN104468190B (en) A kind of wifi data packet snapping method, device and intelligent terminal
WO2008035862A1 (en) Method and apparatus for transmitting transport stream packets
EP3281361B1 (en) Latency measurer
CN107438254B (en) Service identification method, device and system based on user behavior
CN110536324B (en) WiFi signal data acquisition and processing method and system
CN104378315B (en) A kind of method and device of CAPWAP tunnel packet transmission
CN106797335A (en) Data transmission method, data transmission device, electronic equipment and computer program product
CN106789625A (en) A kind of loop detecting method and device
CN104579788B (en) A kind of location of mistake method of distributed dynamic route network
CN106664444B (en) Method and apparatus for receiving media packet in multimedia system
CN111490907B (en) Method and device for determining VXLAN network performance parameters
CN106549784B (en) A kind of data processing method and equipment
CN102595467B (en) Data acquisition method and data acquisition device
CN111343153A (en) Data packet detection method, device, server and storage medium
CN109246639A (en) A kind of data gateway system and its communication means

Legal Events

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