Request processing method and device, electronic equipment and storage medium

By identifying and intercepting malicious network requests, it solves the problem of network attacks such as DDoS attacks and improves the stability of network services and user experience.

CN118784254APending Publication Date: 2024-10-15TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202310368772.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-03
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

Existing technologies are difficult to effectively identify and intercept malicious network requests, resulting in network attacks such as DDoS attacks paralyzing network services and affecting user experience and business operations.

Method used

By obtaining the network address of the request to be identified, the preset rules are used to determine the index value of the malicious request network address, and a target address list is constructed. If there is a network address of the request to be identified, the request is intercepted to achieve accurate interception of malicious requests.

Benefits of technology

It improves the efficiency of malicious request identification and interception, reduces data processing time and storage space requirements, and ensures the stability of network services and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118784254A_ABST
    Figure CN118784254A_ABST
Patent Text Reader

Abstract

The invention discloses a request processing method and device, electronic equipment and a storage medium, and the method comprises the steps: intercepting a to-be-recognized request if a network address of the to-be-recognized request exists in a target address list; the method for acquiring the target network address in the target address list comprises the following steps: acquiring a malicious request network address in a target time period; determining an index value corresponding to the malicious request network address from respective preset index value sets according to a plurality of different preset rules; determining the occurrence frequency of each index value corresponding to the malicious request network address according to the occurrence frequency of the malicious request network address in the target time period; and obtaining a target network address from the malicious request network address according to the occurrence frequency of each index value corresponding to the malicious request network address. When the target network address is determined, only less storage space and data processing time are consumed, the acquisition efficiency of the target network address is improved, and accurate interception of the malicious request can be realized by setting the target network address list.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electronic information technology, and more specifically, to a request processing method, device, electronic device and storage medium. Background Art

[0002] With the development of Internet technology, users can access various types of servers through requests, and the servers process the user's requests to meet the user's needs. For example, a user can access an online shopping mall through an access request to view the required products, and a user can pay medical expenses through a payment request.

[0003] However, criminals can launch network attacks by sending access requests to the server, which will cause serious losses to the server and the users who use the server. For example, a distributed denial of service (DDoS, DDoS attack is a more serious network attack behavior, which uses a large number of zombie machines to attack a server or system at the same time, making the attacked system unable to support normal business access due to bandwidth congestion or server resource exhaustion) attack to attack the online shopping mall, causing the online shopping mall to be paralyzed, the online shopping mall cannot operate, and users cannot shop.

[0004] Therefore, it is particularly important to identify requests as malicious requests and intercept malicious requests. Summary of the invention

[0005] In view of this, embodiments of the present application propose a request processing method, device, electronic device, and storage medium.

[0006] In the first aspect, an embodiment of the present application provides a request processing method, the method comprising: in response to receiving a request to be identified, obtaining the network address of the request to be identified; querying the network address of the request to be identified in a target address list; the target address list includes at least one target network address, and the method for obtaining the target network address comprises: obtaining the malicious request network address within a target time period and the number of occurrences of the malicious request network address within the target time period; determining the index value corresponding to the malicious request network address from respective preset index value sets according to multiple different preset rules, and each index value in each preset index value set is different; determining the number of occurrences of each index value corresponding to the malicious request network address according to the number of occurrences of the malicious request network address within the target time period; obtaining the target network address from the malicious request network address according to the number of occurrences of each index value corresponding to the malicious request network address; if the network address of the request to be identified exists in the target address list, intercepting the request to be identified.

[0007] In a second aspect, an embodiment of the present application provides a request processing device, the device comprising: a response module, for obtaining a network address of a request to be identified in response to receiving a request to be identified; a query module, for querying the network address of the request to be identified in a target address list; the target address list includes at least one target network address, and a method for obtaining the target network address comprises: obtaining a malicious request network address within a target time period and the number of occurrences of the malicious request network address within the target time period; determining an index value corresponding to the malicious request network address from respective preset index value sets according to a plurality of different preset rules, wherein each index value in each preset index value set is different; determining the number of occurrences of each index value corresponding to the malicious request network address according to the number of occurrences of the malicious request network address within the target time period; obtaining the target network address from the malicious request network address according to the number of occurrences of each index value corresponding to the malicious request network address; an interception module, for intercepting the request to be identified if the network address of the request to be identified exists in the target address list.

[0008] Optionally, the target time period includes multiple sub-time periods; the device also includes a list acquisition module, which is used to obtain the number of occurrences of each index value corresponding to the initial network address, the initial network address refers to the malicious request network address that appears in the target sub-time period, and the target sub-time period is any one of the multiple sub-time periods; according to the number of occurrences of each index value corresponding to the initial network address, the target number of times corresponding to the initial network address is determined; according to the target number of times corresponding to each initial network address, a target minimum heap corresponding to the target sub-time period is constructed, each node in the target minimum heap corresponds to a malicious request network address, and the node value of each node in the target minimum heap represents the abnormality of the malicious request network address corresponding to each node in the target minimum heap within the target sub-time period; according to the target minimum heap corresponding to each sub-time period, the target network address is determined.

[0009] Optionally, multiple sub-periods are arranged in order; the list acquisition module is also used to construct an initial minimum heap corresponding to the target sub-period according to the target number of times corresponding to the initial network address if the target sub-period is the first sub-period among the multiple sub-periods; the initial minimum heap includes nodes corresponding to each initial network address, and the node value of each node in the initial minimum heap is the target number of times the initial network address corresponding to each node in the initial minimum heap exists in the target sub-period; a first number of nodes are selected from the initial minimum heap in descending order of node value as selected nodes corresponding to the target sub-period; and a target minimum heap for the target sub-period is constructed according to the selected nodes and the node values ​​of the selected nodes.

[0010] Optionally, multiple sub-periods are arranged in order; the list acquisition module is also used to replace the node value of the matching node according to the sum of the node value of the matching node and the target number of times of the first network address if the target sub-period is not the first sub-period among the multiple sub-periods, so as to obtain an updated matching node; the matching node refers to the node corresponding to the initial network address in the target minimum heap corresponding to the previous sub-period of the target sub-period; the first network address refers to the initial network address corresponding to the matching node; according to the second network address and the target number of times of the second network address, a new node is constructed; the second network address is the initial network address excluding the first network address; according to the updated matching node, the new node and the original node, a minimum heap is constructed as the initial minimum heap corresponding to the target sub-period, and the original node refers to the node excluding the matching node in the target minimum heap corresponding to the previous sub-period of the target sub-period; according to the node value from high to low, a first number of nodes are selected from the initial minimum heap corresponding to the target sub-period as the selected nodes corresponding to the target sub-period; according to the selected node and the node value of the selected node, a target minimum heap of the target sub-period is constructed.

[0011] Optionally, the list acquisition module is further used to determine the target network address according to the node value of each node in the target minimum heap corresponding to the last sub-period in the multiple sub-periods.

[0012] Optionally, the target minimum heap corresponding to the last sub-period includes the target minimum heaps corresponding to each of the multiple address management tasks in the last sub-period; the list acquisition module is also used to sort each node in the multiple target minimum heaps in the last sub-period according to the node value of each node in the multiple target minimum heaps in the last sub-period to obtain a node sequence; obtain a second number of nodes from the node sequence in descending order of node value as target nodes; obtain the malicious request network address corresponding to the target node as the target network address.

[0013] Optionally, the initial network address includes at least one; the list acquisition module is also used to, if the target index value corresponds to an initial network address, obtain the number of occurrences of the initial network address corresponding to the target index value in the target sub-period as the number of occurrences of the target index value, the target index value refers to the index value corresponding to the initial network address in the preset index value set corresponding to multiple preset rules; if the target index value corresponds to multiple initial network addresses, obtain the sum of the number of occurrences of the multiple initial network addresses corresponding to the target index value in the target sub-period as the number of occurrences of the target index value.

[0014] Optionally, the list acquisition module is further used to obtain the minimum value of the number of occurrences of each index value corresponding to the initial network address as the target number corresponding to the initial network address.

[0015] Optionally, the list acquisition module is also used to obtain a request log corresponding to a target time period, the request log including a malicious request network address; construct a key-value pair corresponding to the malicious request network address based on the request log, the key of the key-value pair being the malicious request network address, and the value of the key-value pair being the number of times the malicious request network address in the request log sends requests; add the key-value pair to a message queue; in response to obtaining the key-value pair from the message queue, obtain the key in the key-value pair as the malicious request network address, and obtain the value of the key-value pair as the number of times the malicious request network address appears in the target time period.

[0016] Optionally, the key-value pair includes key-value pairs corresponding to multiple collection tasks; the list acquisition module is also used to send the key-value pairs corresponding to the multiple collection tasks to the message queue, so that the message queue performs target processing on the key-value pairs corresponding to the multiple collection tasks to obtain a final key-value pair; the target processing means that if the key of the key-value pair is not unique among the key-value pairs corresponding to the multiple collection tasks, the keys of the multiple key-value pairs with the same key are obtained as the keys of the final key-value pairs corresponding to the multiple key-value pairs with the same key, and the sum of the values ​​of the multiple key-value pairs with the same key is calculated as the value of the final key-value pair corresponding to the multiple key-value pairs with the same key, if the key of the key-value pair is unique among the key-value pairs corresponding to the multiple collection tasks, the key-value pair is obtained as the final key-value pair; in response to obtaining the final key-value pair from the message queue, the key of the final key-value pair is obtained as the malicious request network address, and the value of the final key-value pair is obtained as the number of occurrences of the malicious request network address within the target time period.

[0017] Optionally, the list acquisition module is also used to obtain the request log within the target time period, and the request log includes the network address of each request and the error code information of each request; if the error code information of the request meets the preset conditions, the network address of sending the request is obtained as the malicious request network address.

[0018] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory; one or more programs are stored in the memory and configured to be executed by the processor to implement the above method.

[0019] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a program code is stored, wherein the above method is executed when the program code is executed by a processor.

[0020] In a fifth aspect, an embodiment of the present application provides a computer program product or a computer program, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs the above method.

[0021] The embodiments of the present application provide a request processing method, device, electronic device and storage medium. In the present application, the index value corresponding to the malicious request network address is determined by different preset rules, and a large number of malicious request network addresses are represented by a small number of index values, thereby reducing the amount of data. Therefore, when the target network address is determined by the number of occurrences of each index value corresponding to the malicious request network address, only less storage space and data processing time are consumed, thereby improving the efficiency of obtaining the target network address. At the same time, if the network address of the request to be identified exists in the target address list, the request to be identified is determined to be a malicious request, and the malicious request is intercepted, thereby achieving accurate interception of malicious requests. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0023] Figure 1 A schematic diagram showing an application scenario to which the embodiments of the present application are applicable;

[0024] Figure 2 A flowchart of a request processing method proposed in one embodiment of the present application is shown;

[0025] Figure 3 A schematic diagram showing a preset index value set in an embodiment of the present application is shown;

[0026] Figure 4 A schematic diagram showing another preset index value set in an embodiment of the present application is shown;

[0027] Figure 5 A flowchart of a request processing method proposed in another embodiment of the present application is shown;

[0028] Figure 6 A schematic diagram of the structure of a target minimum heap in an embodiment of the present application is shown;

[0029] Figure 7 A schematic diagram of the structure of another target minimum heap in an embodiment of the present application is shown;

[0030] Figure 8 A flowchart of a request processing method proposed in another embodiment of the present application is shown;

[0031] Fig. 9 A schematic diagram of the structure of another target minimum heap in an embodiment of the present application is shown;

[0032] Fig.10A flowchart of a request processing method proposed in another embodiment of the present application is shown;

[0033] Fig.11 A schematic diagram showing a process of obtaining a target address list in the present application;

[0034] Fig.12 A schematic diagram showing an interception process of a request to be identified in an embodiment of the present application is shown;

[0035] Fig.13 A schematic diagram showing a recording process of a request log in an embodiment of the present application is shown;

[0036] Fig.14 Shown according to Fig.13 The schematic diagram of the process of obtaining the target IP from the request log shown;

[0037] Fig.15 Shown according to Fig.13 The schematic diagram of the target IP interception process of the request to be identified is shown;

[0038] Fig.16 A block diagram of a request processing device proposed in one embodiment of the present application is shown;

[0039] Fig.17 A structural block diagram of an electronic device for executing a request processing method according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0040] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. According to the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0041] In the following description, the terms "first\second" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0043] It should be noted that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0044] It should also be noted that in the embodiments of the present application, the acquisition of information such as the user's job type, education level, age, life stage (for example, whether married), work location, and favorite products requires the user's permission or consent, and the collection, use, processing, and storage of information such as the user's job type, education level, age, life stage (for example, whether married), work location, and favorite products must comply with the regulations of the region where the user is located.

[0045] Currently, malicious requests can be analyzed through Hadoop's map-reduce batch framework or Flink stream processing framework, and then the analysis results are fed back to the real-time system, which then intercepts them. However, Hadoop's map-reduce batch framework or Flink stream processing framework uses MapReduce's data batch processing mode and the distributed file system HDFS, which makes it take a lot of time for Hadoop's map-reduce batch framework or Flink stream processing framework to read (read from the distributed file system HDFS) and analyze malicious requests, making the efficiency of obtaining analysis results low and difficult to achieve real-time interception of malicious requests.

[0046] Therefore, a request processing method of the present application is proposed, in which the index value corresponding to the malicious request network address is determined through different preset rules, and a large number of malicious request network addresses are represented by a small number of index values, thereby reducing the amount of data. Therefore, when the target network address is determined by the number of occurrences of each index value corresponding to the malicious request network address, only less storage space and data processing time are consumed, thereby improving the efficiency of obtaining the target network address. At the same time, if the network address of the request to be identified exists in the target address list, the request to be identified is determined to be a malicious request, and the malicious request is intercepted, thereby achieving accurate interception of malicious requests.

[0047] like Figure 1 As shown, exemplarily, the application scenarios applicable to the embodiments of the present application may include a terminal 10, a gateway 20, a log collector 30, a message queue 40, a message consumer 50, a list storage 60, a risk control interception service 70 and a server 80. The terminal 10, the gateway 20, the log collector 30, the message queue 40, the message consumer 50, the list storage 60, the risk control interception service 70 and the server 80 are connected through a wired network or a wireless network.

[0048] Terminal 10 can be a smart phone, tablet computer, laptop computer, desktop computer, smart home appliance, vehicle-mounted terminal, aircraft, wearable device terminal, virtual reality device and other terminal devices that can display pages, or run other applications that can call page display applications (such as instant messaging applications, shopping applications, search applications, game applications, forum applications, map and transportation applications, etc.).

[0049] The gateway 20 may be a router for forwarding and managing requests from the terminal 10. The gateway 20 may be an API gateway, an API management tool between the client and the backend service set. The API gateway is equivalent to a reverse proxy, which is used to accept all application programming interface (API) calls, integrate and process the various services required for these calls, and return the corresponding results).

[0050] The log collector 30 can store the request forwarded by the gateway 20 as a request log. The log collector 30 can be a network storage or a local storage. The log collector 30 can also perform statistical processing on the network addresses in the request log to obtain the number of occurrences of each network address. Among them, one user or one local area network can correspond to one log collector 30, and one log collector 30 is used to implement one collection task. The log collector 30 can also construct the network address and the number of occurrences of the network address in the request log as a key-value pair (the key is the network address, and the value is the number of occurrences of the network address).

[0051] The message queue 40 is used to receive each key-value pair sent by each log collector 30, and merge each key-value pair sent by each log collector 30 to obtain a final key-value pair. The message queue 40 can be Kafka, ActiveMQ, RabbitMQ, RocketMQ, etc.

[0052] The message consumer 50 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart home appliance, a vehicle-mounted terminal, an aircraft, a wearable device terminal, etc. The message consumer 50 can also be an independent physical server, a server cluster or a distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.

[0053] As an implementation method, the message consumer 50 can be a built-in functional module of the terminal 10. The terminal 10 obtains the final key-value pair from the message queue, and obtains the target address list based on the final key-value pair, and the terminal 10 directly stores the target address list.

[0054] Alternatively, the message consumer 50 can be a built-in functional module of the server 80, which obtains the final key-value pair from the message queue and obtains the target address list based on the final key-value pair. The server 80 sends the target address list to the terminal 10, and the terminal 10 directly stores the target address list.

[0055] The message consumer 50 can obtain the final key-value pair from the message queue, determine the target network address based on the final key-value pair, and then obtain the target address list based on the target network address. The message consumer 50 may include multiple message consumers, each message consumer 50 obtains a target address list, and one message consumer 50 is used to implement an address management task.

[0056] The list storage 60 may be an independent storage, for example, the list storage is TableKv, which is a high-performance storage component. The list storage 60 may obtain the target address lists of each message consumer 50, merge each target address list, obtain the final target address list, and store the final target address list.

[0057] The risk control interception service 70 may be a service component for triggering request interception, which may be a functional module built into the gateway 20, a functional module built into the server 80, or an independent device or equipment.

[0058] The server 80 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The server 80 may be used to provide services for the terminal 10 to complete the request of the terminal 10.

[0059] The terminal 10 can generate a request to be identified in response to the user's operation and send the request to be identified to the gateway 20. The gateway 20 queries the risk control interception service 70 for a target address list. The risk control interception service 70 obtains the final target address list from the list storage and sends the final target address list to the gateway 20. The gateway 20 determines whether to intercept the request to be identified based on the final target address list.

[0060] If the gateway 20 finds that the final target address list contains a network address of the request to be identified, the gateway 20 intercepts the request to be identified.

[0061] If the final target address list is queried and the network address of the request to be identified does not exist, the gateway 20 forwards the request to be identified to the server 80, and the server 80 processes the request to be identified.

[0062] As another implementation, the gateway 20, the list storage 60 and the risk control interception service 70 can be functional modules integrated within the terminal 10, that is, after each message consumer 50 obtains its own target address list, it returns the target address list to the terminal 10, and the terminal 10 merges the target address lists to obtain the final target address list. When the terminal 10 sends a request to be identified, the terminal first obtains the final target address list and queries whether the network address of the request to be identified is in the final target address list. If so, the terminal 10 intercepts the request to be identified. If not, the terminal 10 sends the request to be identified to the server 80.

[0063] For the convenience of description, in the following embodiments, the request processing is performed by an electronic device as an example.

[0064] See also Figure 2 , Figure 2 A flowchart of a request processing method proposed in an embodiment of the present application is shown. The method can be applied to an electronic device. The method includes:

[0065] S110 . In response to receiving the request to be identified, obtaining a network address of the request to be identified.

[0066] A request operation may be sent to an electronic device, and the electronic device obtains a request to be identified based on the request operation. For example, a web page access operation may be sent to the electronic device, and the request to be identified obtained by the electronic device based on the web page browsing operation is a web page access request. In another example, a payment operation may be sent to the electronic device, and the request to be identified obtained by the electronic device based on the payment operation is a payment request. In another example, a download operation may be sent to the electronic device, and the request to be identified obtained by the electronic device based on the download operation is a download request.

[0067] When the electronic device sends a request to be identified, the network address of the electronic device is the network address of the request to be identified. A virtual network address can be set in the electronic device, and the request to be identified is sent through the virtual network address. In this case, the network address of the request to be identified refers to the virtual network address that sends the request to be identified.

[0068] The network address may refer to an IP address (Internet Protocol Address) of the electronic device, and the IP address of the electronic device may be a virtual IP address or an actual IP address of the electronic device.

[0069] S120. Search a target address list for a network address of a request to be identified, where the target address list includes at least one target network address.

[0070] Among them, the method for obtaining the target network address includes: obtaining the malicious request network address within the target time period and the number of occurrences of the malicious request network address within the target time period; determining the index value corresponding to the malicious request network address from respective preset index value sets according to multiple different preset rules, and each index value in each preset index value set is different; determining the number of occurrences of each index value corresponding to the malicious request network address according to the number of occurrences of the malicious request network address within the target time period; and obtaining the target network address from the malicious request network address according to the number of occurrences of each index value corresponding to the malicious request network address.

[0071] The target time period may refer to a time period with a fixed duration set based on demand, and the target time period may include multiple times. The target time period may refer to a specific time period every day, for example, the target time period is 9:00-10:00 and 11:00-12:00.

[0072] In one embodiment, the target time period may also refer to the time period before the time period of the current time when the request to be identified is received. For example, if the 24 hours of a day are divided into one time period per hour, and the time when the request to be identified is received is 12:12, then the target time period may refer to 11:00-12:00.

[0073] In another embodiment, a fixed time period before the moment when the request to be identified is received is used as a target time period. For example, the fixed time period is 1 hour, and the moment when the request to be identified is received is 12:12, the target time period may refer to 11:12 to 12:12.

[0074] The network address of the request sent during the target time period can be obtained, and the network address of the request sent during the target time period can be analyzed to determine the network address of the malicious request during the target time period. Specifically, the request log during the target time period can be obtained, and the request log includes the network address of each request and the error code information of each request; if the error code information of the request meets the preset conditions, it is determined that the request sent is a malicious request, and the network address of the request sent is obtained as the network address of the malicious request.

[0075] After the electronic device sends a request, the sent request can be recorded to obtain a request log. The request log may include the network address where the electronic device sends the request, the specific content of the request sent by the electronic device, and the error code information of each request.

[0076] For example, the request log is as follows:

[0077] 2023 / 02 / 23 10:47:02[error]12228#12228:*103037directory index of" / var / www / html / "is forbidden,client:185.180.143.140,server:qq.com,request:"GET / HTTP / 1.1",host:"173.82.182.5"error_code:270306352.

[0078] The preset condition may refer to the error code information (error_code) being 270306352. When the error code information of the request meets the preset condition, the request is determined to be an illegal request, and the network address of the illegal request is directly used as the malicious request network address. Then, the number of occurrences of the malicious request network address within the target time period can be counted according to the request log.

[0079] The preset rule may refer to a rule for encoding a malicious request network address, and the preset rule may be a hash function. Each preset rule corresponds to its own preset index value set, and each index value in each preset index value set is different. The same index value may exist in different preset index value sets. For example, the preset index value set corresponding to preset rule 1 is {a, b, c, d}, and the preset index value set corresponding to preset rule 2 is {a, e, f, g}.

[0080] The malicious request network address is encoded by each preset rule to obtain an encoding result, which is an index value in the preset index value set corresponding to the preset rule. For example, the preset index value set corresponding to preset rule 1 is {a, b, c, d}, and the malicious request network address is encoded by preset rule 1, and the encoding result can be any one of a, b, c and d.

[0081] For each preset rule, encode the malicious request network address through the preset rule to obtain the corresponding index value, and traverse all the preset rules to obtain the index values ​​corresponding to the malicious request network address. For example, the preset rules include preset rule 1, preset rule 2 and preset rule 3. The preset index value set corresponding to preset rule 1 is {a, b, c, d}, the preset index value set corresponding to preset rule 2 is {a, e, f, g}, and the preset index value set corresponding to preset rule 3 is {a, f, h, j}. Encode the malicious request network address through preset rule 1, and the index value obtained is a. Encode the malicious request network address through preset rule 2, and the index value obtained is e. Encode the malicious request network address through preset rule 3, and the index value obtained is h. At this time, it is determined that the index values ​​of the malicious request network address are a, e and h respectively.

[0082] The number of occurrences of the malicious request network address in the target time period may refer to the number of requests sent through the malicious request network address in the target time period.

[0083] As an implementation method, for each index value in the preset index value set corresponding to the preset rule, if the index value corresponds to only one malicious request network address, the number of occurrences of the malicious request network address corresponding to the index value in the target time period can be used as the number of occurrences of the index value. For each index value in the preset index value set corresponding to the preset rule, if the index value corresponds to only multiple malicious request network addresses, the number of occurrences of the multiple malicious request network addresses corresponding to the index value in the target time period can be summed up as the number of occurrences of the index value.

[0084] For example, the preset index value set corresponding to preset rule 1 is {a,b,c,d}, the preset index value set corresponding to preset rule 2 is {a,e,f,g}, and the preset index value set corresponding to preset rule 3 is {a,f,h,j}. The index values ​​of malicious request network address 1 are a, e, and h, and the number of occurrences of malicious request network address 1 in the target time period is 20. The index values ​​of malicious request network address 2 are b, e, and f, and the number of occurrences of malicious request network address 2 in the target time period is 30. For preset rule 1: the number of occurrences of index value a is 20, and the number of occurrences of index value b is 30; for preset rule 2: the number of occurrences of index value e is 50, and for preset rule 3: the number of occurrences of index value h is 20, and the number of occurrences of index value f is 30. At this time, the number of occurrences of index value a corresponding to malicious request network address 1 is 20, the number of occurrences of index value e is 50, and the number of occurrences of index value h is 20. The number of occurrences of index value b corresponding to malicious request network address 2 is 30, the number of occurrences of index value e is 50, and the number of occurrences of index value f is 30.

[0085] For each malicious request network address, after determining the number of occurrences of each index value of the malicious request network address according to the above method, the target network address is obtained from the malicious request network address according to the number of occurrences of each index value corresponding to the malicious request network address. As an implementation method, the minimum value of the number of occurrences of each index value corresponding to the malicious request network address can be directly used as the statistical number of the malicious request network address, and multiple malicious request network addresses can be selected from high to low according to the statistical number as the target network address.

[0086] For example, Figure 3As shown, the preset rules include h0, h1, h2, h3 and h4. The preset index value set of each preset rule includes 5 different index values. The five squares in a row corresponding to each preset rule represent the respective index values ​​in the preset index value set corresponding to the preset rule. The value in each square is the number of occurrences of the index value corresponding to the square. At this time, no malicious request network address has been received, and the number of occurrences of the index values ​​is 0.

[0087] The malicious request network address is "192.196.0.1", and the number of occurrences of the malicious request network address "192.196.0.1" is 3. The malicious request network address "192.196.0.1" is encoded by h0, h1, h2, h3 and h4 respectively, and the index values ​​of the network address to be encoded "192.196.0.1" are h01 (representing the first index value from left to right among the 5 index values ​​corresponding to h0), h11 (representing the first index value from left to right among the 5 index values ​​corresponding to h1), h23 (representing the third index value from left to right among the 5 index values ​​corresponding to h2), h35 (representing the fifth index value from left to right among the 5 index values ​​corresponding to h3) and h44 (representing the fourth index value from left to right among the 5 index values ​​corresponding to h4). At this time, the number of occurrences of each index value is as follows: Figure 4 As shown in a in .

[0088] After that, another malicious request network address "74.45.10.1" is obtained, and the number of occurrences of the malicious request network address "74.45.10.1" is 2. The malicious request network address "74.45.10.1" is encoded by h0, h1, h2, h3 and h4 respectively, and the index values ​​of the network address to be encoded "74.45.10.1" are h02, h11, h23, h35 and h43 respectively. At this time, the number of occurrences of each index value is as follows Figure 4 As shown in b, the number of occurrences of h11, h23 and h35 accumulates the number of occurrences of the malicious request network address "74.45.10.1" and the malicious request network address "192.196.0.1".

[0089] At this time, the index values ​​h01, h11, h23, h35 and h44 corresponding to the malicious request network address "192.196.0.1" appear 3, 5, 5, 5 and 3 respectively, and the index values ​​h02, h11, h23, h35 and h43 corresponding to the malicious request network address "192.196.0.1" appear 2, 5, 5, 5 and 2 respectively.

[0090] The statistical number of malicious request network address "192.196.0.1" obtained is 3, the minimum value of 3 among 3, 5, 5, 5 and 3, and the statistical number of malicious request network address "74.45.10.1" obtained is 2, the minimum value of 2 among 2, 5, 5, 5 and 2.

[0091] As described above, after obtaining the statistical number of malicious request network addresses, multiple malicious request network addresses are screened as target network addresses according to the statistical number from high to low. It can be understood that the higher the statistical number, the higher the frequency of the malicious request network address appearing in the target time period, the more frequently the malicious request network address sends requests, the threat exists in the malicious request network address, and the higher the possibility that the request sent by the malicious request network address is a malicious request. Therefore, multiple malicious request network addresses are screened as target network addresses according to the statistical number from high to low, so that the possibility that the screened target network address is the network address that sends malicious requests is very high, and the accuracy of the target network address is extremely high.

[0092] After screening out each target network address, the target network addresses are summarized into a table to obtain a target address list, and the target address list is stored so that when a request to be identified is obtained, the network address of the request to be identified can be queried from the stored target address list.

[0093] Optionally, the time period in which the request to be identified is received is different, and the corresponding target time period is also different. The target address list for each target time period can be obtained as the target address list in the next target time period, and used to analyze the request to be identified in the next target time period. For example, if the target time period is 10 o'clock to 11 o'clock, the target address list of the target time period 10 o'clock to 11 o'clock can be used for analyzing the request to be identified between 11 o'clock and 12 o'clock.

[0094] In another embodiment, the target address list of the current time period can be merged into the previous multiple target address lists, and the merged target address list is used as the target address list of a target time period after the current time period. For example, 24 hours a day is divided into 24 target time periods, and the target address list corresponding to the target time period 11:00-12:00 can be merged into the target address list of the 11 target time periods corresponding to 1-11 to obtain the merged target address list, and the merged target address list can be used for the target time period 12:00-13:00.

[0095] S130: If the network address of the request to be identified exists in the target address list, intercept the request to be identified.

[0096] If the network address of the request to be identified exists in the target address list, it is determined that the network address of the request to be identified is a threat, and the request to be identified is directly intercepted. If the network address of the request to be identified does not exist in the target address list, it is determined that the network address of the request to be identified is not a threat, and the request to be identified can be sent to the corresponding server, and the corresponding server further processes the request to be identified. For example, the server completes payment processing according to the payment request, the server completes the search service according to the search request, and the server sends multimedia files according to the download request.

[0097] In this embodiment, the index value corresponding to the malicious request network address is determined by different preset rules, and a large number of malicious request network addresses are represented by a small number of index values, thereby reducing the amount of data. Therefore, when the target network address is determined by the number of occurrences of each index value corresponding to the malicious request network address, only less storage space and data processing time are consumed, thereby improving the efficiency of obtaining the target network address. At the same time, if the network address of the request to be identified exists in the target address list, the request to be identified is determined to be a malicious request, and the malicious request is intercepted, thereby achieving accurate interception of malicious requests.

[0098] See also Figure 5 , Figure 5 A flowchart of a request processing method proposed in an embodiment of the present application is shown. The method can be applied to an electronic device. The method includes:

[0099] S210: Obtain the number of occurrences of each index value corresponding to the initial network address.

[0100] In this embodiment, the target period is divided into multiple sub-periods, the target sub-period is any one of the multiple sub-periods, and the initial network address refers to the malicious request network address that appears in the target sub-period.

[0101] For example, the target time period is 11:00-12:00, each minute is divided into a sub-time period, the target time period is divided into 60 sub-time periods, and the number of malicious request network addresses within the target time period is 800. Among them, the 20 malicious request network addresses that appear in the target sub-time period of 11:11-11:12 are used as the initial network addresses of the target sub-time period of 11:11-11:12.

[0102] Among them, the initial network address can be encoded through the above-mentioned multiple preset rules to obtain each index value corresponding to each initial network address. The encoding process refers to the description of the encoding process of the malicious request network address in S120 and will not be repeated here.

[0103] If the target index value corresponds to an initial network address, the number of occurrences of the initial network address corresponding to the target index value in the target sub-time period is obtained as the number of occurrences of the target index value. The target index value refers to the index value corresponding to the initial network address in the preset index value set corresponding to multiple preset rules.

[0104] For example, the preset rules include preset rule 1 and preset rule 2. The preset index value set corresponding to preset rule 1 is {a, b, c, d}, and the preset index value set corresponding to preset rule 2 is {a, e, f, g}. The index value after encoding the initial network address in pre-made rule 1 is c, and index value c is used as a target index value. The index value after encoding the initial network address in pre-made rule 2 is g, and index value g is used as a target index value. The number of times the initial network address appears in the target sub-period from 11:11 to 11:12 is 20, the number of times the target index value c appears in the target sub-period from 11:11 to 11:12 is 20, and the number of times the target index value g appears is 20. At this time, the number of times the index value c corresponding to the initial network address appears is 20, and the number of times the index value g appears is 20.

[0105] As another implementation, if the target index value corresponds to multiple initial network addresses, the sum of the number of occurrences of the multiple initial network addresses corresponding to the target index value in the target sub-period is obtained as the number of occurrences of the target index value.

[0106] For example, the preset index value set corresponding to preset rule 1 is {a, b, c, d}, the preset index value set corresponding to preset rule 2 is {a, e, f, g}, the index value after the initial network address 1 is encoded by pre-made rule 1 is c, and the index value c is used as a target index value, the index value after the initial network address 1 is encoded by pre-made rule 2 is g, and the index value g is used as a target index value, the index value after the initial network address 2 is encoded by pre-made rule 1 is d, and the index value d is used as a target index value, and the index value after the initial network address 2 is g. The number of occurrences of initial network address 1 in the target sub-period from 11:11 to 11:12 is 20, and the number of occurrences of initial network address 2 in the target sub-period from 11:11 to 11:12 is 30. At this time, it is determined that the number of occurrences of the target index value c in the target sub-period from 11:11 to 11:12 is 20, the number of occurrences of the target index value g is 50, and the number of occurrences of the target index value d is 20. At this time, it is determined that the number of occurrences of the index value c corresponding to the initial network address 1 is 20 and the number of occurrences of g is 50, and the number of occurrences of the index value d corresponding to the initial network address 2 is 30 and the number of occurrences of g is 50.

[0107] It is understandable that the process of determining the number of occurrences of an index value is also called the Count-min Sketch algorithm. The Count-min Sketch algorithm is a probabilistic data structure used as a frequency table of events in a data stream. It uses a hash function to map events to frequencies, and uses very little data (index values) to describe the characteristics of all data (all malicious request network addresses), sacrificing accuracy but making resource consumption very low.

[0108] S220: Determine a target number of times corresponding to the initial network address according to the number of occurrences of each index value corresponding to the initial network address.

[0109] If the number of occurrences of each index value corresponding to the initial network address is the same, the number of occurrences of any index value corresponding to the initial network address is obtained as the target number corresponding to the initial network address; if the number of occurrences of each index value corresponding to the initial network address is not exactly the same, the minimum value of the number of occurrences of each index value corresponding to the initial network address is obtained as the target number corresponding to the initial network address.

[0110] For example, determine that the number of occurrences of the index value c corresponding to the initial network address 1 is 20 and the number of occurrences of g is 50, the number of occurrences of the index value d corresponding to the initial network address 2 is 30 and the number of occurrences of g is 50, obtain the number of occurrences of the index value c corresponding to the initial network address 1 as the target number of times for the initial network address 1 - 20, obtain the number of occurrences of the index value d corresponding to the initial network address 2 as the target number of times for the initial network address 2 - 30.

[0111] S230. Construct a target minimum heap corresponding to the target sub-period according to the target times corresponding to each initial network address.

[0112] Among them, each node in the target minimum heap corresponds to a malicious request network address, and the node value of each node in the target minimum heap represents the abnormality of the malicious request network address corresponding to each node in the target minimum heap in the target sub-period. The higher the node value of the node, the higher the abnormality of the malicious request network address corresponding to the node in the target sub-period.

[0113] As an implementation method, a minimum heap can be constructed as the target minimum heap corresponding to the target sub-period according to the target number of times corresponding to the initial network address in the target sub-period, and all sub-periods can be traversed to obtain the target minimum heap of each sub-period. A minimum heap is a sorted complete binary tree in which the data value of any non-terminal node is not greater than the value of its left child node and right child node, and the key value of the root node is the smallest of all heap node key values.

[0114] For example, the target number corresponding to the initial network address 1 is 1000, the target number corresponding to the initial network address 2 is 1100, and the target number corresponding to the initial network address 3 is 1200. A minimum heap is constructed based on the three initial network addresses as the target minimum heap. The target minimum heap is as follows: Figure 6 As shown, the target minimum heap includes three nodes c1, c2 and c3, where the numbers in the brackets of the nodes represent the node values ​​of the nodes, c1 corresponds to the initial network address 1, and the node value of c1 is 1000, c2 corresponds to the initial network address 2, and the node value of c1 is 1100, and c3 corresponds to the initial network address 3, and the node value of c3 is 1200.

[0115] As another implementation, multiple sub-periods corresponding to the target time period are arranged in order (for example, the time order of each sub-period). If the target sub-period is the first sub-period, the target number of times corresponding to the initial network address can be used as the node value of the node to construct a minimum heap as the target minimum heap.

[0116] In addition, if the target sub-period is not the first sub-period, the target number of times corresponding to the initial network address can be used as the node value of the node, a minimum heap can be constructed as an intermediate minimum heap, and the intermediate minimum heap can be merged with the target minimum heap of the previous sub-period of the target sub-period to obtain the minimum heap of the target period. Merging the intermediate minimum heap with the target minimum heap of the previous sub-period of the target sub-period can mean adding the node values ​​of the nodes representing the same network address and retaining the nodes corresponding to the different malicious request network addresses.

[0117] For example, Figure 7 As shown in a in , the target minimum heap of the previous sub-period of the target sub-period includes three nodes: node b1 corresponding to network address a1, node b2 corresponding to network address a2, and node b3 corresponding to network address a3, where the value in the bracket of each node is the node value of the node. Figure 7 As shown in b in the figure, the intermediate minimum heap of the target sub-period includes three nodes: node b4 corresponding to network address a1, node b5 corresponding to network address a4, and node b7 corresponding to network address a5. At this time, the target minimum heap of the merged target sub-period is as follows: Figure 7 As shown in c, the target minimum heap of the target sub-period includes five nodes: node b1 corresponding to network address a1, node b2 corresponding to network address a2, node b3 corresponding to network address a3, node b5 corresponding to network address a4, and node b7 corresponding to network address a5.

[0118] S240 , determining a target network address according to the target minimum heap corresponding to each sub-period, and constructing a target address list according to the target network address.

[0119] In one embodiment, a minimum heap can be constructed according to the target number of times corresponding to the initial network address in the target sub-period as the target minimum heap corresponding to the target sub-period, and all sub-periods are traversed to obtain the target minimum heaps of each sub-period, and then the target minimum heaps of each sub-period are merged into one minimum heap (the merging process is referred to in Figure 7 As shown, no further details are given), a final minimum heap is obtained, and then a fixed number of nodes are screened from the final minimum heap according to the node value from high to low as the target node, and the malicious request network address corresponding to the target node is used as the target network address.

[0120] In another embodiment, multiple sub-periods corresponding to the target time period are arranged in order (for example, the time order of each sub-period), and the target number of times corresponding to the initial network address can be used as the node value of the node, and a minimum heap is constructed as an intermediate minimum heap, and the intermediate minimum heap is merged with the target minimum heap of the previous sub-period of the target sub-period to obtain the target minimum heap of the target time period, and then the target minimum heap of the last sub-period in the multiple sub-periods is selected as the final minimum heap, and then a fixed number of nodes are screened from the final minimum heap according to the node value from high to low as the target node, and the malicious request network address corresponding to the target node is used as the target network address.

[0121] After obtaining the target network addresses, the target network addresses are summarized to obtain a target address list.

[0122] S250, in response to receiving the request to be identified, obtaining the network address of the request to be identified; searching the target address list for the network address of the request to be identified; if the network address of the request to be identified exists in the target address list, intercepting the request to be identified.

[0123] The description of S250 refers to the description of S110 to S130 above, which will not be repeated here.

[0124] In this embodiment, the target number of times corresponding to the initial network address is determined by the number of occurrences of each index value corresponding to the initial network address, and a large number of malicious request network addresses are represented by a small number of index values, which greatly reduces the amount of data, thereby improving the efficiency of obtaining the target number of times. At the same time, the target minimum heap is constructed by the target number of times corresponding to the initial network address, so that the target minimum heap can accurately represent the number of occurrences of the malicious request network address corresponding to each node of the target minimum heap within the target sub-period, so that the accuracy of the target network address determined according to the target minimum heap is higher, thereby improving the accuracy of request interception.

[0125] See also Figure 8 , Figure 8 A flowchart of a request processing method proposed in an embodiment of the present application is shown. The method can be applied to an electronic device. The method includes:

[0126] S310, obtaining the number of occurrences of each index value corresponding to the initial network address; and determining the target number of occurrences of the initial network address according to the number of occurrences of each index value corresponding to the initial network address.

[0127] The description of S310 refers to the description of S210 to S220 above and will not be repeated here.

[0128] S320. If the target sub-period is the first sub-period among multiple sub-periods, construct an initial minimum heap corresponding to the target sub-period according to the target number of times corresponding to the initial network address; select a first number of nodes from the initial minimum heap according to the node values ​​from high to low as the selected nodes corresponding to the target sub-period; and construct a target minimum heap for the target sub-period according to the selected nodes and the node values ​​of the selected nodes.

[0129] Among them, multiple sub-periods are arranged in order; the target sub-period is any sub-period among the multiple sub-periods; the initial minimum heap corresponding to the target sub-period includes the nodes corresponding to each initial network address, and the node value of each node in the initial minimum heap is the target number of times the initial network address corresponding to each node in the initial minimum heap occurs in the target sub-period.

[0130] For example, the target number corresponding to the initial network address 1 is 1000, the target number corresponding to the initial network address 2 is 1100, and the target number corresponding to the initial network address 3 is 1200. A minimum heap is constructed based on the three initial network addresses as the initial minimum heap. The initial minimum heap includes three nodes k1, k2 and k3. k1 corresponds to the initial network address 1, and the node value of k1 is 1000. k2 corresponds to the initial network address 2, and the node value of k2 is 1100. k3 corresponds to the initial network address 3, and the node value of k3 is 1200.

[0131] The first number may be a number set based on demand, for example, the first number is 3. In the obtained initial minimum heap, a first number of nodes are selected from the initial minimum heap according to the node values ​​from high to low as selected nodes, and a minimum heap is constructed according to the first number of selected nodes as the target minimum heap corresponding to the target sub-period.

[0132] S330. If the target sub-period is not the first sub-period among the multiple sub-periods, replace the node value of the matching node according to the sum of the node value of the matching node and the target number of times of the first network address to obtain an updated matching node; construct a new node according to the second network address and the target number of times of the second network address; construct a minimum heap as the initial minimum heap corresponding to the target sub-period according to the updated matching node, the new node and the original node; select a first number of nodes from the initial minimum heap corresponding to the target sub-period according to the node value from high to low as the selected nodes corresponding to the target sub-period; construct the target minimum heap of the target sub-period according to the selected node and the node value of the selected node.

[0133] Among them, the matching node refers to the node corresponding to the initial network address in the target minimum heap corresponding to the previous sub-period of the target sub-period; the first network address refers to the initial network address corresponding to the matching node; the second network address is the initial network address excluding the first network address; the original node refers to the node excluding the matching node in the target minimum heap corresponding to the previous sub-period of the target sub-period.

[0134] For example, the first number is 3, and the minimum heap corresponding to a sub-period before the target sub-period is as follows: Fig. 9 As shown in a, node k1 (node ​​value is 20) corresponds to network address L1, node k2 (node ​​value is 21) corresponds to network address L2, and node k3 (node ​​value is 18) corresponds to network address L3, and the value in the bracket of the node is the node value. The initial network addresses in the target sub-period include network address L1, network address L4, and network address L5, and the target number of network address L1 is 10, the target number of network address L4 is 11, and the target number of network address L5 is 22.

[0135] The matching network node is determined to be node k1, the original nodes are k2 and k3, the newly added node is node k4 corresponding to network address L4 (node ​​value is 11) and node k5 corresponding to network address L5 (node ​​value is 22), the first network address is determined to be network address L1, and the second network address is network address L4 and network address L5. It can be determined that the node value of the updated matching node k1 is 30. According to the updated matching nodes, the newly added nodes and the original nodes, the initial minimum heap is constructed as follows: Fig. 9 As shown in b.

[0136] According to the node values ​​from high to low, three nodes k1, k2 and k5 are selected from the initial minimum heap corresponding to the target sub-period as selected nodes, and the target minimum heap is constructed according to the selected nodes and the node values ​​of the selected nodes. Fig. 9 As shown in c.

[0137] S340. Sort the nodes in the multiple target minimum heaps in the last sub-period according to the node values ​​of the nodes in the multiple target minimum heaps in the last sub-period to obtain a node sequence; obtain a second number of nodes from the node sequence in descending order of node value as target nodes; obtain the malicious request network address corresponding to the target node as the target network address; and obtain a target address list according to the target network address.

[0138] In this embodiment, there are multiple address management tasks, each of which corresponds to its own target minimum heap in the last sub-period. For example, the address management tasks include 3, and the target minimum heap in the last sub-period includes 3. The second number can be a value set based on demand and can be the same as the first number.

[0139] It should be noted that the malicious request network address in each address management task is different, and the processing process of each malicious request network address is executed by an address management task. That is, if a malicious request network address appears in a certain address management task, the malicious request network address will not appear in other address management tasks.

[0140] Exemplarily, the first number and the second number are both 3, the target minimum heap corresponding to address management task 1 includes 3 nodes m1 (node ​​value is 200), m2 (node ​​value is 210) and m3 (node ​​value is 220), the target minimum heap corresponding to address management task 2 includes 3 nodes m4 (node ​​value is 210), m5 (node ​​value is 230) and m6 (node ​​value is 270), and the target minimum heap corresponding to address management task 3 includes 3 nodes m7 (node ​​value is 250), m8 (node ​​value is 210) and m9 (node ​​value is 190), and the node sequence obtained by sorting according to the node value of each node is {m6, m7, m5, m3, m4, m8, m2, m1, m9}, and the three nodes m6, m7 and m5 are selected from high to low as target nodes according to the node value, and the malicious request network address corresponding to the target node is obtained as the target network address.

[0141] As an implementation method, the initial address list corresponding to the address management task can be obtained based on the target minimum heap of each address management task in the last sub-period, the initial address list including the malicious request network address corresponding to each node of the target minimum heap and the predicted number of occurrences of the malicious request network address (the predicted number of occurrences refers to the node value of the node corresponding to the malicious request network address), and then the initial address lists of each address management task are aggregated to obtain an intermediate address list, and a second number of malicious request network addresses are filtered from high to low according to the predicted number of occurrences in the intermediate address list as target network addresses, and finally a target address list is constructed through the target network address.

[0142] S350, in response to receiving the request to be identified, obtaining the network address of the request to be identified; searching the target address list for the network address of the request to be identified; if the network address of the request to be identified exists in the target address list, intercepting the request to be identified.

[0143] The description of S350 refers to the description of S110 to S130 above, which will not be repeated here.

[0144] In this embodiment, a fixed-size minimum heap is maintained, so that the size of the target minimum heap obtained in each sub-period is smaller, including a smaller amount of data, so that the memory occupancy during the data processing process is lower, and the resource consumption of determining the target network address according to the target minimum heap is reduced, thereby improving the efficiency of obtaining the target network address, and then improving the efficiency of request processing and reducing the cost of request processing.

[0145] See also Fig.10 , Fig.10 A flowchart of a request processing method proposed in an embodiment of the present application is shown. The method can be applied to an electronic device. The method includes:

[0146] S410, obtaining a request log corresponding to a target time period; and constructing a key-value pair corresponding to a malicious request network address according to the request log.

[0147] The request log includes the malicious request network address; the key of the key-value pair is the malicious request network address, and the value of the key-value pair is the number of times the malicious request network address in the request log sends requests.

[0148] For example, the malicious request network address is "192.196.0.1", and the number of occurrences of the malicious request network address in the request log is 50, then the constructed key-value pair is "192.196.0.1":50.

[0149] As an implementation method, the target period can be divided into multiple sub-periods, and the obtained request logs refer to the request logs of each sub-period. In this case, the number of occurrences of the malicious request network address is the number of occurrences of the malicious request network address in each sub-period.

[0150] S420, adding a key-value pair to a message queue; in response to obtaining the key-value pair from the message queue, obtaining the key in the key-value pair as the malicious request network address, and obtaining the value of the key-value pair as the number of occurrences of the malicious request network address in the target time period.

[0151] The key-value pairs can be sent to a message queue, which stores and manages the key-value pairs so that the electronic device can consume the key-value pairs in the message queue to obtain the malicious request network address and the number of occurrences of the malicious request network address within the target time period.

[0152] In one implementation manner, the target period may be divided into a plurality of sub-periods, and in this case, the value in the key-value pair refers to the number of occurrences of the malicious request network address in each sub-period.

[0153] Optionally, in this embodiment, there are multiple collection tasks corresponding to each collection task, and each collection task obtains its own key-value pair; S420 may include: sending the key-value pairs corresponding to the multiple collection tasks to the message queue, so that the message queue performs target processing on the key-value pairs corresponding to the multiple collection tasks to obtain a final key-value pair; target processing means that if the key of the key-value pair is not unique among the key-value pairs corresponding to the multiple collection tasks, obtaining the keys of the multiple key-value pairs with the same key as the key of the final key-value pair corresponding to the multiple key-value pairs with the same key, and calculating the sum of the values ​​of the multiple key-value pairs with the same key as the value of the final key-value pair corresponding to the multiple key-value pairs with the same key, if the key of the key-value pair is unique among the key-value pairs corresponding to the multiple collection tasks, obtaining the key-value pair as the final key-value pair; in response to obtaining the final key-value pair from the message queue, obtaining the key of the final key-value pair as the malicious request network address, and obtaining the value of the final key-value pair as the number of occurrences of the malicious request network address within the target time period.

[0154] For example, collection task 1 includes the key-value pairs "n1:20" and "n2:20", and collection task 2 includes the key-value pairs "n1:14" and "n3:20". It is determined that the key "n1" is not unique, and the key values ​​of multiple key-value pairs corresponding to the non-unique key "n1" (that is, 20 and 14) are merged to obtain the final key-value pair "n1:34" corresponding to the key "n1". At the same time, it is determined that the keys "n2" and "n3" are unique, and the key-value pair "n2:20" corresponding to the unique key "n2" is used as a final key-value pair. Similarly, the key-value pair "n3:20" corresponding to the unique key "n3" is used as a final key-value pair.

[0155] S430: Determine a target network address according to the malicious request network address and the number of occurrences of the malicious request network address in a target time period.

[0156] The description of S430 refers to the description of S210-S240 above, which will not be repeated here.

[0157] S440, in response to receiving the request to be identified, obtaining the network address of the request to be identified; searching the target address list for the network address of the request to be identified; if the network address of the request to be identified exists in the target address list, intercepting the request to be identified.

[0158] The description of S440 refers to the description of S110 to S130 above, which will not be repeated here.

[0159] For example, Fig.11As shown, the users include user 1, user 2 and user 3. User 1, user 2 and user 3 correspond to their own log collectors (each log collector is used to perform a collection task in the above embodiment). User 1 sends a request to the server through IP1, IP2 and IP3. After the gateway receives the request, it determines that the malicious request network address is IP1, IP2 and IP3, and stores IP1, IP2, IP3 and their access times in the request log in the log collector corresponding to user 1. The log collector constructs key-value pairs of "IP1:1", "IP2:1" and "IP3:1" according to the request log. Similarly, user 2 sends two access requests through IP3. After the gateway receives the request, it determines that the malicious request network address is IP3, and stores IP3 and its access times in the request log in the log collector corresponding to user 2. The log collector constructs a key-value pair of "IP3:2" according to the request log. User 3 sends a request to the server through IP2 and IP4. After receiving the request, the gateway determines that the malicious request network address is IP2 and IP4, and stores IP2, IP4 and their access times in the request log in the log collector corresponding to user 3. The log collector constructs key-value pairs "IP2:1" and "IP4:1" based on the request log.

[0160] The log collectors corresponding to user 1, user 2, and user 3 send their respective key-value pairs to the message queue, which receives each key-value pair and constructs the final key-value pairs: "IP1:1", "IP2:2", "IP3:3", and "IP4:1". Afterwards, two different message consumers (each message consumer is used to implement an address management task in the above embodiment) take out different final key-value pairs, determine the malicious request network address and the number of occurrences of the malicious request network address according to the different final key-value pairs, and determine the target network address obtained by each message consumer (each message consumer determines 1 target network address). At this time, the determined target network addresses are IP3 and IP2 respectively.

[0161] IP3 and IP2 are saved as an address list to obtain a target address list, and the target address list is stored in a list memory.

[0162] Continue to refer to Fig.12User 4 sends a request through IP1, user 5 sends a request through IP3, and user 6 sends a request through IP2. After receiving the request, the gateway determines that the requested addresses are IP1, IP2, and IP3 respectively. The gateway sends a query request to the risk control interception service. The risk control interception service obtains the target address list from the list storage according to the query request, where the target address list includes IP2 and IP3. The risk control interception service returns the intercepted IP (that is, IP3 and IP2 in the target address list) to the gateway.

[0163] The gateway determines that the intercepted IPs include IP2 and IP3, but not IP1. The gateway intercepts IP2 and IP3. The gateway intercepts the requests of user 5 and user 6. The gateway does not intercept IP1. The gateway does not intercept the request of user 4. The gateway sends the request of user 4 to the corresponding server.

[0164] In this embodiment, the key-value pairs are obtained according to the request log, and only the malicious request network addresses and their occurrence times are retained, which greatly reduces the amount of data, improves the efficiency of data analysis, and thus improves the efficiency of obtaining the target address list. At the same time, the key-value pairs are processed through the message queue, which realizes the key-value pair diversion processing, solves the problems of application coupling, asynchronous messages, and traffic clipping, thereby reducing the delay in obtaining the target address list.

[0165] In order to more clearly explain the technical solution of the present application, the request processing method of the present application is explained below in conjunction with an exemplary scenario. In this scenario, the request is used to download multimedia files. The scenario includes a user (which may refer to a client used by the user), a gateway, a log collector 1, a log collector 2, a message queue, a message consumer 1, a message consumer 2, storage, a risk control interception service, and a business service (which may refer to a server for downloading multimedia files).

[0166] 1. Obtaining the target address list

[0167] like Fig.13As shown, multiple batch requests are sent: three requests corresponding to IP4 and two requests corresponding to IP5. After receiving the batch requests, the gateway queries the risk control interception service for an IP address list (that is, the target address list in the above embodiment of the present application). The risk control interception service obtains the interception IP list from the list storage and sends the interception address list to the gateway. The gateway determines that IP4 and IP5 are not in the interception IP list. The gateway forwards the requests of IP4 and IP5 to the business service. The business service determines that IP4 and IP5 are illegal requests based on the error code information in the requests of IP4 and IP5. The business service determines that the request fails. The business service returns the request failure information to the gateway. The gateway records the requests of IP4 and IP5 in the request log: the request of IP4 is stored in the request log in the log collector 1, and the request of IP5 is stored in the request log in the log collector 1.

[0168] like Fig.14 As shown, after obtaining the request log, the gateway requests log collector 1 and log collector 2 to read the request log respectively. Log collector 1 summarizes the request log to obtain the key-value pair "IP4:3", and adds the key-value pair "IP4:3" to the message queue. Message consumer 1 takes out the key-value pair "IP4:3" from the message queue, and determines that the target IP (that is, the target network address in the above embodiment) is IP5 according to the key-value pair "IP4:3" and the above count-min sketch algorithm; at the same time, log collector 2 summarizes the request log to obtain the key-value pair "IP5:2", and adds the key-value pair "IP5:2" to the message queue. Message consumer 2 takes out the key-value pair "IP5:2" from the message queue, and determines that the target IP (that is, the target network address in the above embodiment) is IP5 according to the key-value pair "IP5:2" and the above count-minsketch algorithm. Message consumer 1 sends IP4 and its occurrence count to the list storage, and message consumer 2 sends IP5 and its occurrence count to the list storage. The list storage merges the target IPs to obtain a final target IP - IP4, and adds IP4 to the interception IP list.

[0169] like Fig.15 As shown, the user sends a request to be identified through IP4. After receiving the request to be identified, the gateway queries the risk control interception service for the interception IP list. The risk control interception service obtains the interception IP list from the list storage and sends the interception IP list to the gateway. The gateway determines that IP4 is in the interception IP list and intercepts the request.

[0170] In this scenario, a large number of malicious request data can be counted in real time to obtain the target IP, and intercepted according to the target IP to avoid direct requests to the business system, ensure the availability and stability of the business system, and provide the throughput of the business system. At the same time, the count-min sketch algorithm uses only fixed memory to avoid insufficient memory on a single machine due to too many network addresses, resulting in unavailability of risk control interception services, thus ensuring the stability and scalability of the service.

[0171] See also Fig.16 , Fig.16 A block diagram of a request processing device proposed in an embodiment of the present application is shown, and the device 1600 includes:

[0172] A response module 1610 is used for obtaining a network address of the request to be identified in response to receiving the request to be identified;

[0173] A query module 1620 is used to query the network address of the request to be identified in the target address list; the target address list includes at least one target network address, and the method for obtaining the target network address includes: obtaining the malicious request network address within the target time period and the number of occurrences of the malicious request network address within the target time period; determining the index value corresponding to the malicious request network address from respective preset index value sets according to multiple different preset rules, and each index value in each preset index value set is different; determining the number of occurrences of each index value corresponding to the malicious request network address according to the number of occurrences of the malicious request network address within the target time period; and obtaining the target network address from the malicious request network address according to the number of occurrences of each index value corresponding to the malicious request network address;

[0174] The interception module 1630 is used to intercept the request to be identified if the network address of the request to be identified exists in the target address list.

[0175] Optionally, the target time period includes multiple sub-time periods; the device also includes a list acquisition module, which is used to obtain the number of occurrences of each index value corresponding to the initial network address, the initial network address refers to the malicious request network address that appears in the target sub-time period, and the target sub-time period is any one of the multiple sub-time periods; according to the number of occurrences of each index value corresponding to the initial network address, the target number of times corresponding to the initial network address is determined; according to the target number of times corresponding to each initial network address, a target minimum heap corresponding to the target sub-time period is constructed, each node in the target minimum heap corresponds to a malicious request network address, and the node value of each node in the target minimum heap represents the abnormality of the malicious request network address corresponding to each node in the target minimum heap within the target sub-time period; according to the target minimum heap corresponding to each sub-time period, the target network address is determined.

[0176] Optionally, multiple sub-periods are arranged in order; the list acquisition module is also used to construct an initial minimum heap corresponding to the target sub-period according to the target number of times corresponding to the initial network address if the target sub-period is the first sub-period among the multiple sub-periods; the initial minimum heap includes nodes corresponding to each initial network address, and the node value of each node in the initial minimum heap is the target number of times the initial network address corresponding to each node in the initial minimum heap exists in the target sub-period; a first number of nodes are selected from the initial minimum heap in descending order of node value as selected nodes corresponding to the target sub-period; and a target minimum heap for the target sub-period is constructed according to the selected nodes and the node values ​​of the selected nodes.

[0177] Optionally, multiple sub-periods are arranged in order; the list acquisition module is also used to replace the node value of the matching node according to the sum of the node value of the matching node and the target number of times of the first network address if the target sub-period is not the first sub-period among the multiple sub-periods, so as to obtain an updated matching node; the matching node refers to the node corresponding to the initial network address in the target minimum heap corresponding to the previous sub-period of the target sub-period; the first network address refers to the initial network address corresponding to the matching node; according to the second network address and the target number of times of the second network address, a new node is constructed; the second network address is the initial network address excluding the first network address; according to the updated matching node, the new node and the original node, a minimum heap is constructed as the initial minimum heap corresponding to the target sub-period, and the original node refers to the node excluding the matching node in the target minimum heap corresponding to the previous sub-period of the target sub-period; according to the node value from high to low, a first number of nodes are selected from the initial minimum heap corresponding to the target sub-period as the selected nodes corresponding to the target sub-period; according to the selected node and the node value of the selected node, a target minimum heap of the target sub-period is constructed.

[0178] Optionally, the list acquisition module is further used to determine the target network address according to the node value of each node in the target minimum heap corresponding to the last sub-period in the multiple sub-periods.

[0179] Optionally, the target minimum heap corresponding to the last sub-period includes the target minimum heaps corresponding to each of the multiple address management tasks in the last sub-period; the list acquisition module is also used to sort each node in the multiple target minimum heaps in the last sub-period according to the node value of each node in the multiple target minimum heaps in the last sub-period to obtain a node sequence; obtain a second number of nodes from the node sequence in descending order of node value as target nodes; obtain the malicious request network address corresponding to the target node as the target network address.

[0180] Optionally, the initial network address includes at least one; the list acquisition module is also used to, if the target index value corresponds to an initial network address, obtain the number of occurrences of the initial network address corresponding to the target index value in the target sub-period as the number of occurrences of the target index value, the target index value refers to the index value corresponding to the initial network address in the preset index value set corresponding to multiple preset rules; if the target index value corresponds to multiple initial network addresses, obtain the sum of the number of occurrences of the multiple initial network addresses corresponding to the target index value in the target sub-period as the number of occurrences of the target index value.

[0181] Optionally, the list acquisition module is further used to obtain the minimum value of the number of occurrences of each index value corresponding to the initial network address as the target number corresponding to the initial network address.

[0182] Optionally, the list acquisition module is also used to obtain a request log corresponding to a target time period, the request log including a malicious request network address; construct a key-value pair corresponding to the malicious request network address based on the request log, the key of the key-value pair being the malicious request network address, and the value of the key-value pair being the number of times the malicious request network address in the request log sends requests; add the key-value pair to a message queue; in response to obtaining the key-value pair from the message queue, obtain the key in the key-value pair as the malicious request network address, and obtain the value of the key-value pair as the number of times the malicious request network address appears in the target time period.

[0183] Optionally, the key-value pair includes key-value pairs corresponding to multiple collection tasks; the list acquisition module is also used to send the key-value pairs corresponding to the multiple collection tasks to the message queue, so that the message queue performs target processing on the key-value pairs corresponding to the multiple collection tasks to obtain a final key-value pair; the target processing means that if the key of the key-value pair is not unique among the key-value pairs corresponding to the multiple collection tasks, the keys of the multiple key-value pairs with the same key are obtained as the keys of the final key-value pairs corresponding to the multiple key-value pairs with the same key, and the sum of the values ​​of the multiple key-value pairs with the same key is calculated as the value of the final key-value pair corresponding to the multiple key-value pairs with the same key, if the key of the key-value pair is unique among the key-value pairs corresponding to the multiple collection tasks, the key-value pair is obtained as the final key-value pair; in response to obtaining the final key-value pair from the message queue, the key of the final key-value pair is obtained as the malicious request network address, and the value of the final key-value pair is obtained as the number of occurrences of the malicious request network address within the target time period.

[0184] Optionally, the list acquisition module is also used to obtain the request log within the target time period, and the request log includes the network address of each request and the error code information of each request; if the error code information of the request meets the preset conditions, the network address of sending the request is obtained as the malicious request network address.

[0185] It should be noted that the device embodiment in the present application corresponds to the aforementioned method embodiment. The specific principles in the device embodiment can be found in the contents of the aforementioned method embodiment and will not be repeated here.

[0186] Fig.17 A structural block diagram of an electronic device for executing a request processing method according to an embodiment of the present application is shown. The electronic device may be Figure 1 The terminal 20 or the server 10, etc., need to be explained that, Fig.17 The computer system 1200 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0187] like Fig.17 As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1202 or the program loaded from the storage part 1208 to the random access memory (RAM) 1203, such as executing the method in the above embodiment. In RAM 1203, various programs and data required for system operation are also stored. CPU 1201, ROM 1202 and RAM 1203 are connected to each other through bus 1204. Input / output (I / O) interface 1205 is also connected to bus 1204.

[0188] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, etc.; an output section 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the I / O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1210 as needed so that a computer program read therefrom is installed into the storage section 1208 as needed.

[0189] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1209, and / or installed from a removable medium 1211. When the computer program is executed by a central processing unit (CPU) 1201, various functions defined in the system of the present application are executed.

[0190] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0191] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0192] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0193] As another aspect, the present application further provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments; or may exist independently without being assembled into the electronic device. The above computer-readable storage medium carries computer-readable instructions, and when the computer-readable storage instructions are executed by a processor, the method in any of the above embodiments is implemented.

[0194] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the method in any of the above embodiments.

[0195] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0196] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation method of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable an electronic device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation method of the present application.

[0197] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary techniques in the art that are not disclosed in the present application. It should be understood that the present application is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

[0198] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A request processing method, characterized in that: The method comprises: In response to receiving the request to be identified, obtaining a network address of the request to be identified; Query the network address of the request to be identified in the target address list; the target address list includes at least one target network address, and the method for obtaining the target network address includes: obtaining the malicious request network address within a target time period and the number of occurrences of the malicious request network address within the target time period; determining the index value corresponding to the malicious request network address from respective preset index value sets according to a plurality of different preset rules, wherein each index value in each preset index value set is different; determining the number of occurrences of each index value corresponding to the malicious request network address according to the number of occurrences of the malicious request network address within the target time period; obtaining the target network address from the malicious request network address according to the number of occurrences of each index value corresponding to the malicious request network address; If the network address of the request to be identified exists in the target address list, the request to be identified is intercepted.

2. The method according to claim 1, characterized in that The target time period includes a plurality of sub-time periods; and obtaining the target network address from the malicious request network address according to the number of occurrences of each index value corresponding to the malicious request network address includes: Obtaining the number of occurrences of each index value corresponding to the initial network address, wherein the initial network address refers to a malicious request network address that appears in a target sub-period, and the target sub-period is any one of the multiple sub-periods; Determine the target number of times the initial network address corresponds to the initial network address according to the number of occurrences of each index value corresponding to the initial network address; According to the target number of times corresponding to each of the initial network addresses, a target minimum heap corresponding to the target sub-period is constructed, each node in the target minimum heap corresponds to a malicious request network address, and the node value of each node in the target minimum heap represents the abnormality degree of the malicious request network address corresponding to each node in the target minimum heap within the target sub-period; The target network address is determined according to the target minimum heap corresponding to each of the sub-time periods.

3. The method according to claim 2, characterized in that The multiple sub-periods are arranged in order; and the target minimum heap corresponding to the target sub-period is constructed according to the target times corresponding to each of the initial network addresses, including: If the target sub-period is the first sub-period among the multiple sub-periods, construct an initial minimum heap corresponding to the target sub-period according to the target number of times corresponding to the initial network address; the initial minimum heap includes nodes corresponding to each of the initial network addresses, and the node value of each node in the initial minimum heap is the target number of times the initial network address corresponding to each node in the initial minimum heap is within the target sub-period; Selecting a first number of nodes from the initial minimum heap according to the node values ​​from high to low as the selected nodes corresponding to the target sub-period; A target minimum heap of the target sub-period is constructed according to the selected nodes and the node values ​​of the selected nodes.

4. The method according to claim 2, characterized in that: The multiple sub-periods are arranged in order; and the target minimum heap corresponding to the target sub-period is constructed according to the target times corresponding to each of the initial network addresses, including: If the target sub-period is not the first sub-period among the multiple sub-periods, the node value of the matching node is replaced according to the sum of the node value of the matching node and the target number of times of the first network address to obtain an updated matching node; the matching node refers to the node corresponding to the initial network address in the target minimum heap corresponding to the previous sub-period of the target sub-period; the first network address refers to the initial network address corresponding to the matching node; constructing a newly added node according to a second network address and a target number of times of the second network address; the second network address is an initial network address excluding the first network address; According to the updated matching nodes, the newly added nodes and the original nodes, a minimum heap is constructed as an initial minimum heap corresponding to the target sub-period, wherein the original nodes refer to nodes other than the matching nodes in the target minimum heap corresponding to the previous sub-period of the target sub-period; Selecting a first number of nodes from the initial minimum heap corresponding to the target sub-period according to the node values ​​from high to low as the selected nodes corresponding to the target sub-period; A target minimum heap of the target sub-period is constructed according to the selected nodes and the node values ​​of the selected nodes.

5. The method according to claim 4, characterized in that The determining the target network address according to the target minimum heap corresponding to each of the sub-periods includes: The target network address is determined according to the node value of each node in the target minimum heap corresponding to the last sub-period in the multiple sub-periods.

6. The method according to claim 5, characterized in that The target minimum heap corresponding to the last sub-period includes the target minimum heaps corresponding to the plurality of address management tasks in the last sub-period; The determining the target network address according to the node value of each node in the target minimum heap corresponding to the last sub-period in the multiple sub-periods includes: According to the node values ​​of the nodes in the multiple target minimum heaps in the last sub-period, sort the nodes in the multiple target minimum heaps in the last sub-period to obtain a node sequence; Acquire a second number of nodes from the node sequence according to the node values ​​from high to low as target nodes; The malicious request network address corresponding to the target node is obtained as the target network address.

7. The method according to claim 2, characterized in that The initial network address includes at least one; the obtaining the number of occurrences of each index value corresponding to the initial network address includes: If the target index value corresponds to an initial network address, obtaining the number of occurrences of the initial network address corresponding to the target index value in the target sub-period as the number of occurrences of the target index value, wherein the target index value refers to the index value corresponding to the initial network address in the preset index value set corresponding to the multiple preset rules; If the target index value corresponds to multiple initial network addresses, the sum of the number of occurrences of the multiple initial network addresses corresponding to the target index value in the target sub-period is obtained as the number of occurrences of the target index value.

8. The method according to claim 2, characterized in that: The determining, according to the number of occurrences of each index value corresponding to the initial network address, a target number of times corresponding to the initial network address includes: The minimum value of the number of occurrences of each index value corresponding to the initial network address is obtained as the target number of occurrences corresponding to the initial network address.

9. The method according to claim 1, characterized in that: The acquiring of the malicious request network address within the target time period and the number of occurrences of the malicious request network address within the target time period includes: Obtaining a request log corresponding to the target time period, wherein the request log includes the malicious request network address; According to the request log, construct a key-value pair corresponding to the malicious request network address, wherein the key of the key-value pair is the malicious request network address, and the value of the key-value pair is the number of times the malicious request network address in the request log sends requests; Add the key-value pair to the message queue; In response to obtaining the key-value pair from the message queue, a key in the key-value pair is obtained as the malicious request network address, and a value of the key-value pair is obtained as the number of occurrences of the malicious request network address within the target time period.

10. The method according to claim 9, characterized in that The key-value pair includes key-value pairs corresponding to a plurality of collection tasks; the key-value pair is added to a message queue; in response to obtaining the key-value pair from the message queue, a key in the key-value pair is obtained as the malicious request network address, and a value of the key-value pair is obtained as the number of occurrences of the malicious request network address within the target time period, including: The key-value pairs corresponding to the multiple collection tasks are sent to the message queue, so that the message queue performs target processing on the key-value pairs corresponding to the multiple collection tasks to obtain final key-value pairs; the target processing means that if the key of the key-value pair is not unique among the key-value pairs corresponding to the multiple collection tasks, the keys of multiple key-value pairs with the same key are obtained as the keys of the final key-value pairs corresponding to the multiple key-value pairs with the same key, and the sum of the values ​​of the multiple key-value pairs with the same key is calculated as the value of the final key-value pair corresponding to the multiple key-value pairs with the same key; if the key of the key-value pair is unique among the key-value pairs corresponding to the multiple collection tasks, the key-value pair is obtained as the final key-value pair; In response to obtaining a final key-value pair from the message queue, a key of the final key-value pair is obtained as the malicious request network address, and a value of the final key-value pair is obtained as the number of occurrences of the malicious request network address within the target time period.

11. The method according to any one of claims 1 to 10, characterized in that The method for obtaining the malicious request network address includes: Obtaining a request log within a target period, wherein the request log includes a network address of each request and error code information of each request; If the error code information of the request meets a preset condition, the network address for sending the request is obtained as the malicious request network address.

12. A request processing device, characterized in that: The device comprises: A response module, configured to obtain a network address of the request to be identified in response to receiving the request to be identified; A query module, used for querying the network address of the request to be identified in a target address list; the target address list includes at least one target network address, and the method for obtaining the target network address includes: obtaining a malicious request network address within a target time period and the number of occurrences of the malicious request network address within the target time period; determining the index value corresponding to the malicious request network address from respective preset index value sets according to a plurality of different preset rules, wherein each index value in each preset index value set is different; determining the number of occurrences of each index value corresponding to the malicious request network address according to the number of occurrences of the malicious request network address within the target time period; and obtaining the target network address from the malicious request network address according to the number of occurrences of each index value corresponding to the malicious request network address; The interception module is used to intercept the request to be identified if the network address of the request to be identified exists in the target address list.

13. An electronic device, characterized in that: include: one or more processors; Memory; One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1-11.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Lightweight DDoS attack detection device and method on high-speed network

    CN110049061A

  • Call attack detection method and device and readable storage medium

    CN110784460A

  • Access request processing method and device, computer equipment and storage medium

    CN111683144A

  • Large flow detection method and device based on sketch

    CN112671611A

  • Malicious request interception method and device and computer equipment

    CN113259386A