CN111741142A - High-frequency IP address acquisition method, system, storage medium and terminal equipment - Google Patents

High-frequency IP address acquisition method, system, storage medium and terminal equipment Download PDF

Info

Publication number
CN111741142A
CN111741142A CN202010568647.XA CN202010568647A CN111741142A CN 111741142 A CN111741142 A CN 111741142A CN 202010568647 A CN202010568647 A CN 202010568647A CN 111741142 A CN111741142 A CN 111741142A
Authority
CN
China
Prior art keywords
address
queue
frequency
address queue
judging whether
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.)
Pending
Application number
CN202010568647.XA
Other languages
Chinese (zh)
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.)
Nanchang Black Shark Technology Co Ltd
Original Assignee
Nanchang Black Shark 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 Nanchang Black Shark Technology Co Ltd filed Critical Nanchang Black Shark Technology Co Ltd
Priority to CN202010568647.XA priority Critical patent/CN111741142A/en
Publication of CN111741142A publication Critical patent/CN111741142A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5084Providing for device mobility

Abstract

The invention provides a method and a device for acquiring a high-frequency IP address, a storage medium and terminal equipment, wherein the method comprises the following steps: acquiring a network data packet meeting preset conditions, and extracting an IP address from the network data packet; judging whether the IP address is in a first IP address queue or not; if the IP address is not in the first IP address queue, adding the IP address into the first IP address queue; if the IP address is in the first IP address queue, removing the IP address from the first IP address queue; and adding the IP address into the second IP address queue, and determining the IP address as a newly added high-frequency IP address. The invention screens the IP addresses step by setting the preset conditions and the IP address queue, and can acquire high-frequency IP addresses from a large amount of network data.

Description

High-frequency IP address acquisition method, system, storage medium and terminal equipment
Technical Field
The invention relates to the technical field of data processing, in particular to a high-frequency IP address acquisition method, a high-frequency IP address acquisition system, a high-frequency IP address storage medium and a high-frequency IP address terminal device.
Background
The application program interacts with the server through the network data, the IP address is an important identifier of the network data, and the application program can help equipment such as a mobile phone and the like to screen out the network data correspondingly sent by the target IP address from a large amount of network data, so that various processing optimization behaviors such as priority processing of the target network data and the like are facilitated.
However, IP addresses are often changed, even if the same application program is different in time, IP addresses used by different services are different, even if IP addresses meeting specific conditions are screened out through characteristic conditions such as protocols, lengths and the like, the screened IP addresses are still large and variable, if all the IP addresses meeting the specific conditions are extracted and optimized, resources are wasted, even if resources are not allocated correctly when the resources are insufficient, and an expected processing effect is not achieved.
Disclosure of Invention
Based on this, the present invention provides a method, a system, a storage medium, and a terminal device for acquiring a high-frequency IP address from a large amount of network data, so that a subsequent device can only process and optimize data corresponding to the high-frequency IP address, thereby avoiding resource waste.
The embodiment of the invention provides a high-frequency IP address acquisition method, which comprises the following steps:
acquiring a network data packet meeting preset conditions, and extracting an IP address from the network data packet;
judging whether the IP address is in a first IP address queue or not;
if the IP address is not in the first IP address queue, adding the IP address into the first IP address queue;
if the IP address is in the first IP address queue, removing the IP address from the first IP address queue;
and adding the IP address into a second IP address queue, and determining the IP address as a newly added high-frequency IP address.
In addition, the method for acquiring a high-frequency IP address according to the above embodiment of the present invention may further have the following additional technical features:
further, after the step of removing the IP address from the first IP address queue, the method further includes:
judging whether the IP address is in the second IP address queue or not;
and if the IP address is not in the second IP address queue, adding the IP address into the second IP address queue, and determining the IP address as a newly added high-frequency IP address.
Further, before the step of determining whether the IP address is in the first IP address queue, the method further includes:
judging whether the IP address is in the second IP address queue or not;
and if the IP address is not in the second IP address queue, executing the step of judging whether the IP address is in the first IP address queue.
Further, the step of determining whether the IP address is in the second IP address queue further includes:
and if the IP address is in the second IP address queue, moving the IP address to the tail of the second IP address queue.
Further, before the step of removing the IP address from the first IP address queue, the method further includes:
judging whether the occurrence frequency of the IP address reaches a preset frequency or not;
and if so, executing the step of removing the IP address from the first IP address queue.
Further, the step of adding the IP address to the first IP address queue comprises:
judging whether a vacancy exists in the first IP address queue or not;
if yes, adding the IP address into a vacancy of the first IP address queue;
and if not, adding the IP address to the tail of the first IP address queue.
Further, the first IP address queue is a fixed-length queue, and after the step of adding the IP address to the tail of the first IP address queue, the method further includes:
and removing the head-of-line IP address of the first IP address queue.
Further, after the step of determining the IP address as the newly added high-frequency IP address, the method further includes:
and reporting the newly added high-frequency IP address.
Further, the step of adding the IP address to the second IP address queue comprises:
adding the IP address to the tail of the second IP address queue.
Further, the second IP address queue is a fixed-length queue, and after the step of adding the IP address to the tail of the second IP address queue, the method further includes:
judging whether the queue length of the second IP address queue exceeds a fixed length;
and if so, removing the head of queue IP address of the second IP address queue and reporting.
According to an embodiment of the present invention, a high frequency IP address acquisition apparatus includes:
the device comprises an address extraction module, a network data packet processing module and a data transmission module, wherein the address extraction module is used for acquiring the network data packet meeting preset conditions and extracting an IP address from the network data packet;
the first judgment module is used for judging whether the IP address is in a first IP address queue or not;
the first processing module is used for adding the IP address to the first IP address queue when the IP address is judged not to be in the first IP address queue;
the queue removing module is used for removing the IP address from the first IP address queue when the IP address is judged to be in the first IP address queue;
and the second processing module is used for adding the IP address into a second IP address queue and determining the IP address as a newly added high-frequency IP address.
The present invention also proposes a computer-readable storage medium on which a computer program is stored, which when executed by a processor implements the above-mentioned high-frequency IP address acquisition method.
The invention also provides a terminal device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the high-frequency IP address acquisition method.
Compared with the prior art: the IP addresses are screened step by setting the preset conditions and the first IP address queue, and the IP addresses are determined to be newly added high-frequency IP addresses only when the preset conditions are met by data and the IP addresses are in the first IP address queue, so that the high-frequency IP addresses can be obtained from a large amount of network data, and the follow-up equipment can only process and optimize the data corresponding to the high-frequency IP addresses, thereby avoiding resource waste.
Drawings
Fig. 1 is a schematic structural diagram of a mobile phone provided in an embodiment of the present invention;
fig. 2 is a flowchart of a high-frequency IP address acquisition method according to a first embodiment of the present invention;
fig. 3 is a flowchart of a high-frequency IP address acquisition method according to a second embodiment of the present invention;
fig. 4 is a flowchart of a high-frequency IP address acquisition method in a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of a high-frequency IP address obtaining apparatus in a fourth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a terminal device in a fifth embodiment of the present invention.
The following detailed description will further illustrate the invention in conjunction with the above-described figures.
Detailed Description
To facilitate an understanding of the invention, the invention will now be described more fully with reference to the accompanying drawings. Several embodiments of the invention are presented in the drawings. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
It will be understood that when an element is referred to as being "secured to" another element, it can be directly on the other element or intervening elements may also be present. When an element is referred to as being "connected" to another element, it can be directly connected to the other element or intervening elements may also be present. The terms "vertical," "horizontal," "left," "right," and the like as used herein are for illustrative purposes only.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
The high-frequency IP address obtaining method provided by the embodiment of the application can be applied to terminal devices such as a mobile phone, a tablet personal computer, a wearable device, a vehicle-mounted device, an Augmented Reality (AR)/Virtual Reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA) and the like, and the embodiment of the application does not limit the specific type of the terminal device at all.
Take the terminal device as a mobile phone as an example. Fig. 1 is a block diagram illustrating a partial structure of a mobile phone according to an embodiment of the present disclosure. Referring to fig. 1, the cellular phone includes: a Radio Frequency (RF) circuit 110, a memory 120, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a wireless fidelity (WiFi) module 170, a processor 180, and a power supply 190. Those skilled in the art will appreciate that the handset configuration shown in fig. 1 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile phone in detail with reference to fig. 1:
the RF circuit 110 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, receives downlink information of a base station and then processes the received downlink information to the processor 180; in addition, the data for designing uplink is transmitted to the base station. Typically, the RF circuitry includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuitry 110 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to global system for Mobile communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
The memory 120 may be used to store software programs and modules, and the processor 180 executes various functional applications and data processing of the mobile phone by operating the software programs and modules stored in the memory 120. The memory 120 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 120 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 130 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular phone. Specifically, the input unit 130 may include a touch panel 131 and other input devices 132. The touch panel 131, also referred to as a touch screen, may collect touch operations of a user on or near the touch panel 131 (e.g., operations of the user on or near the touch panel 131 using any suitable object or accessory such as a finger or a stylus pen), and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 131 may include two parts, i.e., a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 180, and can receive and execute commands sent by the processor 180. In addition, the touch panel 131 may be implemented by various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 130 may include other input devices 132 in addition to the touch panel 131. In particular, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 140 may be used to display information input by a user or information provided to the user and various menus of the mobile phone. The display unit 140 may include a display panel 141, and optionally, the display panel 141 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 131 can cover the display panel 141, and when the touch panel 131 detects a touch operation on or near the touch panel 131, the touch operation is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 provides a corresponding visual output on the display panel 141 according to the type of the touch event. Although the touch panel 131 and the display panel 141 are shown as two separate components in fig. 1 to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 131 and the display panel 141 may be integrated to implement the input and output functions of the mobile phone.
The handset may also include at least one sensor 150, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 141 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 141 and/or the backlight when the mobile phone is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing the posture of a mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, further description is omitted here.
Audio circuitry 160, speaker 161, and microphone 162 may provide an audio interface between the user and the handset. The audio circuit 160 may transmit the electrical signal converted from the received audio data to the speaker 161, and convert the electrical signal into a sound signal for output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal, which is received by the audio circuit 160 and converted into audio data, which is then processed by the audio data output processor 180 and then transmitted to, for example, another cellular phone via the RF circuit 110, or the audio data is output to the memory 120 for further processing.
WiFi belongs to short-distance wireless transmission technology, and the mobile phone can help a user to receive and send e-mails, browse webpages, access streaming media and the like through the WiFi module 170, and provides wireless broadband Internet access for the user. Although fig. 1 shows the WiFi module 170, it is understood that it does not belong to the essential constitution of the handset, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 180 is a control center of the mobile phone, connects various parts of the entire mobile phone by using various interfaces and lines, and performs various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 120 and calling data stored in the memory 120, thereby integrally monitoring the mobile phone. Alternatively, processor 180 may include one or more processing units; preferably, the processor 180 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 180.
The handset also includes a power supply 190 (e.g., a battery) for powering the various components, and preferably, the power supply may be logically connected to the processor 180 via a power management system, such that functions such as managing charging, discharging, and power consumption are performed via the power management system.
Although not shown, the handset may also include a camera. Optionally, the position of the camera on the mobile phone may be front-located or rear-located, which is not limited in this embodiment of the present application.
Optionally, the mobile phone may include a single camera, a dual camera, or a triple camera, which is not limited in this embodiment.
For example, a cell phone may include three cameras, one being a main camera, one being a wide camera, and one being a tele camera.
Optionally, when the mobile phone includes a plurality of cameras, all the cameras may be arranged in front of the mobile phone, or all the cameras may be arranged in back of the mobile phone, or a part of the cameras may be arranged in front of the mobile phone, and another part of the cameras may be arranged in back of the mobile phone, which is not limited in this embodiment of the present application.
In addition, although not shown, the mobile phone may further include a bluetooth module, etc., which will not be described herein.
The following embodiments may be implemented on a mobile phone having the above hardware structure. The following embodiments will describe a high-frequency IP address obtaining method provided in the embodiments of the present application, taking a mobile phone as an example.
Referring to fig. 2, a high-frequency IP address obtaining method in a first embodiment of the present invention is shown, by way of example and not limitation, the method may be applied to the mobile phone, where the mobile phone may implement the method through software and/or hardware, and the high-frequency IP address obtaining method specifically includes steps S01-S05.
Step S01, acquiring a network packet that satisfies a preset condition, and extracting an IP address from the network packet.
The preset conditions may include, but are not limited to, a protocol, a length, a size, a process to which the data belongs, and the like, that is, the network data packet meeting the specific conditions is screened out by setting conditions such as the protocol, the length, the size, the process to which the data belongs, and the like. After the network data packet is obtained, the network data packet is analyzed to obtain the IP address corresponding to the network data.
In specific implementation, terminal devices such as a mobile phone and the like can screen received network data packets in real time or at regular time through preset conditions such as a protocol, a length, a size, a process to which data belongs and the like, so as to screen out the network data packets meeting specific conditions at present and analyze the IP addresses of the network data packets.
Step S02, determining whether the IP address is in the first IP address queue.
When the IP address is judged to be in the first IP address queue, executing the step S04; when it is determined that the IP address is not in the first IP address queue, step S03 is performed.
Step S03, add the IP address to the first IP address queue.
Step S04, removing the IP address from the first IP address queue, and determining whether the IP address is in a second IP address queue. Wherein, when the IP address is not in the second IP address queue, step S05 is executed.
The first IP address queue is preferably a fixed-length queue, that is, only a fixed number of IP addresses can be arranged in the first IP address queue, for example, when the fixed length is 10, at most 10 IP addresses are arranged in the first IP address queue.
It should be noted that, in step S04, after the IP address is removed from the first IP address queue, the queue position occupied by the IP address in the first IP address queue will be marked as a vacant position, and the subsequent IP address (the IP address newly obtained in step S01) can be added to the vacant position in the first IP address queue, when there is no vacant position in the first IP address queue, the IP address can be added to the tail of the first IP address queue, and since the first IP address queue is a fixed-length queue, after the IP address is added to the tail of the first IP address queue, the queue length of the first IP address queue will exceed the fixed length, and at this time, the IP address at the head of the first IP address queue can be removed;
as another implementation manner, no matter whether the first IP address queue has a vacancy or not, the subsequent IP address can be added to the tail of the first IP address queue, so that the IP addresses in the first IP address queue are arranged according to the chronological order, and the removed head-of-queue IP address is the IP address obtained most recently in the current queue.
Based on step S02-step S04, in this embodiment, the same IP address needs to hit the first IP address queue 2 times in sequence before entering the determination link of the second IP address queue. For example, when the target IP address a is extracted, if the target IP address a does not exist in the first IP address queue, the target IP address a is added to the first IP address queue, and then when the target IP address a is extracted again, if the target IP address a in the first IP address queue is not removed, the target IP address a is removed from the first IP address queue, and the process enters a determination link of the second IP address queue; and if a long period of time passes, the target IP address A is extracted again, and the target IP address A is removed finally because the target IP address A is gradually moved to the head of the first IP address queue, and at the moment, the target IP address A does not exist in the first IP address queue and is added into the first IP address queue.
Step S05, add the IP address to the second IP address queue, and determine the IP address as a newly added high-frequency IP address.
When the step S04 determines that the IP address is in the second IP address queue, it represents that the IP address has been previously determined as a high-frequency IP address and does not belong to a newly added high-frequency IP address. When the step S04 determines that the IP address is not in the second IP address queue, which represents that the IP address has not been determined as a high-frequency IP address before, the IP address is added to the second IP address queue, and the IP address is determined as a new high-frequency IP address. Of course, the present invention is not limited to this, and in some alternative embodiments, the high-frequency IP address screened out by the first IP address queue may also not be judged by the second IP address queue, that is, after the IP address is removed from the first IP address queue, the IP address is directly added to the second IP address queue, and the IP address is determined as the new high-frequency IP address. Similarly, the second IP address queue is also preferably a fixed-length queue, that is, only a fixed number of IP addresses can be arranged in the second IP address queue, for example, when the fixed length is 10, a maximum of 10 IP addresses are arranged in the second IP address queue. In specific implementation, when it is determined in step S04 that the IP address is not in the second IP address queue, the IP address may be added to the tail of the second IP address queue, and if the queue length of the second IP address queue exceeds the fixed length, the IP address at the head of the second IP address queue may be removed; because the newly-increased high-frequency IP addresses determined each time are arranged at the tail of the queue, the high-frequency IP addresses in the second IP address queue are arranged according to the chronological order, and the removed first-queue IP address is the most previously determined high-frequency IP address in the current queue.
In summary, in the method for obtaining a high-frequency IP address in the above embodiment of the present invention, the preset condition, the first IP address queue and the second IP address queue are set to screen the IP address step by step, and only if three preset conditions that the data satisfies the preset condition, the IP address is in the first IP address queue, and the IP address is not in the second IP address queue are simultaneously satisfied, the new high-frequency IP address is determined, so that the high-frequency IP address can be obtained from a large amount of network data, and thus, the subsequent device can only process and optimize the data corresponding to the high-frequency IP address, thereby avoiding waste of resources.
Referring to fig. 3, a high-frequency IP address obtaining method in a second embodiment of the present invention is shown, by way of example and not limitation, the method may be applied to the mobile phone, where the mobile phone may implement the method through software and/or hardware, and the method specifically includes steps S11 to S17.
Step S11, screening out network packets meeting specific conditions according to a preset protocol, length, size, and process to which the data belongs, and extracting an IP address from the network packets.
In specific implementation, terminal devices such as a mobile phone and the like can screen received network data packets in real time or at regular time through preset conditions such as a protocol, a length, a size, a process to which data belongs and the like, so as to screen out the network data packets meeting specific conditions at present and analyze the IP addresses of the network data packets.
Step S12, determining whether the IP address is in the first IP address queue.
When the step S12 judges that the IP address is not in the first IP address queue, executing a step S13; when it is determined at step S12 that the IP address is in the first IP address queue, step S14 is performed.
Step S13, add the IP address to the first IP address queue.
Wherein, step S13 specifically includes:
judging whether a vacancy exists in the first IP address queue or not;
if yes, adding the IP address into a vacancy of the first IP address queue;
and if not, adding the IP address to the tail of the first IP address queue.
In some optional embodiments, when the first IP address queue is a fixed-length queue, after the step of adding the IP address to the end of the first IP address queue, the method may further comprise:
and removing the head-of-line IP address of the first IP address queue. Because only a fixed number of IP addresses can be arranged in the first IP address queue, under the condition that the IP addresses are full, a new IP address is added to the tail of the first IP address queue, the IP address at the head of the first IP address queue is removed, the removing process actually moves the whole IP address queue forward by one bit, no vacancy is generated, and after the IP address at the head of the queue is removed, the IP address originally arranged at the second position is changed into the IP address at the head of the queue.
And step S14, judging whether the occurrence frequency of the IP address reaches the preset frequency.
When the step S14 determines that the occurrence number of the IP address reaches a preset number, step S15 is executed; and when the step S14 determines that the occurrence frequency of the IP address does not reach the preset frequency, not performing the action or returning to execute the step S11 to extract a new IP address for analysis.
Specifically, the preset times are more than or equal to 2, that is, the same IP address needs to hit the first IP address queue for at least 2 times in sequence, and then the judgment link of the second IP address queue can be entered. For example, assuming that the preset number of times is 3, when the target IP address a is extracted, the target IP address a does not exist in the first IP address queue, the target IP address a is added to the first IP address queue, and then the target IP address a needs to be extracted twice in sequence, and both the two times need to satisfy that the target IP address a is not removed in the first IP address queue, the target IP address a is removed from the first IP address queue and enters a determination link of the second IP address queue, so that a screening threshold of the first IP address queue is increased, and a screening threshold of the high-frequency IP address is increased.
In specific implementation, the preset times can be set according to the screening requirement of the high-frequency IP address, and the higher the preset times is, the higher the appearance frequency of the screened high-frequency IP address is.
Step S15, removing the IP address from the first IP address queue, and determining whether the IP address is in a second IP address queue. And clearing the occurrence times of the IP addresses after the IP addresses are removed from the first IP address queue.
When the step S15 judges that the IP address is in the second IP address queue, executing a step S17; when it is determined at step S15 that the IP address is not in the second IP address queue, step S16 is performed.
And step S16, adding the IP address into the second IP address queue, determining the IP address as a newly added high-frequency IP address, and reporting the newly added high-frequency IP address.
Specifically, in step S16, the step of adding the IP address to the second IP address queue specifically includes:
adding the IP address to the tail of the second IP address queue.
Wherein the second IP address queue is a fixed-length queue, and after the step of adding the IP address to the tail of the second IP address queue, the method further includes:
judging whether the queue length of the second IP address queue exceeds a fixed length;
and if so, removing the head of queue IP address of the second IP address queue and reporting. Because only a fixed number of IP addresses can be arranged in the second IP address queue, under the condition that the IP addresses are full, a new high-frequency IP address is added to the tail of the second IP address queue, the head IP address of the second IP address queue is removed, the removing process actually moves the whole IP address queue forward by one bit, no vacancy is generated, and after the head IP address is removed, the original IP address arranged on the second bit is changed into the head IP address of the queue. Because the head-of-line IP address is the high-frequency IP address determined before, the head-of-line IP address is deleted and then reported, the processor of the terminal equipment such as a mobile phone and the like can timely know the deleted high-frequency IP address, the processing optimization action of the deleted high-frequency IP address can be timely stopped, and the resource waste of the processor can be further avoided.
And step S17, moving the IP address to the tail of the second IP address queue, and not reporting any message.
It can be understood that, when the step S15 determines that the IP address is in the second IP address queue, the IP address represents that the IP address has been previously determined as a high-frequency IP address, and does not belong to a newly added high-frequency IP address, no message is reported, so that the processor of the terminal device, such as a mobile phone, keeps processing optimization on the existing determined high-frequency IP address. At the same time, the purpose of moving the IP address to the end of the second IP address queue is to always queue the newly determined high-frequency IP address at the end of the second IP address queue, so that the removed high-frequency IP address is always the previously determined high-frequency IP address.
The IP address moving process in step S17 specifically includes: for example, when the target IP address a is at the second position of the second IP address queue, the target IP address a is moved from the second position to the tail of the queue, the IP address originally located at the third position rises to the second position, and so on, and no vacancy is generated in the moving process.
Referring to fig. 4, a high-frequency IP address obtaining method in a third embodiment of the present invention is shown, by way of example and not limitation, the method may be applied to the mobile phone, where the mobile phone may implement the method through software and/or hardware, and the method specifically includes steps S21 to S27.
Step S21, acquiring a network packet that satisfies a preset condition, and extracting an IP address from the network packet.
Step S22, determining whether the IP address is in the second IP address queue.
When the step S22 judges that the IP address is in the second IP address queue, executing a step S23; when it is determined at step S22 that the IP address is not in the second IP address queue, step S24 is performed.
And step S23, moving the IP address to the tail of the second IP address queue, and not reporting any message.
Step S24, determining whether the IP address is in the first IP address queue.
When the step S24 judges that the IP address is not in the first IP address queue, executing a step S25; when it is determined at step S24 that the IP address is in the first IP address queue, steps S26-S27 are performed.
Step S25, add the IP address to the first IP address queue.
Step S26, removing the IP address from the first IP address queue.
Step S27, add the IP address to the second IP address queue, and determine the IP address as a newly added high-frequency IP address.
It should be noted that, for specific implementation processes, actions, and effects of each step in this embodiment, reference may be made to corresponding contents in the first embodiment and the second embodiment, and details are not described herein again.
Compared with the first embodiment and the second embodiment, the method and the device have the advantages that after the IP address is extracted from the network data packet, whether the IP address is in the second IP address queue is judged, and if the IP address is in the second IP address queue, the screening of the first IP address queue is directly skipped, so that the screening of the IP address is accelerated, the processor resource is saved, and the acquisition efficiency of the high-frequency IP address is improved.
Another aspect of the present invention further provides a high-frequency IP address obtaining apparatus, please refer to fig. 5, which shows the high-frequency IP address obtaining apparatus in a fourth embodiment of the present invention, by way of example and not limitation, the apparatus may be applied to the mobile phone, and the apparatus may specifically be a processor of the mobile phone, and the apparatus specifically includes:
the address extraction module 11 is configured to acquire a network data packet that meets a preset condition, and extract an IP address from the network data packet;
a first judging module 12, configured to judge whether the IP address is in a first IP address queue;
the first processing module 13 is configured to, when it is determined that the IP address is not in the first IP address queue, add the IP address to the first IP address queue;
an address removing module 14, configured to remove the IP address from the first IP address queue when it is determined that the IP address is in the first IP address queue;
and the second processing module 15 is configured to add the IP address to the second IP address queue, and determine the IP address as a newly added high-frequency IP address.
Further, in some optional embodiments of the present invention, the high frequency IP address obtaining apparatus may further include:
the second judging module is used for judging whether the IP address is in the second IP address queue or not after the IP address is removed from the first IP address queue; if the IP address is not in the second IP address queue, the second processing module 15 adds the IP address to the second IP address queue, and determines the IP address as a newly added high-frequency IP address.
Further, in some optional embodiments of the present invention, the high frequency IP address obtaining apparatus may further include:
a third judging module, configured to judge whether the IP address is in the second IP address queue before the step of judging whether the IP address is in the first IP address queue; if the IP address is not in the second IP address queue, the first determining module 12 determines whether the IP address is in the first IP address queue.
Further, in some optional embodiments of the present invention, the high frequency IP address obtaining apparatus may further include:
and the IP moving module is used for moving the IP address to the tail of the second IP address queue when the IP address is judged to be in the second IP address queue.
Further, in some optional embodiments of the present invention, the high frequency IP address obtaining apparatus may further include:
the frequency judging module is used for judging whether the occurrence frequency of the IP address reaches a preset frequency or not;
when the number judging module judges that the occurrence number of the IP address reaches a preset number, the address removing module 14 removes the IP address from the first IP address queue.
Further, in some optional embodiments of the present invention, the first processing module 13 may include:
the vacancy judging unit is used for judging whether a vacancy exists in the first IP address queue or not;
a first adding unit, configured to add the IP address to a vacancy of the first IP address queue when it is determined that the vacancy exists in the first IP address queue; and
and the second adding unit is used for adding the IP address to the tail of the first IP address queue when judging that no vacancy exists in the first IP address queue.
Further, in some optional embodiments of the present invention, the first IP address queue is a fixed-length queue, and the first processing module 13 may further include:
and the removing unit is used for removing the head of queue IP address of the first IP address queue.
Further, in some optional embodiments of the present invention, the high frequency IP address obtaining apparatus may further include:
and the information reporting module is used for reporting the newly added high-frequency IP address.
Further, in some optional embodiments of the present invention, the second processing module 15 may include:
and the third adding unit is used for adding the IP address to the tail of the second IP address queue.
Further, in some optional embodiments of the present invention, the second IP address queue is a fixed-length queue, and the second processing module 15 may further include:
the length judging unit is used for judging whether the queue length of the second IP address queue exceeds a fixed length;
and the removal reporting unit is used for removing and reporting the head IP address of the second IP address queue when the queue length of the second IP address queue is judged to exceed the fixed length.
The functions or operation steps of the modules and units when executed are substantially the same as those of the method embodiments, and are not described herein again.
In summary, in the high-frequency IP address obtaining apparatus in the above embodiment of the present invention, the preset condition, the first IP address queue and the second IP address queue are set to screen the IP addresses step by step, and only if three preset conditions that the data satisfies the preset condition, the IP address is in the first IP address queue, and the IP address is not in the second IP address queue are simultaneously satisfied, the new high-frequency IP address is determined, so that the high-frequency IP address can be obtained from a large amount of network data, and thus, the subsequent device can only process and optimize the data corresponding to the high-frequency IP address, thereby avoiding waste of resources.
Referring to fig. 6, a terminal device according to a fifth embodiment of the present invention is shown, which includes a memory 120, a processor 180, and a computer program 30 stored in the memory and executable on the processor, where the processor 180 implements the above-mentioned high-frequency IP address obtaining method when executing the program 30.
The processor 180 may be a Central Processing Unit (CPU), a controller, a microcontroller, a microprocessor or other data Processing chip in some embodiments, and is configured to execute program codes stored in the memory 120 or process data, such as executing an access restriction program.
The memory 120 includes at least one type of readable storage medium, which includes flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, and the like. The memory 120 may in some embodiments be an internal storage unit of the terminal device, e.g. a hard disk of the terminal device. The memory 120 may also be an external storage device of the terminal device in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the terminal device. Further, the memory 120 may also include both an internal storage unit and an external storage device of the terminal apparatus. The memory 120 may be used not only to store application software installed in the terminal device and various types of data, but also to temporarily store data that has been output or will be output.
It should be noted that the configuration shown in fig. 6 does not constitute a limitation of the terminal device, and in other embodiments, the terminal device may include fewer or more components than those shown, or some components may be combined, or a different arrangement of components may be used.
In summary, in the terminal device in the above embodiments of the present invention, the preset condition, the first IP address queue and the second IP address queue are set to screen the IP addresses step by step, and only if three setting conditions that the data meets the preset condition, the IP address is in the first IP address queue, and the IP address is not in the second IP address queue are simultaneously met, the new high-frequency IP address is determined, so that the high-frequency IP address can be obtained from a large amount of network data, and thus, the subsequent device can only process and optimize the data corresponding to the high-frequency IP address, thereby avoiding waste of resources.
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the high-frequency IP address obtaining method as described above.
Those of skill in the art will understand that the logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be viewed as implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (13)

1. A high-frequency IP address acquisition method is characterized by comprising the following steps:
acquiring a network data packet meeting preset conditions, and extracting an IP address from the network data packet;
judging whether the IP address is in a first IP address queue or not;
if the IP address is not in the first IP address queue, adding the IP address into the first IP address queue;
if the IP address is in the first IP address queue, removing the IP address from the first IP address queue;
and adding the IP address into a second IP address queue, and determining the IP address as a newly added high-frequency IP address.
2. The method according to claim 1, further comprising, after the step of removing the IP address from the first IP address queue:
judging whether the IP address is in the second IP address queue or not;
and if the IP address is not in the second IP address queue, adding the IP address into the second IP address queue, and determining the IP address as a newly added high-frequency IP address.
3. The method according to claim 1, further comprising, before the step of determining whether the IP address is in the first IP address queue:
judging whether the IP address is in the second IP address queue or not;
and if the IP address is not in the second IP address queue, executing the step of judging whether the IP address is in the first IP address queue.
4. The method according to claim 2 or 3, wherein the step of determining whether the IP address is in the second IP address queue further comprises:
and if the IP address is in the second IP address queue, moving the IP address to the tail of the second IP address queue.
5. The method according to claim 1, further comprising, before the step of removing the IP address from the first IP address queue:
judging whether the occurrence frequency of the IP address reaches a preset frequency or not;
and if so, executing the step of removing the IP address from the first IP address queue.
6. The method according to claim 1, wherein the step of adding the IP address to the first IP address queue comprises:
judging whether a vacancy exists in the first IP address queue or not;
if yes, adding the IP address into a vacancy of the first IP address queue;
and if not, adding the IP address to the tail of the first IP address queue.
7. The method according to claim 6, wherein the first IP address queue is a fixed-length queue, and after the step of adding the IP address to the end of the first IP address queue, the method further comprises:
and removing the head-of-line IP address of the first IP address queue.
8. The method for obtaining a high-frequency IP address according to claim 1, further comprising, after the step of determining the IP address as the newly added high-frequency IP address:
and reporting the newly added high-frequency IP address.
9. The method according to claim 1, wherein the step of adding the IP address to the second IP address queue comprises:
adding the IP address to the tail of the second IP address queue.
10. The method according to claim 9, wherein the second IP address queue is a fixed-length queue, and after the step of adding the IP address to the end of the second IP address queue, the method further comprises:
judging whether the queue length of the second IP address queue exceeds a fixed length;
and if so, removing the head of queue IP address of the second IP address queue and reporting.
11. A high frequency IP address acquisition apparatus, the apparatus comprising:
the device comprises an address extraction module, a network data packet processing module and a data transmission module, wherein the address extraction module is used for acquiring the network data packet meeting preset conditions and extracting an IP address from the network data packet;
the first judgment module is used for judging whether the IP address is in a first IP address queue or not;
the first processing module is used for adding the IP address to the first IP address queue when the IP address is judged not to be in the first IP address queue;
the queue removing module is used for removing the IP address from the first IP address queue when the IP address is judged to be in the first IP address queue;
and the second processing module is used for adding the IP address into a second IP address queue and determining the IP address as a newly added high-frequency IP address.
12. A computer-readable storage medium on which a computer program is stored, the program, when being executed by a processor, implementing the high frequency IP address acquisition method according to any one of claims 1 to 10.
13. A terminal device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the high frequency IP address acquisition method according to any one of claims 1 to 10 when executing the program.
CN202010568647.XA 2020-06-19 2020-06-19 High-frequency IP address acquisition method, system, storage medium and terminal equipment Pending CN111741142A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010568647.XA CN111741142A (en) 2020-06-19 2020-06-19 High-frequency IP address acquisition method, system, storage medium and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010568647.XA CN111741142A (en) 2020-06-19 2020-06-19 High-frequency IP address acquisition method, system, storage medium and terminal equipment

Publications (1)

Publication Number Publication Date
CN111741142A true CN111741142A (en) 2020-10-02

Family

ID=72651855

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010568647.XA Pending CN111741142A (en) 2020-06-19 2020-06-19 High-frequency IP address acquisition method, system, storage medium and terminal equipment

Country Status (1)

Country Link
CN (1) CN111741142A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160248879A1 (en) * 2012-02-02 2016-08-25 Comcast Cable Communications, Llc Content Distribution Network Supporting Popularity-Based Caching
CN106569962A (en) * 2016-10-19 2017-04-19 暨南大学 Identification method of hot data based on temporal locality enhancement
CN107347052A (en) * 2016-05-05 2017-11-14 阿里巴巴集团控股有限公司 The method and device of storehouse attack is hit in detection
CN109587156A (en) * 2018-12-17 2019-04-05 广州天懋信息系统股份有限公司 Abnormal network access connection identification and blocking-up method, system, medium and equipment
CN110417801A (en) * 2019-08-06 2019-11-05 北京智维盈讯网络科技有限公司 Server-side recognition methods and device, equipment and storage medium
US20200026663A1 (en) * 2018-07-20 2020-01-23 EMC IP Holding Company LLC Method, device and computer program product for managing storage system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160248879A1 (en) * 2012-02-02 2016-08-25 Comcast Cable Communications, Llc Content Distribution Network Supporting Popularity-Based Caching
CN107347052A (en) * 2016-05-05 2017-11-14 阿里巴巴集团控股有限公司 The method and device of storehouse attack is hit in detection
CN106569962A (en) * 2016-10-19 2017-04-19 暨南大学 Identification method of hot data based on temporal locality enhancement
US20200026663A1 (en) * 2018-07-20 2020-01-23 EMC IP Holding Company LLC Method, device and computer program product for managing storage system
CN109587156A (en) * 2018-12-17 2019-04-05 广州天懋信息系统股份有限公司 Abnormal network access connection identification and blocking-up method, system, medium and equipment
CN110417801A (en) * 2019-08-06 2019-11-05 北京智维盈讯网络科技有限公司 Server-side recognition methods and device, equipment and storage medium

Similar Documents

Publication Publication Date Title
KR101978590B1 (en) Message updating method, device and terminal
CN106293901B (en) Process management method and device for terminal application
CN108834132B (en) Data transmission method and equipment and related medium product
WO2015043403A1 (en) Method, apparatus, and terminal for obtaining video data
CN106302808A (en) Data transmission method and mobile terminal
CN107612643B (en) Channel detection method and channel detection equipment
CN109714476B (en) Data processing method and device, mobile terminal and storage medium
CN110705497A (en) Image frame processing method and device, terminal equipment and computer readable storage medium
CN109688611B (en) Frequency band parameter configuration method, device, terminal and storage medium
CN110100424B (en) Streaming media data processing method and mobile terminal
US11150913B2 (en) Method, device, and terminal for accelerating startup of application
CN106851784B (en) network scanning method and terminal equipment
CN106815078B (en) Memory control method and equipment
CN106844057B (en) Data processing method and device and mobile terminal
CN109034812A (en) A kind of method of payment and device based on automobile leasing
CN110602766B (en) Personal hotspot identification method and method for determining association relationship between terminals
CN107894958B (en) Junk information cleaning method, terminal, server and computer readable storage medium
CN108804434B (en) Message query method, server and terminal equipment
CN106777383B (en) File sorting method and intelligent terminal
CN106815077B (en) Data processing method based on intelligent device architecture and intelligent device
CN109286571A (en) The method, apparatus and storage device of mobile terminal and application program limit core and limit net
CN106339402B (en) Method, device and system for pushing recommended content
CN111741142A (en) High-frequency IP address acquisition method, system, storage medium and terminal equipment
CN111314900B (en) Wireless connection method, wireless connection device and mobile terminal
CN104461485A (en) Window coloring method and user equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20201002

RJ01 Rejection of invention patent application after publication