WO2022179120A1 - 网关拦截方法、装置、电子设备及存储介质 - Google Patents

网关拦截方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2022179120A1
WO2022179120A1 PCT/CN2021/123887 CN2021123887W WO2022179120A1 WO 2022179120 A1 WO2022179120 A1 WO 2022179120A1 CN 2021123887 W CN2021123887 W CN 2021123887W WO 2022179120 A1 WO2022179120 A1 WO 2022179120A1
Authority
WO
WIPO (PCT)
Prior art keywords
request
requested
verification
time interval
original service
Prior art date
Application number
PCT/CN2021/123887
Other languages
English (en)
French (fr)
Inventor
张山
Original Assignee
深圳壹账通智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2022179120A1 publication Critical patent/WO2022179120A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/02Network architectures or network communication protocols for network security for separating internal from external traffic, e.g. firewalls
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/02Network architectures or network communication protocols for network security for separating internal from external traffic, e.g. firewalls
    • H04L63/0227Filtering policies
    • H04L63/0236Filtering by address, protocol, port number or service, e.g. IP-address or URL
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • H04L63/101Access control lists [ACL]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3297Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving time stamps, e.g. generation of time stamps

Definitions

  • the present application relates to the field of security protection technologies, and in particular, to a gateway interception method, apparatus, electronic device, and computer-readable storage medium.
  • gateways have become an indispensable module for various companies and projects. Gateways have achieved rapid development in the same request authentication, same request distribution, and unified filtering. The inventor realized that the current gateway's The filtering function refers to the filtering of URLs (web addresses).
  • URLs web addresses.
  • a gateway interception method provided by this application includes:
  • the validity of the request IP is verified, and if it is judged that the request IP is illegal, the original service request is directly intercepted and the corresponding request IP is marked as a malicious IP;
  • the requested IP If it is judged that the requested IP is legal, obtain the timestamp corresponding to the original service request according to the requested IP, and perform access verification on the requested IP according to the timestamp. If the access verification of the requested IP fails, then Directly intercept the original service request and mark the corresponding request IP as malicious IP;
  • the original service request is directly intercepted and the corresponding request IP is marked as malicious IP; if the time interval verification of the requested IP is passed, the original service request release.
  • the present application also provides a gateway interception device, the device comprising:
  • a request parsing module configured to obtain an original service request, and use a preset gateway to parse the original service request to obtain a request IP;
  • the legitimacy verification module is used to perform legitimacy verification on the request IP, and if it is judged that the request IP is illegal, the original service request is directly intercepted and the corresponding request IP is marked as a malicious IP;
  • the access verification module is configured to obtain a timestamp corresponding to the original service request according to the request IP if it is judged that the request IP is legal, and perform access verification on the request IP according to the timestamp, if the request IP is If the access verification fails, then directly intercept the original service request and mark the corresponding request IP as a malicious IP;
  • the time interval judgment module is used to calculate the request time interval by using the timestamp if the access verification of the request IP is successful, and perform time interval verification on the request IP according to the request time interval. If the time interval verification of the requested IP fails, the original service request is directly intercepted and the corresponding request IP is marked as a malicious IP, and if the time interval verification of the requested IP is passed, the original service request is released.
  • the present application also provides an electronic device, the electronic device comprising:
  • the validity of the request IP is verified, and if it is judged that the request IP is illegal, the original service request is directly intercepted and the corresponding request IP is marked as a malicious IP;
  • the requested IP If it is judged that the requested IP is legal, obtain the timestamp corresponding to the original service request according to the requested IP, and perform access verification on the requested IP according to the timestamp. If the access verification of the requested IP fails, then Directly intercept the original service request and mark the corresponding request IP as malicious IP;
  • the original service request is directly intercepted and the corresponding request IP is marked as malicious IP; if the time interval verification of the requested IP is passed, the original service request release.
  • the present application further provides a computer-readable storage medium, where at least one instruction is stored, and the at least one instruction is executed by a processor in an electronic device to implement the following gateway interception method:
  • the validity of the request IP is verified, and if it is judged that the request IP is illegal, the original service request is directly intercepted and the corresponding request IP is marked as a malicious IP;
  • the requested IP If it is judged that the requested IP is legal, obtain the timestamp corresponding to the original service request according to the requested IP, and perform access verification on the requested IP according to the timestamp. If the access verification of the requested IP fails, then Directly intercept the original service request and mark the corresponding request IP as malicious IP;
  • the original service request is directly intercepted and the corresponding request IP is marked as malicious IP; if the time interval verification of the requested IP is passed, the original service request release.
  • FIG. 1 is a schematic flowchart of a gateway interception method provided by an embodiment of the present application
  • Fig. 2 is a detailed implementation flow diagram of one of the steps in Fig. 1;
  • Fig. 3 is the detailed implementation flow schematic diagram of another step in Fig. 1;
  • Fig. 4 is a detailed implementation flow diagram of another step in Fig. 1;
  • Fig. 5 is the detailed implementation flow schematic diagram of another step in Fig. 1;
  • FIG. 6 is a functional block diagram of a gateway interception device provided by an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of an electronic device implementing the gateway interception method according to an embodiment of the present application.
  • the embodiment of the present application provides a gateway interception method.
  • the execution body of the gateway interception method includes, but is not limited to, at least one of electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server and a terminal.
  • the gateway interception method can be executed by software or hardware installed in a terminal device or a server device, and the software can be a blockchain platform.
  • the server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.
  • the gateway interception method includes:
  • the original service request may be an operation service request sent by various fields.
  • the original service request may be a withdrawal request, a deposit request, etc. sent by the client through the client.
  • the preset gateway also known as an internet connector and a protocol converter, is a computer system or device that acts as an important conversion task.
  • the original service request is processed through a preset protocol between different communication protocols, data formats or languages, or even two systems with completely different architectures.
  • the gateway includes three layers: a legality verification layer (the first layer), an access verification layer (the second layer), and a request time verification layer (the third layer).
  • the use of the preset gateway to parse the original service request to obtain the request IP includes:
  • the request IP refers to the IP address of the original service request.
  • the locator refers to a Uniform Resource Locator (URL), which is the address of a standard resource on the Internet.
  • the domain name resolution refers to the use of DNS (DomainNameSystem, Domain Name System) for resolution, and the DNS, as a distributed database that maps domain names and IP addresses to each other, can resolve the domain name in the URL, and search according to the domain name. to the corresponding IP address.
  • the original service request is parsed through a preset gateway, and the IP address of the original service request can be quickly parsed.
  • the validity verification of the request IP includes:
  • S22 is executed to judge the requested IP as legal.
  • the preset blacklist is established at the legitimacy verification layer of the gateway. By verifying the validity of the request IP, the original service request can be effectively intercepted, and the request processing amount can be reduced.
  • S3 is executed to directly intercept the original service request and mark the corresponding requested IP as a malicious IP.
  • perform S4 obtain a timestamp corresponding to the original service request according to the requested IP, and perform access verification on the requested IP according to the timestamp.
  • the access verification layer of the gateway is used to perform access verification on the request IP.
  • the S4 includes:
  • S45 is executed to determine that the access verification of the requested IP is successful.
  • the timestamp refers to the total number of seconds from 00:00:00 on January 01, 1970 Greenwich Mean Time (08:00:00 on January 01, 1970, Beijing time) to the present. That is, a timestamp is a complete and verifiable data that can indicate that a request has existed at a specific point in time.
  • the preset function may be Date.getTime().
  • the access verification layer records the timestamp and the request IP through Redis (RemoteDictionaryServer, remote dictionary service). When the request IP is not the first visit, the request IP and the corresponding time are searched from the Redis. stamp.
  • the time stamps corresponding to the original service request are identical for too many times, it may be a malicious attack request, and a threshold is set to determine whether the original service request is a malicious attack.
  • the preset threshold may be 50, that is, by default, the original service request is intercepted when the number of times of the same timestamp corresponding to the original service request sent by a client is greater than or equal to 50 times.
  • the security is high, so that the interception accuracy of the original service request is high.
  • execute S5 directly intercept the original service request and mark the corresponding requested IP as a malicious IP.
  • perform S6 calculate the request time interval by using the timestamp, and perform time interval verification on the request IP according to the request time interval.
  • the request time verification layer of the gateway is used to perform access verification on the request IP.
  • calculating the request time interval by using the timestamp, and performing time interval verification on the request IP according to the request time interval includes:
  • the timestamp is judged to be linear, and a preset verification method is used to verify the corresponding request IP;
  • the time interval of the request IP is judged to be successful
  • the timestamp is determined to be non-linear, and the time interval verification of the requested IP passes.
  • the preset verification method may be sending a graphic verification code.
  • a graphic verification code is sent to the user. If the user's input is correct, the verification is passed. If the user does not input or input within 30S error, the verification fails.
  • the minimum square error can be calculated by using the following formula:
  • the x k is the k-th timestamp
  • x′ k is the projection of the timestamp to the linear regression equation
  • S7 is performed to directly intercept the original service request and mark the corresponding requested IP as a malicious IP.
  • the request IP corresponding to the marking is a malicious IP, it further includes:
  • the preset time may be 1 day, 3 days and 7 days.
  • the decapsulation algorithm means that if the requested IP is determined to be a malicious IP on that day, it will be blocked for 24 hours. If the number of visits of the malicious IP reaches 20 within 24 hours, the time that the malicious IP will be blocked will be upgraded. If the number of visits of the malicious IP reaches 50 within 3 days, the time that the malicious IP is blocked will be upgraded to 7 days; If the access times of the IP reaches 100, the malicious IP will be permanently blocked, otherwise, it will be unblocked.
  • S8 is executed to release the original service request.
  • the present application parses the original service request through the gateway to obtain the request IP, and through the validity verification of the request IP, access verification is performed for the legal request IP, and the request IP for which the access verification is successful is performed.
  • the time interval judgment can improve the accuracy of malicious IP interception and the real-time performance of gateway interception. Therefore, the implementation of the present application can solve the problem of low identification accuracy of malicious IP.
  • FIG. 6 it is a functional block diagram of a gateway interception device provided by an embodiment of the present application.
  • the gateway intercepting apparatus 100 described in this application may be installed in an electronic device. According to the implemented functions, the gateway interception apparatus 100 may include a request parsing module 101 , a legality verification module 102 , an access verification module 103 and a time interval judgment module 104 .
  • the modules described in this application may also be referred to as units, which refer to a series of computer program segments that can be executed by the processor of an electronic device and can perform fixed functions, and are stored in the memory of the electronic device.
  • each module/unit is as follows:
  • the request parsing module 101 is configured to obtain an original service request, and use a preset gateway to parse the original service request to obtain a request IP.
  • the original service request may be an operation service request sent by various fields.
  • the original service request may be a withdrawal request, a deposit request, etc. sent by the client through the client.
  • the preset gateway also known as an internet connector and a protocol converter, is a computer system or device that acts as an important conversion task.
  • the original service request is processed through a preset protocol between different communication protocols, data formats or languages, or even two systems with completely different architectures.
  • the gateway includes three layers: a legality verification layer (the first layer), an access verification layer (the second layer), and a request time verification layer (the third layer).
  • the request parsing module 101 obtains the request IP through the following operations:
  • the request IP refers to the IP address of the original service request.
  • the locator refers to a Uniform Resource Locator (URL), which is the address of a standard resource on the Internet.
  • the domain name resolution refers to the use of DNS (DomainNameSystem, Domain Name System) for resolution, and the DNS, as a distributed database that maps domain names and IP addresses to each other, can resolve the domain name in the URL, and search according to the domain name. to the corresponding IP address.
  • the original service request is parsed through a preset gateway, and the IP address of the original service request can be quickly parsed.
  • the legality verification module 102 is configured to perform legality verification on the requested IP, and if it is determined that the requested IP is illegal, directly intercept the original service request and mark the corresponding requested IP as a malicious IP.
  • the legality verification module 102 performs legality verification on the request IP through the following operations:
  • the requested IP can be found in the preset blacklist, then the requested IP is judged to be illegal;
  • the requested IP cannot be found in the preset blacklist, the requested IP is judged to be legal.
  • the preset blacklist is established at the legitimacy verification layer of the gateway. By verifying the validity of the request IP, the original service request can be effectively intercepted, and the request processing amount can be reduced.
  • the original service request is directly intercepted and the corresponding requested IP is marked as a malicious IP.
  • the access verification module 103 is configured to obtain a timestamp corresponding to the original service request according to the request IP if it is judged that the request IP is legal, and perform access verification on the request IP according to the timestamp, If the access verification of the requested IP fails, the original service request is directly intercepted and the corresponding requested IP is marked as a malicious IP.
  • a timestamp corresponding to the original service request is obtained according to the requested IP, and access verification is performed on the requested IP according to the timestamp.
  • the access verification layer of the gateway is used to perform access verification on the request IP.
  • the access verification module 103 performs access verification on the request IP through the following operations:
  • the requested IP is the first visit, it is judged that the requested IP access verification is successful, and the timestamp and the requested IP are recorded;
  • the timestamp refers to the total number of seconds from 00:00:00 on January 01, 1970 Greenwich Mean Time (08:00:00 on January 1, 1970 Beijing Time) to the present. That is, a timestamp is a complete and verifiable data that can indicate that a request has existed at a specific point in time.
  • the preset function may be Date.getTime().
  • the access verification layer records the timestamp and the request IP through Redis (RemoteDictionaryServer, remote dictionary service). When the request IP is not the first visit, the request IP and the corresponding time are searched from the Redis. stamp.
  • the time stamps corresponding to the original service request are identical for too many times, it may be a malicious attack request, and a threshold is set to determine whether the original service request is a malicious attack.
  • the preset threshold may be 50, that is, by default, the original service request is intercepted when the number of times of the same timestamp corresponding to the original service request sent by a client is greater than or equal to 50 times.
  • the security is high, so that the interception accuracy of the original service request is high.
  • the access verification to the request IP fails, the original service request is directly intercepted and the corresponding request IP is marked as a malicious IP.
  • the time interval judging module 104 is used to calculate the request time interval by using the timestamp if the access verification to the request IP is successful, and perform time interval verification on the request IP according to the request time interval, if If the time interval verification of the request IP fails, then directly intercept the original service request and mark the corresponding request IP as a malicious IP, if the time interval verification of the request IP is passed, then perform the original service request. let go.
  • the request time interval is calculated by using the timestamp, and the time interval verification is performed on the requested IP according to the request time interval.
  • the request time verification layer of the gateway is used to perform access verification on the request IP.
  • time interval judging module 104 performs time interval verification on the request IP through the following operations:
  • the timestamp is judged to be linear, and a preset verification method is used to verify the corresponding request IP;
  • the time interval of the request IP is judged to be successful
  • the timestamp is determined to be non-linear, and the time interval verification of the requested IP passes.
  • the preset verification method may be sending a graphic verification code.
  • a graphic verification code is sent to the user. If the user's input is correct, the verification is passed. If the user does not input or input within 30S error, the verification fails.
  • the minimum square error can be calculated by using the following formula:
  • the x k is the k-th timestamp
  • x′ k is the projection of the timestamp to the linear regression equation
  • the original service request is directly intercepted and the corresponding request IP is marked as a malicious IP.
  • the time interval judgment module 104 further includes:
  • the malicious IP is decapsulated according to the number of visits and a preset decapsulation algorithm.
  • the preset time may be 1 day, 3 days and 7 days.
  • the decapsulation algorithm means that if the requested IP is determined to be a malicious IP on that day, it will be blocked for 24 hours. If the number of visits of the malicious IP reaches 20 within 24 hours, the time that the malicious IP will be blocked will be upgraded. If the number of visits of the malicious IP reaches 50 within 3 days, the time that the malicious IP is blocked will be upgraded to 7 days; If the access times of the IP reaches 100, the malicious IP will be permanently blocked, otherwise, it will be unblocked.
  • FIG. 7 it is a schematic structural diagram of an electronic device implementing a gateway interception method provided by an embodiment of the present application.
  • the electronic device 1 may include a processor 10, a memory 11 and a bus, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a gateway interception program 12.
  • the memory 11 includes at least one type of readable storage medium, and the readable storage medium may be volatile or non-volatile.
  • the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (eg, SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, and the like.
  • the memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, such as a mobile hard disk of the electronic device 1 . In other embodiments, the memory 11 may also be an external storage device of the electronic device 1, such as a pluggable mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) equipped on the electronic device 1.
  • the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device.
  • the memory 11 can not only be used to store application software installed in the electronic device 1 and various types of data, such as the code of the gateway interception program 12, etc., but also can be used to temporarily store data that has been output or will be output.
  • the processor 10 may be composed of integrated circuits, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits packaged with the same function or different functions, including one or more integrated circuits.
  • Central processing unit Central Processing unit, CPU
  • microprocessor digital processing chip
  • graphics processor and combination of various control chips, etc.
  • the processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and by running or executing programs or modules (eg, gateway interception) stored in the memory 11 programs, etc.), and call data stored in the memory 11 to execute various functions of the electronic device 1 and process data.
  • the bus may be a peripheral component interconnect (PCI for short) bus or an extended industry standard architecture (extended industry standard architecture, EISA for short) bus or the like.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the bus can be divided into address bus, data bus, control bus and so on.
  • the bus is configured to implement connection communication between the memory 11 and at least one processor 10 and the like.
  • FIG. 7 only shows an electronic device with components. Those skilled in the art can understand that the structure shown in FIG. 7 does not constitute a limitation on the electronic device 1, and may include fewer or more components than those shown in the drawings. components, or a combination of certain components, or a different arrangement of components.
  • the electronic device 1 may also include a power supply (such as a battery) for powering the various components, preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that the power management
  • the device implements functions such as charge management, discharge management, and power consumption management.
  • the power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and any other components.
  • the electronic device 1 may further include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
  • the electronic device 1 may also include a network interface, optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
  • a network interface optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
  • the electronic device 1 may further include a user interface, and the user interface may be a display (Display), an input unit (eg, a keyboard (Keyboard)), optionally, the user interface may also be a standard wired interface or a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, and the like.
  • the display may also be appropriately called a display screen or a display unit, which is used for displaying information processed in the electronic device 1 and for displaying a visualized user interface.
  • the gateway interception program 12 stored in the memory 11 in the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can realize:
  • the validity of the request IP is verified, and if it is judged that the request IP is illegal, the original service request is directly intercepted and the corresponding request IP is marked as a malicious IP;
  • the requested IP If it is judged that the requested IP is legal, obtain the timestamp corresponding to the original service request according to the requested IP, and perform access verification on the requested IP according to the timestamp. If the access verification of the requested IP fails, then Directly intercept the original service request and mark the corresponding request IP as malicious IP;
  • the original service request is directly intercepted and the corresponding request IP is marked as malicious IP; if the time interval verification of the requested IP is passed, the original service request release.
  • the modules/units integrated in the electronic device 1 may be stored in a computer-readable storage medium.
  • the computer-readable storage medium may be volatile or non-volatile.
  • the computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, removable hard disk, magnetic disk, optical disk, computer memory, Read-Only Memory (ROM, Read-Only Memory) ).
  • the present application also provides a computer-readable storage medium, which stores a computer program, and the computer program, when executed by the processor of the electronic device, can realize:
  • the validity of the request IP is verified, and if it is judged that the request IP is illegal, the original service request is directly intercepted and the corresponding request IP is marked as a malicious IP;
  • the requested IP If it is judged that the requested IP is legal, obtain the timestamp corresponding to the original service request according to the requested IP, and perform access verification on the requested IP according to the timestamp. If the access verification of the requested IP fails, then Directly intercept the original service request and mark the corresponding request IP as malicious IP;
  • the original service request is directly intercepted and the corresponding request IP is marked as malicious IP; if the time interval verification of the requested IP is passed, the original service request release.
  • modules described as separate components may or may not be physically separated, and components shown as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.
  • the blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请涉及安全防护技术,揭露了一种网关拦截方法,包括:获取原始业务请求,利用预设的网关对所述原始业务请求进行解析,得到请求IP,对所述请求IP进行合法性验证,若判断所述请求IP合法,则根据所述请求IP获取对应原始业务请求的时间戳,并对所述请求IP进行访问验证,若所述请求IP的访问验证成功,则利用所述时间戳计算请求时间间隔,并对所述请求IP进行时间间隔验证,若所述请求IP时间间隔验证通过,则对所述原始业务请求进行放行。本申请还提出一种网关拦截装置、电子设备以及计算机可读存储介质。本申请可以解决对恶意IP的识别准确率较低的问题。

Description

网关拦截方法、装置、电子设备及存储介质
本申请要求于2021年02月24日提交中国专利局、申请号为202110207167.5,发明名称为“网关拦截方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及安全防护技术领域,尤其涉及一种网关拦截方法、装置、电子设备及计算机可读存储介质。
背景技术
在当前互联网高速发展的今天,网关已经成为各家公司、各个项目不可或缺的模块,网关在同一请求认证、同一请求分发、统一过滤方面取得了飞速的发展,发明人意识到,当前网关的过滤功能指的都是URL(网址)的过滤,目前并没有一个可靠的方式来保护我们的服务器免受恶意IP的攻击,业界常用的是通过添加黑名单机制来解决恶意IP攻击,但黑名单机制是基于已被攻击的情况进行的设定,防护较为被动,而恶意IP一波攻击就可能导致我们的服务器宕机,同时黑名单机制无法进行实时的更新,导致对恶意IP的识别准确率较低。
发明内容
本申请提供的一种网关拦截方法,包括:
获取原始业务请求,利用预设的网关对所述原始业务请求进行解析,得到请求IP;
对所述请求IP进行合法性验证,若判断所述请求IP非法,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
若判断所述请求IP合法,则根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证,若对所述请求IP的访问验证失败,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
若对所述请求IP的访问验证成功,则利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证;
若对所述请求IP的时间间隔验证不通过,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP,若对所述请求IP的时间间隔验证通过,则对所述原始业务请求进行放行。
本申请还提供一种网关拦截装置,所述装置包括:
请求解析模块,用于获取原始业务请求,利用预设的网关对所述原始业务请求进行解析,得到请求IP;
合法性验证模块,用于对所述请求IP进行合法性验证,若判断所述请求IP非法,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
访问验证模块,用于若判断所述请求IP合法,则根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证,若对所述请求IP的访问验证失败,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
时间间隔判断模块,用于若对所述请求IP的访问验证成功,则利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证,若对所述请求IP的时间间隔验证不通过,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP, 若对所述请求IP的时间间隔验证通过,则对所述原始业务请求进行放行。
本申请还提供一种电子设备,所述电子设备包括:
存储器,存储至少一个指令;及
处理器,执行所述存储器中存储的指令以实现如下所述的网关拦截方法:
获取原始业务请求,利用预设的网关对所述原始业务请求进行解析,得到请求IP;
对所述请求IP进行合法性验证,若判断所述请求IP非法,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
若判断所述请求IP合法,则根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证,若对所述请求IP的访问验证失败,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
若对所述请求IP的访问验证成功,则利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证;
若对所述请求IP的时间间隔验证不通过,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP,若对所述请求IP的时间间隔验证通过,则对所述原始业务请求进行放行。
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一个指令,所述至少一个指令被电子设备中的处理器执行以实现如下所述的网关拦截方法:
获取原始业务请求,利用预设的网关对所述原始业务请求进行解析,得到请求IP;
对所述请求IP进行合法性验证,若判断所述请求IP非法,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
若判断所述请求IP合法,则根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证,若对所述请求IP的访问验证失败,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
若对所述请求IP的访问验证成功,则利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证;
若对所述请求IP的时间间隔验证不通过,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP,若对所述请求IP的时间间隔验证通过,则对所述原始业务请求进行放行。
附图说明
图1为本申请一实施例提供的网关拦截方法的流程示意图;
图2为图1中其中一个步骤的详细实施流程示意图;
图3为图1中另一个步骤的详细实施流程示意图;
图4为图1中另一个步骤的详细实施流程示意图;
图5为图1中另一个步骤的详细实施流程示意图;
图6为本申请一实施例提供的网关拦截装置的功能模块图;
图7为本申请一实施例提供的实现所述网关拦截方法的电子设备的结构示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请实施例提供一种网关拦截方法。所述网关拦截方法的执行主体包括但不限于服务端、终端等能够被配置为执行本申请实施例提供的该方法的电子设备中的至少一种。换言之,所述网关拦截方法可以由安装在终端设备或服务端设备的软件或硬件来执行,所述软件可以是区块链平台。所述服务端包括但不限于:单台服务器、服务器集群、云端服务 器或云端服务器集群等。
参照图1所示,为本申请一实施例提供的网关拦截方法的流程示意图。在本实施例中,所述网关拦截方法包括:
S1、获取原始业务请求,利用预设的网关对所述原始业务请求进行解析,得到请求IP。
本申请实施例中,所述原始业务请求可以为各领域发送的操作业务请求。比如,银行领域,所述原始业务请求可以为客户通过客户端发送的取款请求、存款请求等。所述预设的网关(Gateway)又称网间连接器、协议转换器,是一种充当转换重任的计算机系统或设备。使用在不同的通信协议、数据格式或语言,甚至体系结构完全不同的两种系统之间,通过预设的协议对所述原始业务请求进行处理。本申请实施例中,所述网关包括三层:合法性验证层(第一层)、访问验证层(第二层)及请求时间验证层(第三层)等。
具体地,参照图2所示,所述利用预设的网关对所述原始业务请求进行解析,得到请求IP,包括:
S10、利用所述网关解析出所述原始业务请求的定位符;
S11、对所述定位符进行域名解析,得到所述请求IP。
其中,所述请求IP是指所述原始业务请求的IP地址。所述定位符是指统一资源定位符(URL),所述统一资源定位符是互联网上标准资源的地址。所述域名解析是指利用DNS(DomainNameSystem,域名系统)进行解析,所述DNS作为将域名和IP地址相互映射的一个分布式数据库,可以解析出所述URL中的域名,并根据所述域名查找到对应的IP地址。
进一步地,本申请实施例通过预设的网关对所述原始业务请求进行解析,可以快速的解析出所述原始业务请求的IP地址。
S2、对所述请求IP进行合法性验证。
具体地,参照图3所示,所述对所述请求IP进行合法性验证,包括:
S20、利用所述请求IP查找预设的黑名单;
若所述请求IP能在预设的黑名单中找到,则执行S21、将所述请求IP判断为非法;
若所述请求IP不能在预设的黑名单中找到,则执行S22、将所述请求IP判断为合法。
本申请实施例中,所述预设的黑名单设立在所述网关的合法性验证层。通过对所述请求IP进行合法性验证,可以对所述原始业务请求有效拦截,减少请求处理量。
若判断所述请求IP非法,则执行S3、直接拦截所述原始业务请求并标记对应的请求IP为恶意IP。
若判断所述请求IP合法,则执行S4、根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证。
本申请实施例中,利用所述网关的访问验证层对所述请求IP进行访问验证。
具体地,参照图4所示,所述S4包括:
S40、根据预设的函数获取对应原始业务请求的时间戳;
S41、判断所述请求IP是否为第一次访问;
若所述请求IP是第一次访问,则执行S42、判断所述请求IP访问验证成功,并记录所述时间戳及请求IP;
若所述请求IP不是第一次访问,则执行S43、查询所述请求IP历史访问的时间戳,并判断所述历史访问的时间戳相同次数是否达到预设的阈值;
若所述历史访问的时间戳相同次数大于等于所述预设的阈值,则执行S44、判断所述请求IP的访问验证失败;
若所述历史访问的时间戳相同次数小于所述预设的阈值,则执行S45、判断所述请求IP的访问验证成功。
其中,所述时间戳是指格林威治时间1970年01月01日00时00分00秒(北京时间 1970年01月01日08时00分00秒)起至现在的总秒数。即时间戳是一份能够表示一次请求在一个特定时间点已经存在的完整的可验证的数据。本申请实施例中,所述预设的函数可以为Date.getTime()。所述访问验证层通过Redis(RemoteDictionaryServer,远程字典服务)记录所述时间戳及请求IP,当所述请求IP不是第一次访问时,则从所述Redis中查找所述请求IP及对应的时间戳。
本申请实施例中,若所述原始业务请求对应的时间戳相同次数过多,则可能为恶意攻击的请求,通过设置阈值来判断所述原始业务请求是否为恶意攻击。比如,所述预设的阈值可以为50,即默认一个客户端发送的原始业务请求对应的时间戳相同次数大于等于50次时,对所述原始业务请求进行拦截。
进一步地,本申请实施例中,由于所述时间戳的防篡改性,因此安全性较高,使得对所述原始业务请求的拦截准确性较高。
若对所述请求IP的访问验证失败,则执行S5、直接拦截所述原始业务请求并标记对应的请求IP为恶意IP。
若对所述请求IP的访问验证成功,则执行S6、利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证。
本申请实施例中,利用所述网关的请求时间验证层对所述请求IP进行访问验证。
具体地,所述利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证,包括:
获取每次原始业务请求的时间戳,计算所述时间戳之间的请求时间间隔,并对所述请求时间间隔进行线性回归,得到线性回归方程;
利用所述时间戳及所述线性回归方程计算最小平方误差;
若所述最小平方误差小于等于预设的误差阈值,则所述时间戳判断为线性,利用预设的验证方法对相应的请求IP进行验证;
若所述请求IP通过验证,则所述请求IP的时间间隔判断成功;
若所述请求IP未通过验证,则所述请求IP的时间间隔判断失败;
若所述最小平方误差大于预设的误差阈值,则所述时间戳判断为非线性,则所述请求IP的时间间隔验证通过。
详细地,本申请实施例中,所述预设的验证方法可以为发送图形验证码。比如,当所述时间戳判断线性时,说明该请求IP可能为非法的请求,这时候给用户发送一张图形验证码,如果用户输入正确,则通过验证,如果用户在30S内没有输入或输入错误,则验证不通过。
本申请实施例中,所述最小平方误差可以利用下述公式进行计算:
Figure PCTCN2021123887-appb-000001
其中,所述x k为第k个时间戳,x′ k为所述时间戳到所述线性回归方程的投影。
若对所述请求IP的时间间隔验证不通过,则执行S7、直接拦截所述原始业务请求并标记对应的请求IP为恶意IP。
进一步地,本申请实施例中,如图5所示,所述标记对应的请求IP为恶意IP之后,还包括:
S71、获取预设时间内所述恶意IP的访问次数;
S72、根据所述访问次数及预设的解封算法对所述恶意IP进行解封处理。
其中,本申请实施例中,所述预设时间可以为1天、3天及7天。所述解封算法是指,若当天请求IP被判定为恶意IP,则封锁24小时,如果在24小时内,所述恶意IP的访问次数达到20次,则所述恶意IP被封锁的时间升级为3天,反之则解封;如果在3天内所 述恶意IP的访问次数达到50次,则所述恶意IP被封锁的时间升级为7天,反之则解封,如果在7天内所述恶意IP的访问次数达到100次,则所述恶意IP被永久封锁,反之则解封。
若对所述请求IP的时间间隔验证通过,则执行S8、对所述原始业务请求进行放行。
本申请通过网关对所述原始业务请求进行解析,得到请求IP,并通过对所述请求IP进行合法性验证,对于合法性验证合法的请求IP进行访问验证,并对访问验证成功的请求IP进行时间间隔判断,相较于被动的用黑名单机制进行拦截的方法,可以提高对恶意IP拦截的准确率及网关拦截的实时性。因此本申请实施可以解决对恶意IP的识别准确率较低的问题。
如图6所示,是本申请一实施例提供的网关拦截装置的功能模块图。
本申请所述网关拦截装置100可以安装于电子设备中。根据实现的功能,所述网关拦截装置100可以包括请求解析模块101、合法性验证模块102、访问验证模块103及时间间隔判断模块104。本申请所述模块也可以称之为单元,是指一种能够被电子设备处理器所执行,并且能够完成固定功能的一系列计算机程序段,其存储在电子设备的存储器中。
在本实施例中,关于各模块/单元的功能如下:
所述请求解析模块101,用于获取原始业务请求,利用预设的网关对所述原始业务请求进行解析,得到请求IP。
本申请实施例中,所述原始业务请求可以为各领域发送的操作业务请求。比如,银行领域,所述原始业务请求可以为客户通过客户端发送的取款请求、存款请求等。所述预设的网关(Gateway)又称网间连接器、协议转换器,是一种充当转换重任的计算机系统或设备。使用在不同的通信协议、数据格式或语言,甚至体系结构完全不同的两种系统之间,通过预设的协议对所述原始业务请求进行处理。本申请实施例中,所述网关包括三层:合法性验证层(第一层)、访问验证层(第二层)及请求时间验证层(第三层)等。
具体地,所述请求解析模块101通过下述操作得到请求IP:
利用所述网关解析出所述原始业务请求的定位符;
对所述定位符进行域名解析,得到所述请求IP。
其中,所述请求IP是指所述原始业务请求的IP地址。所述定位符是指统一资源定位符(URL),所述统一资源定位符是互联网上标准资源的地址。所述域名解析是指利用DNS(DomainNameSystem,域名系统)进行解析,所述DNS作为将域名和IP地址相互映射的一个分布式数据库,可以解析出所述URL中的域名,并根据所述域名查找到对应的IP地址。
进一步地,本申请实施例通过预设的网关对所述原始业务请求进行解析,可以快速的解析出所述原始业务请求的IP地址。
所述合法性验证模块102,用于对所述请求IP进行合法性验证,若判断所述请求IP非法,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP。
具体地,所述合法性验证模块102通过下述操作对所述请求IP进行合法性验证:
利用所述请求IP查找预设的黑名单;
若所述请求IP能在预设的黑名单中找到,则将所述请求IP判断为非法;
若所述请求IP不能在预设的黑名单中找到,则将所述请求IP判断为合法。
本申请实施例中,所述预设的黑名单设立在所述网关的合法性验证层。通过对所述请求IP进行合法性验证,可以对所述原始业务请求有效拦截,减少请求处理量。
若判断所述请求IP非法,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP。
所述访问验证模块103,用于若判断所述请求IP合法,则根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证,若对所述请求IP的访问验证失败,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP。
若判断所述请求IP合法,则根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证。
本申请实施例中,利用所述网关的访问验证层对所述请求IP进行访问验证。
具体地,所述访问验证模块103通过下述操作对所述请求IP进行访问验证:
根据预设的函数获取对应原始业务请求的时间戳;
判断所述请求IP是否为第一次访问;
若所述请求IP是第一次访问,则判断所述请求IP访问验证成功,并记录所述时间戳及请求IP;
若所述请求IP不是第一次访问,则查询所述请求IP历史访问的时间戳,并判断所述历史访问的时间戳相同次数是否达到预设的阈值;
若所述历史访问的时间戳相同次数大于等于所述预设的阈值,则判断所述请求IP的访问验证失败;
若所述历史访问的时间戳相同次数小于所述预设的阈值,则判断所述请求IP的访问验证成功。
其中,所述时间戳是指格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总秒数。即时间戳是一份能够表示一次请求在一个特定时间点已经存在的完整的可验证的数据。本申请实施例中,所述预设的函数可以为Date.getTime()。所述访问验证层通过Redis(RemoteDictionaryServer,远程字典服务)记录所述时间戳及请求IP,当所述请求IP不是第一次访问时,则从所述Redis中查找所述请求IP及对应的时间戳。
本申请实施例中,若所述原始业务请求对应的时间戳相同次数过多,则可能为恶意攻击的请求,通过设置阈值来判断所述原始业务请求是否为恶意攻击。比如,所述预设的阈值可以为50,即默认一个客户端发送的原始业务请求对应的时间戳相同次数大于等于50次时,对所述原始业务请求进行拦截。
进一步地,本申请实施例中,由于所述时间戳的防篡改性,因此安全性较高,使得对所述原始业务请求的拦截准确性较高。
若对所述请求IP的访问验证失败,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP。
所述时间间隔判断模块104,用于若对所述请求IP的访问验证成功,则利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证,若对所述请求IP的时间间隔验证不通过,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP,若对所述请求IP的时间间隔验证通过,则对所述原始业务请求进行放行。
若对所述请求IP的访问验证成功,则利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证。
本申请实施例中,利用所述网关的请求时间验证层对所述请求IP进行访问验证。
具体地,所述时间间隔判断模块104通过下述操作对所述请求IP进行时间间隔验证:
获取每次原始业务请求的时间戳,计算所述时间戳之间的请求时间间隔,并对所述请求时间间隔进行线性回归,得到线性回归方程;
利用所述时间戳及所述线性回归方程计算最小平方误差;
若所述最小平方误差小于等于预设的误差阈值,则所述时间戳判断为线性,利用预设的验证方法对相应的请求IP进行验证;
若所述请求IP通过验证,则所述请求IP的时间间隔判断成功;
若所述请求IP未通过验证,则所述请求IP的时间间隔判断失败;
若所述最小平方误差大于预设的误差阈值,则所述时间戳判断为非线性,则所述请求IP的时间间隔验证通过。
详细地,本申请实施例中,所述预设的验证方法可以为发送图形验证码。比如,当所述时间戳判断线性时,说明该请求IP可能为非法的请求,这时候给用户发送一张图形验证码,如果用户输入正确,则通过验证,如果用户在30S内没有输入或输入错误,则验证不通过。
本申请实施例中,所述最小平方误差可以利用下述公式进行计算:
Figure PCTCN2021123887-appb-000002
其中,所述x k为第k个时间戳,x′ k为所述时间戳到所述线性回归方程的投影。
若对所述请求IP的时间间隔验证不通过,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP。
进一步地,本申请实施例中,所述时间间隔判断模块104在标记对应的请求IP为恶意IP之后,还包括:
获取预设时间内所述恶意IP的访问次数;
根据所述访问次数及预设的解封算法对所述恶意IP进行解封处理。
其中,本申请实施例中,所述预设时间可以为1天、3天及7天。所述解封算法是指,若当天请求IP被判定为恶意IP,则封锁24小时,如果在24小时内,所述恶意IP的访问次数达到20次,则所述恶意IP被封锁的时间升级为3天,反之则解封;如果在3天内所述恶意IP的访问次数达到50次,则所述恶意IP被封锁的时间升级为7天,反之则解封,如果在7天内所述恶意IP的访问次数达到100次,则所述恶意IP被永久封锁,反之则解封。
若对所述请求IP的时间间隔验证通过,则对所述原始业务请求进行放行。
如图7所示,是本申请一实施例提供的实现网关拦截方法的电子设备的结构示意图。
所述电子设备1可以包括处理器10、存储器11和总线,还可以包括存储在所述存储器11中并可在所述处理器10上运行的计算机程序,如网关拦截程序12。
其中,所述存储器11至少包括一种类型的可读存储介质,所述可读存储介质可以是易失性的,也可以是非易失性的。具体的,所述可读存储介质包括闪存、移动硬盘、多媒体卡、卡型存储器(例如:SD或DX存储器等)、磁性存储器、磁盘、光盘等。所述存储器11在一些实施例中可以是电子设备1的内部存储单元,例如该电子设备1的移动硬盘。所述存储器11在另一些实施例中也可以是电子设备1的外部存储设备,例如电子设备1上配备的插接式移动硬盘、智能存储卡(SmartMediaCard,SMC)、安全数字(SecureDigital,SD)卡、闪存卡(FlashCard)等。进一步地,所述存储器11还可以既包括电子设备1的内部存储单元也包括外部存储设备。所述存储器11不仅可以用于存储安装于电子设备1的应用软件及各类数据,例如网关拦截程序12的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
所述处理器10在一些实施例中可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成,包括一个或者多个中央处理器(CentralProcessingunit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。所述处理器10是所述电子设备的控制核心(ControlUnit),利用各种接口和线路连接整个电子设备的各个部件,通过运行或执行存储在所述存储器11内的程序或者模块(例如网关拦截程序等),以及调用存储在所述存储器11内的数据,以执行 电子设备1的各种功能和处理数据。
所述总线可以是外设部件互连标准(peripheralcomponentinterconnect,简称PCI)总线或扩展工业标准结构(extendedindustrystandardarchitecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。所述总线被设置为实现所述存储器11以及至少一个处理器10等之间的连接通信。
图7仅示出了具有部件的电子设备,本领域技术人员可以理解的是,图7示出的结构并不构成对所述电子设备1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
例如,尽管未示出,所述电子设备1还可以包括给各个部件供电的电源(比如电池),优选地,电源可以通过电源管理装置与所述至少一个处理器10逻辑相连,从而通过电源管理装置实现充电管理、放电管理、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述电子设备1还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。
进一步地,所述电子设备1还可以包括网络接口,可选地,所述网络接口可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该电子设备1与其他电子设备之间建立通信连接。
可选地,该电子设备1还可以包括用户接口,用户接口可以是显示器(Display)、输入单元(比如键盘(Keyboard)),可选地,用户接口还可以是标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(OrganicLight-EmittingDiode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在电子设备1中处理的信息以及用于显示可视化的用户界面。
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。
所述电子设备1中的所述存储器11存储的网关拦截程序12是多个指令的组合,在所述处理器10中运行时,可以实现:
获取原始业务请求,利用预设的网关对所述原始业务请求进行解析,得到请求IP;
对所述请求IP进行合法性验证,若判断所述请求IP非法,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
若判断所述请求IP合法,则根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证,若对所述请求IP的访问验证失败,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
若对所述请求IP的访问验证成功,则利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证;
若对所述请求IP的时间间隔验证不通过,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP,若对所述请求IP的时间间隔验证通过,则对所述原始业务请求进行放行。
具体地,所述处理器10对上述指令的具体实现方法可参考图1至图5对应实施例中相关步骤的描述,在此不赘述。
进一步地,所述电子设备1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。所述计算机可读存储介质可以是易失性的,也可以是非易失性的。例如,所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-OnlyMemory)。
本申请还提供一种计算机可读存储介质,所述可读存储介质存储有计算机程序,所述 计算机程序在被电子设备的处理器所执行时,可以实现:
获取原始业务请求,利用预设的网关对所述原始业务请求进行解析,得到请求IP;
对所述请求IP进行合法性验证,若判断所述请求IP非法,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
若判断所述请求IP合法,则根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证,若对所述请求IP的访问验证失败,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
若对所述请求IP的访问验证成功,则利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证;
若对所述请求IP的时间间隔验证不通过,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP,若对所述请求IP的时间间隔验证通过,则对所述原始业务请求进行放行。
在本申请所提供的几个实施例中,应该理解到,所揭露的设备,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。
因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附关联图标记视为限制所涉及的权利要求。
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。
此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。系统权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第二等词语用来表示名称,而并不表示任何特定的顺序。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。

Claims (20)

  1. 一种网关拦截方法,其中,所述方法包括:
    获取原始业务请求,利用预设的网关对所述原始业务请求进行解析,得到请求IP;
    对所述请求IP进行合法性验证,若判断所述请求IP非法,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
    若判断所述请求IP合法,则根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证,若对所述请求IP的访问验证失败,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
    若对所述请求IP的访问验证成功,则利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证;
    若对所述请求IP的时间间隔验证不通过,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP,若对所述请求IP的时间间隔验证通过,则对所述原始业务请求进行放行。
  2. 如权利要求1所述的网关拦截方法,其中,所述利用预设的网关对所述原始业务请求进行解析,得到请求IP,包括:
    利用所述网关解析出所述原始业务请求的定位符;
    对所述定位符进行域名解析,得到所述请求IP。
  3. 如权利要求1所述的网关拦截方法,其中,所述对所述请求IP进行合法性验证,包括:
    利用所述请求IP查找预设的黑名单;
    若所述请求IP能在预设的黑名单中找到,则将所述请求IP判断为非法;
    若所述请求IP不能在预设的黑名单中找到,则将所述请求IP判断为合法。
  4. 如权利要求1所述的网关拦截方法,其中,所述根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证,包括:
    根据预设的函数获取对应原始业务请求的时间戳;
    判断所述请求IP是否为第一次访问;
    若所述请求IP是第一次访问,则判断所述请求IP访问验证成功,并记录所述时间戳及请求IP;
    若所述请求IP不是第一次访问,则查询所述请求IP历史访问的时间戳,并判断所述历史访问的时间戳相同次数是否达到预设的阈值;
    若所述历史访问的时间戳相同次数大于等于所述预设的阈值,则判断所述请求IP的访问验证失败;
    若所述历史访问的时间戳相同次数小于所述预设的阈值,则判断所述请求IP的访问验证成功。
  5. 如权利要求1所述的网关拦截方法,其中,所述利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证,包括:
    获取每次原始业务请求的时间戳,计算所述时间戳之间的请求时间间隔,并对所述请求时间间隔进行线性回归,得到线性回归方程;
    利用所述时间戳及所述线性回归方程计算最小平方误差;
    若所述最小平方误差小于等于预设的误差阈值,则所述时间戳判断为线性,利用预设的验证方法对相应的请求IP进行验证;
    若所述请求IP通过验证,则所述请求IP的时间间隔判断成功;
    若所述请求IP未通过验证,则所述请求IP的时间间隔判断失败;
    若所述最小平方误差大于预设的误差阈值,则所述时间戳判断为非线性,则所述请求IP的时间间隔验证通过。
  6. 如权利要求5所述的网关拦截方法,其中,所述最小平方误差利用下述公式进行计算:
    Figure PCTCN2021123887-appb-100001
    其中,所述x k为第k个时间戳,x′ k为所述时间戳到所述线性回归方程的投影。
  7. 如权利要求1至6中任意一项所述的网关拦截方法,其中,所述标记对应的请求IP为恶意IP之后,还包括:
    获取预设时间内所述恶意IP的访问次数;
    根据所述访问次数及预设的解封算法对所述恶意IP进行解封处理。
  8. 一种网关拦截装置,其中,所述装置包括:
    请求解析模块,用于获取原始业务请求,利用预设的网关对所述原始业务请求进行解析,得到请求IP;
    合法性验证模块,用于对所述请求IP进行合法性验证,若判断所述请求IP非法,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
    访问验证模块,用于若判断所述请求IP合法,则根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证,若对所述请求IP的访问验证失败,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
    时间间隔判断模块,用于若对所述请求IP的访问验证成功,则利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证,若对所述请求IP的时间间隔验证不通过,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP,若对所述请求IP的时间间隔验证通过,则对所述原始业务请求进行放行。
  9. 一种电子设备,其中,所述电子设备包括:
    至少一个处理器;以及,
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如下所述的网关拦截方法:
    获取原始业务请求,利用预设的网关对所述原始业务请求进行解析,得到请求IP;
    对所述请求IP进行合法性验证,若判断所述请求IP非法,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
    若判断所述请求IP合法,则根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证,若对所述请求IP的访问验证失败,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
    若对所述请求IP的访问验证成功,则利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证;
    若对所述请求IP的时间间隔验证不通过,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP,若对所述请求IP的时间间隔验证通过,则对所述原始业务请求进行放行。
  10. 如权利要求9所述的电子设备,其中,所述利用预设的网关对所述原始业务请求进行解析,得到请求IP,包括:
    利用所述网关解析出所述原始业务请求的定位符;
    对所述定位符进行域名解析,得到所述请求IP。
  11. 如权利要求9所述的电子设备,其中,所述对所述请求IP进行合法性验证,包括:
    利用所述请求IP查找预设的黑名单;
    若所述请求IP能在预设的黑名单中找到,则将所述请求IP判断为非法;
    若所述请求IP不能在预设的黑名单中找到,则将所述请求IP判断为合法。
  12. 如权利要求9所述的电子设备,其中,所述根据所述请求IP获取对应原始业务请求 的时间戳,并根据所述时间戳对所述请求IP进行访问验证,包括:
    根据预设的函数获取对应原始业务请求的时间戳;
    判断所述请求IP是否为第一次访问;
    若所述请求IP是第一次访问,则判断所述请求IP访问验证成功,并记录所述时间戳及请求IP;
    若所述请求IP不是第一次访问,则查询所述请求IP历史访问的时间戳,并判断所述历史访问的时间戳相同次数是否达到预设的阈值;
    若所述历史访问的时间戳相同次数大于等于所述预设的阈值,则判断所述请求IP的访问验证失败;
    若所述历史访问的时间戳相同次数小于所述预设的阈值,则判断所述请求IP的访问验证成功。
  13. 如权利要求9所述的电子设备,其中,所述利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证,包括:
    获取每次原始业务请求的时间戳,计算所述时间戳之间的请求时间间隔,并对所述请求时间间隔进行线性回归,得到线性回归方程;
    利用所述时间戳及所述线性回归方程计算最小平方误差;
    若所述最小平方误差小于等于预设的误差阈值,则所述时间戳判断为线性,利用预设的验证方法对相应的请求IP进行验证;
    若所述请求IP通过验证,则所述请求IP的时间间隔判断成功;
    若所述请求IP未通过验证,则所述请求IP的时间间隔判断失败;
    若所述最小平方误差大于预设的误差阈值,则所述时间戳判断为非线性,则所述请求IP的时间间隔验证通过。
  14. 如权利要求13所述的电子设备,其中,所述最小平方误差利用下述公式进行计算:
    Figure PCTCN2021123887-appb-100002
    其中,所述x k为第k个时间戳,x′ k为所述时间戳到所述线性回归方程的投影。
  15. 一种计算机可读存储介质,存储有计算机程序,其中,所述计算机程序被处理器执行时实现如下所述的网关拦截方法:
    获取原始业务请求,利用预设的网关对所述原始业务请求进行解析,得到请求IP;
    对所述请求IP进行合法性验证,若判断所述请求IP非法,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
    若判断所述请求IP合法,则根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证,若对所述请求IP的访问验证失败,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP;
    若对所述请求IP的访问验证成功,则利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证;
    若对所述请求IP的时间间隔验证不通过,则直接拦截所述原始业务请求并标记对应的请求IP为恶意IP,若对所述请求IP的时间间隔验证通过,则对所述原始业务请求进行放行。
  16. 如权利要求15所述的计算机可读存储介质,其中,所述利用预设的网关对所述原始业务请求进行解析,得到请求IP,包括:
    利用所述网关解析出所述原始业务请求的定位符;
    对所述定位符进行域名解析,得到所述请求IP。
  17. 如权利要求15所述的计算机可读存储介质,其中,所述对所述请求IP进行合法性验证,包括:
    利用所述请求IP查找预设的黑名单;
    若所述请求IP能在预设的黑名单中找到,则将所述请求IP判断为非法;
    若所述请求IP不能在预设的黑名单中找到,则将所述请求IP判断为合法。
  18. 如权利要求15所述的计算机可读存储介质,其中,所述根据所述请求IP获取对应原始业务请求的时间戳,并根据所述时间戳对所述请求IP进行访问验证,包括:
    根据预设的函数获取对应原始业务请求的时间戳;
    判断所述请求IP是否为第一次访问;
    若所述请求IP是第一次访问,则判断所述请求IP访问验证成功,并记录所述时间戳及请求IP;
    若所述请求IP不是第一次访问,则查询所述请求IP历史访问的时间戳,并判断所述历史访问的时间戳相同次数是否达到预设的阈值;
    若所述历史访问的时间戳相同次数大于等于所述预设的阈值,则判断所述请求IP的访问验证失败;
    若所述历史访问的时间戳相同次数小于所述预设的阈值,则判断所述请求IP的访问验证成功。
  19. 如权利要求15所述的计算机可读存储介质,其中,所述利用所述时间戳计算请求时间间隔,并根据所述请求时间间隔对所述请求IP进行时间间隔验证,包括:
    获取每次原始业务请求的时间戳,计算所述时间戳之间的请求时间间隔,并对所述请求时间间隔进行线性回归,得到线性回归方程;
    利用所述时间戳及所述线性回归方程计算最小平方误差;
    若所述最小平方误差小于等于预设的误差阈值,则所述时间戳判断为线性,利用预设的验证方法对相应的请求IP进行验证;
    若所述请求IP通过验证,则所述请求IP的时间间隔判断成功;
    若所述请求IP未通过验证,则所述请求IP的时间间隔判断失败;
    若所述最小平方误差大于预设的误差阈值,则所述时间戳判断为非线性,则所述请求IP的时间间隔验证通过。
  20. 如权利要求19所述的计算机可读存储介质,其中,所述最小平方误差利用下述公式进行计算:
    Figure PCTCN2021123887-appb-100003
    其中,所述x k为第k个时间戳,x′ k为所述时间戳到所述线性回归方程的投影。
PCT/CN2021/123887 2021-02-24 2021-10-14 网关拦截方法、装置、电子设备及存储介质 WO2022179120A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110207167.5 2021-02-24
CN202110207167.5A CN112866285B (zh) 2021-02-24 2021-02-24 网关拦截方法、装置、电子设备及存储介质

Publications (1)

Publication Number Publication Date
WO2022179120A1 true WO2022179120A1 (zh) 2022-09-01

Family

ID=75991320

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/123887 WO2022179120A1 (zh) 2021-02-24 2021-10-14 网关拦截方法、装置、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN112866285B (zh)
WO (1) WO2022179120A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112866285B (zh) * 2021-02-24 2022-11-15 深圳壹账通智能科技有限公司 网关拦截方法、装置、电子设备及存储介质
CN114422139B (zh) * 2021-12-17 2024-02-23 上海浦东发展银行股份有限公司 Api网关请求安全验证方法、装置、电子设备及计算机可读介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101834866A (zh) * 2010-05-05 2010-09-15 北京来安科技有限公司 一种cc攻击防护方法及其系统
US20160232349A1 (en) * 2015-02-09 2016-08-11 Fortinet, Inc. Mobile malware detection and user notification
CN111200614A (zh) * 2020-01-07 2020-05-26 中山大学 一种针对第三方匿名EDoS攻击的防御方法及系统
CN112866285A (zh) * 2021-02-24 2021-05-28 深圳壹账通智能科技有限公司 网关拦截方法、装置、电子设备及存储介质

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8300749B2 (en) * 2008-12-19 2012-10-30 Alcatel Lucent Method, apparatus and system for frequency synchronization between devices communicating over a packet network
CN107483604B (zh) * 2017-08-29 2020-12-15 武汉斗鱼网络科技有限公司 Nginx-RTMP动态更新DNS缓存的方法和装置
CN112187931A (zh) * 2020-09-29 2021-01-05 中国平安财产保险股份有限公司 会话管理方法、装置、计算机设备和存储介质
CN112367338A (zh) * 2020-11-27 2021-02-12 腾讯科技(深圳)有限公司 恶意请求检测方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101834866A (zh) * 2010-05-05 2010-09-15 北京来安科技有限公司 一种cc攻击防护方法及其系统
US20160232349A1 (en) * 2015-02-09 2016-08-11 Fortinet, Inc. Mobile malware detection and user notification
CN111200614A (zh) * 2020-01-07 2020-05-26 中山大学 一种针对第三方匿名EDoS攻击的防御方法及系统
CN112866285A (zh) * 2021-02-24 2021-05-28 深圳壹账通智能科技有限公司 网关拦截方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN112866285A (zh) 2021-05-28
CN112866285B (zh) 2022-11-15

Similar Documents

Publication Publication Date Title
CN108900464B (zh) 电子装置、基于区块链的数据处理方法和计算机存储介质
WO2022179120A1 (zh) 网关拦截方法、装置、电子设备及存储介质
US11520751B2 (en) System and method for information storage using blockchain databases combined with pointer databases
US9325695B2 (en) Token caching in trust chain processing
WO2017210142A1 (en) System and method for providing fast platform telemetry data
JP2013522795A (ja) 仮想機械によるソフトウェアテストを用いた電子ネットワークにおけるクライアントシステムの遠隔保守のためのシステム及び方法
TW201322135A (zh) 用於動態服務整合的系統和方法
WO2019076014A1 (zh) 网页生成方法、装置、终端设备及介质
CN109005226A (zh) 服务器中传感器数据的获取方法、获取系统和相关装置
CN111209557A (zh) 跨域单点登录方法、装置、电子设备及存储介质
EP3744071A1 (en) Data isolation in distributed hash chains
CN113364753A (zh) 反爬虫方法、装置、电子设备及计算机可读存储介质
CN114827354A (zh) 身份验证信息显示方法、装置、电子设备及可读存储介质
JP7409190B2 (ja) チェーン横断的な相互運用性のためのコンピュータ実装方法
CN115086047B (zh) 接口鉴权方法、装置、电子设备及存储介质
CN114978649B (zh) 基于大数据的信息安全保护方法、装置、设备及介质
CN113364848B (zh) 文件缓存方法、装置、电子设备及存储介质
JP2006343848A (ja) 作業実績管理装置
CN112487400A (zh) 基于多页面的单点登录方法、装置、电子设备及存储介质
CN116055180B (zh) 一种基于网关的互联网资源备案信息查询验证方法及装置
JP2007096413A (ja) パケット記録支援装置、パケット記録支援方法、及びパケット記録支援プログラム
TWI788682B (zh) 透過第三方區塊鏈進行保單存證與驗證之系統及方法
CN114614993B (zh) 系统交互方法、装置、电子设备及存储介质
US20230169045A1 (en) System and method for information storage using blockchain databases combined with pointer databases
CN115002211B (zh) 基于云原生的售后微服务实现方法、装置、设备及介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21927544

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 07/12/2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21927544

Country of ref document: EP

Kind code of ref document: A1