Access control method, device, equipment and medium

By using the Naive Bayes algorithm to build a classification model, identifying the unit type to which the IP address belongs, solving the problem of low IP address positioning accuracy in the existing technology, and improving the efficiency of risk control.

CN112149743BActive Publication Date: 2025-01-03HANGZHOU DBAPPSECURITY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011026304.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-25
Publication Date
2025-01-03
Estimated Expiration
2040-09-25

AI Technical Summary

Technical Problem

The existing IP address positioning technology has low accuracy in building-intensive cities, and it is impossible to accurately identify specific communities or buildings, resulting in low accuracy of identification of unit types to which the IP address belongs, thereby reducing risk control efficiency.

Method used

The classification model is constructed using the naive Bayes algorithm, and the log data with unit type tags are obtained for training, identify the unit type to which the IP address to be classified belongs, and control access requests based on this type.

Benefits of technology

It improves the accuracy of the identification of the unit type to which the IP address belongs and enhances the risk control efficiency of IP addresses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112149743B_ABST
    Figure CN112149743B_ABST
Patent Text Reader

Abstract

The present application discloses an access control method, device, equipment and medium, the method comprising: obtaining training set data, wherein the training set data is log data with unit type mark, and the log data includes corresponding IP addresses; using the training set data to train a classification model pre-built based on the naive Bayes algorithm to obtain a trained classification model; when the log data to be classified is obtained, the trained classification model is used to classify the log data to be classified to obtain the unit type to which the IP address to be classified in the log data to be classified belongs; and according to the unit type to which the IP address to be classified belongs, the access request issued by the IP address to be classified is controlled. In this way, the recognition accuracy of the unit type to which the IP address belongs is high, thereby improving the efficiency of risk control of the IP address according to the unit type to which the IP address belongs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network security technology, and in particular to an access control method, device, equipment, and medium. Background Art

[0002] In the existing IP (Internet Protocol Address) profiling technology principles, the identification of the unit associated with an IP address is mainly based on locating the IP address itself to obtain positioning information, and then finding the corresponding unit from the map based on the positioning information, thereby determining the unit type to which the IP address belongs.

[0003] The inventors have discovered that the above-mentioned prior art may have the following technical problems: when using IP addresses for positioning, the positioning information obtained is itself very inaccurate and has low precision. In addition, in cities with dense buildings, it is basically impossible to determine the specific community or building. Even if a specific building is located, there are generally various units in office buildings, and it is impossible to determine which type of unit a certain IP address corresponds to. This results in a low accuracy rate in identifying the type of unit to which the IP address belongs, which leads to low risk control efficiency for IP addresses. Summary of the invention

[0004] In view of this, the purpose of this application is to provide an access control method, device, equipment, and medium, which can identify the unit type to which an IP address belongs, thereby controlling the access request issued by the IP address according to the unit type to which the IP address belongs, and the recognition accuracy of the unit type to which the IP address belongs is high, thereby improving the efficiency of risk control of the IP address according to the unit type to which the IP address belongs. The specific scheme is as follows:

[0005] In a first aspect, the present application discloses an access control method, comprising:

[0006] Acquire training set data, wherein the training set data is log data with a unit type mark, and the log data includes a corresponding IP address;

[0007] Using the training set data to train a classification model pre-constructed based on a naive Bayes algorithm to obtain a trained classification model;

[0008] When the log data to be classified is obtained, the trained classification model is used to classify the log data to be classified, and the unit type to which the IP address to be classified in the log data to be classified belongs is obtained;

[0009] The access request sent by the IP address to be classified is controlled according to the unit type to which the IP address to be classified belongs.

[0010] Optionally, obtaining training set data includes:

[0011] Acquire an IP address library, wherein the IP address library includes different IP addresses and unit types corresponding to each IP address;

[0012] Get the access log collection in the target website access log library;

[0013] Marking each log data in the access log set with a unit type according to the IP address library;

[0014] The log data with unit type labeling is used as the training set data.

[0015] Optionally, the marking each log data in the access log set with a unit type according to the IP address library includes:

[0016] Determine the IP address in the current log data;

[0017] Determining the target unit type corresponding to the IP address in the current log data from the IP address library according to the IP address in the current log data;

[0018] The unit type to which the IP address in the current log data belongs is marked as the target unit type.

[0019] Optionally, the using of the training set data to train a classification model pre-constructed based on a naive Bayes algorithm to obtain a trained classification model includes:

[0020] Using the training set data to train a classification model pre-constructed based on a naive Bayes algorithm to obtain a classification model to be tested;

[0021] The classification model to be tested is tested, and when the test result of the classification model to be tested meets the preset requirements, a trained classification model is obtained.

[0022] Optionally, the using of the training set data to train a classification model pre-constructed based on a naive Bayes algorithm to obtain a classification model to be tested includes:

[0023] Extracting feature items from each log data in the training set data to obtain feature items corresponding to each log data in the training set data, wherein the feature items include access time, target website domain name, access terminal type, IP address, and unit type to which the IP address belongs;

[0024] The access time, the target website domain name, and the access terminal type are used as variables, and the unit type to which the IP address belongs is used as the classification result;

[0025] The feature items are input into a classification model pre-constructed based on a naive Bayes algorithm for training to obtain a classification model to be tested.

[0026] Optionally, the testing the test classification model includes:

[0027] Using the test set data to test the test classification model to obtain a test result;

[0028] The classification accuracy rate corresponding to the classification model to be tested is determined according to the test result.

[0029] Optionally, after determining the classification accuracy corresponding to the classification model to be tested according to the test result, the method further includes:

[0030] Determining whether the classification accuracy is not less than a preset accuracy threshold;

[0031] If the classification accuracy is not less than a preset accuracy threshold, the classification model to be tested is used as a trained classification model.

[0032] In a second aspect, the present application discloses an access control device, comprising:

[0033] A data acquisition module, used to acquire training set data, wherein the training set data is log data with a unit type mark, and the log data includes a corresponding IP address;

[0034] A model training module is used to train a classification model pre-constructed based on a naive Bayes algorithm using the training set data to obtain a trained classification model;

[0035] A classification module is used to classify the log data to be classified by using the trained classification model when the log data to be classified is obtained, so as to obtain the unit type to which the IP address to be classified in the log data to be classified belongs;

[0036] The risk control module is used to control the access request sent by the IP address to be classified according to the unit type to which the IP address to be classified belongs.

[0037] In a third aspect, the present application discloses an electronic device, comprising:

[0038] Memory and processor;

[0039] Wherein, the memory is used to store computer programs;

[0040] The processor is used to execute the computer program to implement the aforementioned access control method disclosed above.

[0041] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program, wherein the computer program implements the aforementioned disclosed access control method when executed by a processor.

[0042] It can be seen that the present application first obtains training set data, wherein the training set data is log data with a unit type mark, and the log data includes a corresponding IP address, and then uses the training set data to train a classification model pre-constructed based on the naive Bayes algorithm to obtain a trained classification model. When the log data to be classified is obtained, the trained classification model is used to classify the log data to be classified to obtain the unit type to which the IP address to be classified in the log data to be classified belongs, and then the access request issued by the IP address to be classified can be controlled according to the unit type to which the IP address to be classified belongs. In this way, the classification model pre-constructed based on the naive Bayes algorithm is first trained using the training set data to obtain a trained classification model. When the log data to be classified is obtained, the trained classification model can be used to classify the log data to be classified, so as to determine the unit type to which the IP address in the log to be classified belongs. Then, the access request issued by the IP address can be controlled according to the unit type to which the IP address belongs. The trained classification model is used to determine the unit type to which the IP address belongs. Compared with the prior art of directly using the IP address for positioning and then finding the unit type to which the IP address belongs based on the positioning information and the map, the recognition accuracy of the unit type to which the IP address belongs is higher, thereby improving the efficiency of risk control of the IP address according to the unit type to which the IP address belongs. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0044] Figure 1 A flow chart of an access control method disclosed in this application;

[0045] Figure 2 A specific access control method flow chart disclosed in this application;

[0046] Figure 3 A schematic diagram of the structure of an access control device disclosed in this application;

[0047] Figure 4 This is a schematic diagram of the structure of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0048] 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. Based on 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.

[0049] At present, the method for identifying the unit type to which an IP address belongs is to first use the IP address for positioning to obtain positioning information, and then use the obtained positioning information to determine the unit to which the IP address belongs from the map, thereby determining the unit type to which the IP address belongs. However, when using the IP address for positioning, the positioning information itself is very inaccurate and has low precision, and in cities with dense buildings, it is basically impossible to determine a specific community or building. Even if a specific building is located, there are various units in general office buildings, and it is impossible to determine which type of unit a certain IP address specifically corresponds to, which causes the problem of low accuracy in identifying the unit to which the IP address belongs. In view of this, the present application proposes an access control method that can identify the unit type to which the IP address belongs, thereby controlling the access request issued by the IP address according to the unit type to which the IP address belongs, and the recognition accuracy of the unit type to which the IP address belongs is high, thereby improving the efficiency of risk control of the IP address according to the unit type to which the IP address belongs.

[0050] See also Figure 1 As shown, the embodiment of the present application discloses an access control method, which includes:

[0051] Step S11: Acquire training set data, wherein the training set data is log data marked with a unit type, and the log data includes a corresponding IP address.

[0052] In a specific implementation process, it is necessary to first obtain training set data, wherein the training set data is log data with a unit type mark, and the log data includes a corresponding IP address.

[0053] Specifically, obtaining training set data includes: obtaining an IP address library, wherein the IP address library includes different IP addresses and unit types corresponding to each IP address; obtaining an access log set in a target website access log library; marking each log data in the access log set with a unit type according to the IP address library; and using the log data marked with a unit type as training set data.

[0054] IP addresses that have been clearly associated with specific units can be obtained from a third-party offline IP details library to obtain the IP address library, so that the IP address library includes different IP addresses and the unit type corresponding to each IP address. Then, an access log set can be obtained from the access log library of the target website. Access log data generated within a period of time in the access log library of the target website can be obtained to obtain the access log set. Then, each log data in the access log set can be marked with a unit type according to the IP address library, and the log data marked with a unit type is used as the training set data, and the log data without a marked unit type is deleted.

[0055] Among them, marking the unit type of each log data in the access log set according to the IP address library includes: determining the IP address in the current log data; determining the target unit type corresponding to the IP address in the current log data from the IP address library according to the IP address in the current log data; marking the unit type to which the IP address in the current log data belongs as the target unit type. That is, find out the IP address from the current log data, then find out the unit type to which the IP address in the current log data belongs from the IP address library, obtain the target unit type, and then mark the unit type to which the IP address in the current log data belongs as the target unit type.

[0056] Step S12: using the training set data to train the classification model pre-constructed based on the Naive Bayes algorithm to obtain a trained classification model.

[0057] It is understandable that after obtaining the training set data, the classification model pre-constructed based on the Naive Bayes algorithm can be trained using the training set data to obtain a trained classification model.

[0058] Specifically, the classification model pre-built based on the naive Bayes algorithm is first trained using the training set data to obtain a classification model to be tested, and then the classification model to be tested is tested, and when the test result of the classification model to be tested meets the preset requirements, the trained classification model is obtained.

[0059] Step S13: when the log data to be classified is obtained, the trained classification model is used to classify the log data to be classified, and the unit type to which the IP address to be classified in the log data to be classified belongs is obtained.

[0060] After obtaining the trained classification model, when the log data to be classified is obtained, the trained classification model can be used to classify the log to be classified to obtain the unit type to which the IP address to be classified in the log data to be classified belongs.

[0061] That is, when the log data to be classified is obtained, the log data to be classified is input into the trained classification model, and the output result of the trained classification model is the unit type to which the IP address in the log data to be classified belongs.

[0062] Step S14: Controlling the access request sent by the IP address to be classified according to the unit type to which the IP address to be classified belongs.

[0063] After determining the unit type to which the IP address to be classified in the log data to be classified belongs, the access request issued by the IP address to be classified can be controlled according to the unit type to which the IP address to be classified belongs. That is, IP address risk control can be performed according to the unit type to which the IP address to be classified belongs.

[0064] It can be seen that the present application first obtains training set data, wherein the training set data is log data with a unit type mark, and the log data includes a corresponding IP address, and then uses the training set data to train a classification model pre-constructed based on the naive Bayes algorithm to obtain a trained classification model. When the log data to be classified is obtained, the trained classification model is used to classify the log data to be classified to obtain the unit type to which the IP address to be classified in the log data to be classified belongs, and then the access request issued by the IP address to be classified can be controlled according to the unit type to which the IP address to be classified belongs. In this way, the classification model pre-constructed based on the naive Bayes algorithm is first trained using the training set data to obtain a trained classification model. When the log data to be classified is obtained, the trained classification model can be used to classify the log data to be classified, so as to determine the unit type to which the IP address in the log to be classified belongs. Then, the access request issued by the IP address can be controlled according to the unit type to which the IP address belongs. The trained classification model is used to determine the unit type to which the IP address belongs. Compared with the prior art of directly using the IP address for positioning and then finding the unit type to which the IP address belongs based on the positioning information and the map, the recognition accuracy of the unit type to which the IP address belongs is higher, thereby improving the efficiency of risk control of the IP address according to the unit type to which the IP address belongs.

[0065] See also Figure 2 As shown, the embodiment of the present application discloses a specific access control method, which includes:

[0066] Step S21: Acquire training set data, wherein the training set data is log data marked with a unit type, and the log data includes a corresponding IP address.

[0067] Step S22: using the training set data to train the classification model pre-constructed based on the Naive Bayes algorithm to obtain a classification model to be tested.

[0068] After obtaining the training set data, the training set data can be used to train the classification model pre-constructed based on the Naive Bayes algorithm to obtain a classification model with test.

[0069] Specifically, feature items are extracted for each log data in the training set data to obtain feature items corresponding to each log data in the training set data, wherein the feature items include access time, target website domain name, access terminal type, IP address, and the type of unit to which the IP address belongs; the access time, the target website domain name, and the access terminal type are used as variables, and the type of unit to which the IP address belongs is used as the classification result; the feature items are input into a classification model pre-constructed based on the Naive Bayes algorithm for training to obtain a classification model to be tested.

[0070] That is, it is necessary to first extract the access time, target website domain name, access terminal type, IP address and the type of unit to which the IP address belongs in each log data in the training set data, and obtain the feature items corresponding to each log data in the training set data, and use the access time, the target website domain name, and the access terminal type as variables, and the type of unit to which the IP address belongs as the classification result, and then input each feature item into the classification model pre-constructed based on the naive Bayes algorithm for training, so as to obtain the classification model to be tested.

[0071] The access time A1, target website domain name A2, and access terminal type A3 of each data in the training set are used as variables, and the unit type C is used as the classification result. Then, we want to find the value of C under the attributes A1, A2, and A3. j The probability of the conditional probability is P(C j |A1A2A3). According to the Bayesian formula, we can conclude that:

[0072]

[0073] Among them, P(C j |A1A2A3) means that under the condition that A1, A2, and A3 appear at the same time, C j The probability of occurrence, P(A1A2A3|C j ) means in C j Under the condition of occurrence, the probability of A1, A2, and A3 occurring simultaneously is P(C j ) means C j The probability of occurrence, P(A1A2A3) represents the probability of A1, A2, and A3 occurring at the same time.

[0074] Step S23: testing the classification model to be tested, and obtaining a trained classification model when the test result of the classification model to be tested meets preset requirements.

[0075] It is understandable that after obtaining the classification model to be tested, in order to ensure the accuracy of the classification model to be tested, the classification model to be tested needs to be tested first to determine whether the classification accuracy of the classification model to be tested can reach a preset accuracy threshold.

[0076] Specifically, the test classification model is tested using the test set data to obtain a test result; and the classification accuracy corresponding to the classification model to be tested is determined according to the test result. After the classification accuracy corresponding to the classification model to be tested is determined according to the test result, it also includes: judging whether the classification accuracy is not less than a preset accuracy threshold; if the classification accuracy is not less than the preset accuracy threshold, the classification model to be tested is used as a trained classification model.

[0077] Step S24: when the log data to be classified is obtained, the trained classification model is used to classify the log data to be classified, and the unit type to which the IP address to be classified in the log data to be classified belongs is obtained.

[0078] Step S25: Controlling the access request sent by the IP address to be classified according to the unit type to which the IP address to be classified belongs.

[0079] See also Figure 3 As shown, the embodiment of the present application discloses an access control device, including:

[0080] The data acquisition module 11 is used to acquire training set data, wherein the training set data is log data with unit type mark, and the log data includes the corresponding IP address;

[0081] A model training module 12 is used to train a classification model pre-constructed based on a naive Bayes algorithm using the training set data to obtain a trained classification model;

[0082] The classification module 13 is used to classify the log data to be classified by using the trained classification model when the log data to be classified is obtained, so as to obtain the unit type to which the IP address to be classified in the log data to be classified belongs;

[0083] The risk control module 14 is used to control the access request sent by the IP address to be classified according to the unit type to which the IP address to be classified belongs.

[0084] It can be seen that the present application first obtains training set data, wherein the training set data is log data with a unit type mark, and the log data includes a corresponding IP address, and then uses the training set data to train a classification model pre-constructed based on the naive Bayes algorithm to obtain a trained classification model. When the log data to be classified is obtained, the trained classification model is used to classify the log data to be classified to obtain the unit type to which the IP address to be classified in the log data to be classified belongs, and then the access request issued by the IP address to be classified can be controlled according to the unit type to which the IP address to be classified belongs. In this way, the classification model pre-constructed based on the naive Bayes algorithm is first trained using the training set data to obtain a trained classification model. When the log data to be classified is obtained, the trained classification model can be used to classify the log data to be classified, so as to determine the unit type to which the IP address in the log to be classified belongs. Then, the access request issued by the IP address can be controlled according to the unit type to which the IP address belongs. The trained classification model is used to determine the unit type to which the IP address belongs. Compared with the prior art of directly using the IP address for positioning and then finding the unit type to which the IP address belongs based on the positioning information and the map, the recognition accuracy of the unit type to which the IP address belongs is higher, thereby improving the efficiency of risk control of the IP address according to the unit type to which the IP address belongs.

[0085] Furthermore, the data acquisition module 11 is used to:

[0086] Acquire an IP address library, wherein the IP address library includes different IP addresses and unit types corresponding to each IP address;

[0087] Get the access log collection in the target website access log library;

[0088] Marking each log data in the access log set with a unit type according to the IP address library;

[0089] The log data with unit type labeling is used as the training set data.

[0090] Furthermore, the data acquisition module 11 is used to:

[0091] Determine the IP address in the current log data;

[0092] Determining the target unit type corresponding to the IP address in the current log data from the IP address library according to the IP address in the current log data;

[0093] The unit type to which the IP address in the current log data belongs is marked as the target unit type.

[0094] Specifically, the model training module 12 is used to:

[0095] Using the training set data to train a classification model pre-constructed based on a naive Bayes algorithm to obtain a classification model to be tested;

[0096] The classification model to be tested is tested, and when the test result of the classification model to be tested meets the preset requirements, a trained classification model is obtained.

[0097] Specifically, the model training module 12 is used to:

[0098] Extracting feature items from each log data in the training set data to obtain feature items corresponding to each log data in the training set data, wherein the feature items include access time, target website domain name, access terminal type, IP address, and unit type to which the IP address belongs;

[0099] The access time, the target website domain name, and the access terminal type are used as variables, and the unit type to which the IP address belongs is used as the classification result;

[0100] The feature items are input into a classification model pre-constructed based on a naive Bayes algorithm for training to obtain a classification model to be tested.

[0101] Furthermore, the model training module 12 is used to:

[0102] Using the test set data to test the test classification model to obtain a test result;

[0103] The classification accuracy rate corresponding to the classification model to be tested is determined according to the test result.

[0104] Furthermore, the model training module 12 is used to:

[0105] Determining whether the classification accuracy is not less than a preset accuracy threshold;

[0106] If the classification accuracy is not less than a preset accuracy threshold, the classification model to be tested is used as a trained classification model.

[0107] See also Figure 4 As shown, it is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 can specifically implement the access control method steps disclosed in the aforementioned embodiment.

[0108] Generally, the electronic device 20 in this embodiment includes: a processor 21 and a memory 22 .

[0109] Among them, the processor 21 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. The processor 21 may be implemented using at least one of DSP (digital signal processing), FPGA (field-programmable gate array), and PLA (programmable logic array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (central processing unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a GPU (graphics processing unit), which is responsible for rendering and drawing images that need to be displayed on the display screen. In some embodiments, the processor 21 may include an AI (artificial intelligence) processor, which is used to process computing operations related to machine learning.

[0110] The memory 22 may include one or more computer-readable storage media, which may be non-transitory. The memory 22 may also include a high-speed random access memory and a non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In this embodiment, the memory 22 is at least used to store the following computer program 221, wherein after the computer program is loaded and executed by the processor 21, the access control method steps disclosed in any of the aforementioned embodiments can be implemented.

[0111] In some embodiments, the electronic device 20 may further include a display screen 23 , an input / output interface 24 , a communication interface 25 , a sensor 26 , a power source 27 , and a communication bus 28 .

[0112] Those skilled in the art will understand that Figure 4 The structure shown in the figure does not constitute a limitation on the electronic device 20, and may include more or fewer components than those shown in the figure.

[0113] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the access control method disclosed in any of the aforementioned embodiments.

[0114] Among them, the specific process of the above-mentioned access control method can refer to the corresponding content disclosed in the above-mentioned embodiment, and will not be repeated here.

[0115] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0116] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0117] Finally, it should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a series of processes, methods, articles or equipment containing other elements include not only those elements, but also other elements not explicitly listed, or also include elements inherent to such processes, methods, articles or equipment. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or equipment that includes the elements.

[0118] The access control method, device, equipment, and medium provided by the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. An access control method, characterized in that: include: Acquire training set data, wherein the training set data is log data with a unit type mark, and the log data includes a corresponding IP address; The step of obtaining training set data includes: obtaining an IP address library, wherein the IP address library includes different IP addresses and unit types corresponding to each IP address; obtaining an access log set in a target website access log library; marking each log data in the access log set with a unit type according to the IP address library; and using the log data with the unit type marked as training set data; The step of marking the unit type of each log data in the access log set according to the IP address library includes: determining the IP address in the current log data; determining the target unit type corresponding to the IP address in the current log data from the IP address library according to the IP address in the current log data; marking the unit type to which the IP address in the current log data belongs as the target unit type; Using the training set data to train a classification model pre-constructed based on a naive Bayes algorithm to obtain a trained classification model; When the log data to be classified is obtained, the trained classification model is used to classify the log data to be classified, and the unit type to which the IP address to be classified in the log data to be classified belongs is obtained; The access request sent by the IP address to be classified is controlled according to the unit type to which the IP address to be classified belongs.

2. The access control method according to claim 1, characterized in that: The training set data is used to train the classification model pre-built based on the Naive Bayes algorithm to obtain a trained classification model, including: Using the training set data to train a classification model pre-constructed based on a naive Bayes algorithm to obtain a classification model to be tested; The classification model to be tested is tested, and when the test result of the classification model to be tested meets the preset requirements, a trained classification model is obtained.

3. The access control method according to claim 2, characterized in that: The training set data is used to train the classification model pre-built based on the Naive Bayes algorithm to obtain the classification model to be tested, including: Extracting feature items from each log data in the training set data to obtain feature items corresponding to each log data in the training set data, wherein the feature items include access time, target website domain name, access terminal type, IP address, and unit type to which the IP address belongs; The access time, the target website domain name, and the access terminal type are used as variables, and the unit type to which the IP address belongs is used as the classification result; The feature items are input into a classification model pre-constructed based on a naive Bayes algorithm for training to obtain a classification model to be tested.

4. The access control method according to claim 2, characterized in that: The testing of the test classification model comprises: Using the test set data to test the test classification model to obtain a test result; The classification accuracy rate corresponding to the classification model to be tested is determined according to the test result.

5. The access control method according to claim 4, characterized in that: After determining the classification accuracy rate corresponding to the classification model to be tested according to the test result, the method further includes: Determining whether the classification accuracy is not less than a preset accuracy threshold; If the classification accuracy is not less than a preset accuracy threshold, the classification model to be tested is used as a trained classification model.

6. An access control device, characterized in that: include: A data acquisition module is used to acquire training set data, wherein the training set data is log data with unit type marks, and the log data includes corresponding IP addresses; wherein the data acquisition module is specifically used to: acquire an IP address library, wherein the IP address library includes different IP addresses and unit types corresponding to each IP address; acquire an access log set in a target website access log library; perform unit type marks on each log data in the access log set according to the IP address library; and use the log data marked with unit type as training set data; wherein the data acquisition module is specifically used to: determine the IP address in the current log data; determine the target unit type corresponding to the IP address in the current log data from the IP address library according to the IP address in the current log data; and mark the unit type to which the IP address in the current log data belongs as the target unit type; A model training module is used to train a classification model pre-constructed based on a naive Bayes algorithm using the training set data to obtain a trained classification model; A classification module is used to classify the log data to be classified by using the trained classification model when the log data to be classified is obtained, so as to obtain the unit type to which the IP address to be classified in the log data to be classified belongs; The risk control module is used to control the access request sent by the IP address to be classified according to the unit type to which the IP address to be classified belongs.

7. An electronic device, characterized in that: include: Memory and processor; Wherein, the memory is used to store computer programs; The processor is used to execute the computer program to implement the access control method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein the computer program, when executed by a processor, implements the access control method according to any one of claims 1 to 5.