Captcha code generation method, system and device based on adversarial learning and storage medium
By generating CAPTCHAs through adversarial learning, a training and validation model set is constructed. Adversarial CAPTCHAs are generated, and the generation model is determined when the recognition rate meets the threshold. This solves the problems of traditional CAPTCHA defense technology being unable to resist attacks from black market operators and having a poor user experience, and achieves a balance between security and recognition accuracy.
Patent Information
- Application Number
- CN202210578854.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-25
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2042-05-25
AI Technical Summary
Traditional CAPTCHA defense technologies are ineffective in preventing malicious access by black market operators, and sacrificing user recognition accuracy to improve security results in a poor user experience.
An adversarial learning-based CAPTCHA generation method is adopted. By obtaining a preset configuration file, a training and validation model group is constructed to generate adversarial CAPTCHAs. When the recognition rate is less than a threshold, the generation model is determined to generate CAPTCHAs.
It improves the security of CAPTCHAs while also ensuring human eye recognition accuracy, thus enhancing the user experience.
Smart Images

Figure CN114840839B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of big data processing, and more particularly, to a verification code generation method and system based on adversarial learning, a device and a storage medium. BACKGROUND
[0002] The verification code is a defense means for identifying normal users or black production malicious access through Turing test, which can prevent malicious password cracking, malicious access to target programs, effectively prevent a certain hacker from using a specific program package to crack a certain specific registered user, and avoid network congestion or even service paralysis caused by program access due to the above situations.
[0003] However, with the rapid development of computers, especially the rapid development of neural network technology, image recognition technology is increasingly mature, and traditional verification code defense technology has been unable to effectively intercept black production malicious access, and the verification code defense technology has gradually lost its due function.
[0004] At present, in order to improve the defense level of the verification code and ensure the safety of the program running environment, the means used at present is to sacrifice the human eye recognition degree of the verification code, thereby reducing the success rate of the hacker program to recognize the verification code, and then improving the defense level of the verification code and ensuring the safety of the program running environment. However, this means also reduces the accuracy of the normal login user inputting the verification code, thereby causing the problem of poor user experience. Therefore, how to effectively improve the security of the verification code is a problem to be solved. SUMMARY
[0005] The present application provides a verification code generation method and system based on adversarial learning, a device and a storage medium to solve the problem of effectively improving the security of the verification code.
[0006] According to a first aspect of the present application, a verification code generation method based on adversarial learning is provided, comprising:
[0007] Obtaining a preset configuration file, extracting a model in a recognition model pool according to the preset configuration file, and constructing a training model group and a verification model group based on a generative adversarial network;
[0008] Constructing a generation model according to the preset configuration file and the training model group;
[0009] Obtaining an adversarial verification code output by the generation model, calculating an identification rate of the adversarial verification code according to the adversarial verification code and the verification model group;
[0010] When the identification rate is less than a preset threshold, the generation model is determined as a verification code model for generating a verification code.
[0011] On the basis of the above technical solutions, the application can also be improved as follows.
[0012] Optionally, before the step of extracting the model from the model pool according to the preset configuration file, the method further comprises:
[0013] constructing a model pool according to the preset configuration file;
[0014] acquiring historical verification code data, performing transfer training on each recognition model in the model pool according to the historical verification code data, and updating the model pool.
[0015] Optionally, the method further comprises:
[0016] when the recognition rate is not less than a preset threshold, updating the adversarial verification code to the historical verification code data;
[0017] updating the generation model according to the preset configuration file, the updated training model group and the updated historical verification code data, and updating the verification code model using the updated generation model.
[0018] Optionally, the step of constructing a generation model according to the preset configuration file and the training model group comprises:
[0019] acquiring a task type in the preset configuration file, and constructing a corresponding loss function according to the task type;
[0020] iterating the training model group according to the preset configuration file, minimizing the loss function, and outputting a generation model.
[0021] Optionally, the task type comprises a nine-square grid verification task, a prompt word verification task, a point selection verification task and a language verification task.
[0022] Optionally, the step of acquiring an adversarial verification code output by the generation model and calculating the recognition rate of the adversarial verification code according to the adversarial verification code and the verification model group comprises:
[0023] acquiring a preset number of adversarial verification codes output by the generation model;
[0024] identifying the preset number of adversarial verification codes according to the verification model group, and calculating the recognition rate of the preset number of adversarial verification codes
[0025] Optionally, the training model group and the verification model group each comprise a picture classification model cluster, a target detection model cluster, a language sequence recognition model cluster and a speech recognition model cluster.
[0026] According to a second aspect of the present application, there is provided a CAPTCHA generation system based on adversarial learning, comprising:
[0027] a model construction module configured to obtain a preset configuration file, extract a model from a model pool according to the preset configuration file, and construct a training model group and a verification model group based on a generative adversarial network;
[0028] a model generation module configured to construct a generation model according to the preset configuration file and the training model group;
[0029] a rate value calculation module configured to obtain an adversarial CAPTCHA output by the generation model, and calculate an adversarial CAPTCHA recognition rate according to the adversarial CAPTCHA and the verification model group;
[0030] a model determination module configured to determine the generation model as a CAPTCHA model for generating a CAPTCHA when the recognition rate is less than a preset threshold.
[0031] According to a third aspect of the present application, there is provided an apparatus comprising a memory and a processor, wherein the processor is configured to implement the steps of any of the CAPTCHA generation methods based on adversarial learning of the first aspect when executing a computer management program stored in the memory.
[0032] According to a fourth aspect of the present application, there is provided a computer readable storage medium having a computer management program stored thereon, wherein the computer management program is configured to implement the steps of any of the CAPTCHA generation methods based on adversarial learning of the first aspect when executed by a processor.
[0033] The application provides a Captcha generation method, system, device and storage medium based on adversarial learning, which comprises the following steps: obtaining a preset configuration file, extracting a model in a recognition model pool according to the preset configuration file, and constructing a training model group and a verification model group based on a generative adversarial network; constructing a generation model according to the preset configuration file and the training model group; obtaining an adversarial Captcha output by the generation model, calculating the recognition rate of the adversarial Captcha according to the adversarial Captcha and the verification model group; and determining the generation model as a Captcha model for generating Captcha when the recognition rate is less than a preset threshold. According to the preset configuration file, the model in the recognition model pool is extracted to construct the training model group and the verification model group, the generation model is constructed according to the training model and the configuration file, and the adversarial Captcha is output, the adversarial Captcha is input into the verification model group, so that the Captcha is verified, and the generation model is determined according to the verification result, so that the adversarial sample technology is applied to the Captcha recognition process, and an effective verification mechanism is provided for the generation model, thereby ensuring the security of the Captcha. Moreover, the generation model is generated based on the configuration file, so that the identifiable degree of the Captcha can be adjusted by setting the configuration file, the human eye recognition rate is reasonably considered, and the user experience is improved. BRIEF DESCRIPTION OF DRAWINGS
[0034] Figure 1 A Captcha generation method based on adversarial learning is provided.
[0035] Figure 2 A Captcha generation system based on adversarial learning is provided.
[0036] Figure 3 A working flowchart of an attack module is provided.
[0037] Figure 4 A working flowchart of an automatic update module is provided.
[0038] Figure 5 A general user access diagram is provided.
[0039] Figure 6 A black production user access diagram is provided.
[0040] Figure 7 An induced environment user access diagram is provided.
[0041] Figure 8 A model library update diagram is provided.
[0042] Figure 9 A Captcha generation system based on adversarial learning is provided.
[0043] Figure 10 A possible hardware structure schematic diagram of the device provided by the present application is shown in the following figure:
[0044] Figure 11 A possible hardware structure schematic diagram of the computer readable storage medium provided by the present application is shown in the following figure. DETAILED DESCRIPTION
[0045] The specific embodiments of the present application will be further described in detail below in combination with the drawings and examples. The following examples are used to illustrate the present application, but not to limit the scope of the present application.
[0046] Figure 1 A flow chart of the CAPTCHA generation method based on adversarial learning provided by the present application is shown in the following figure: Figure 1 As shown in the figure, the method comprises:
[0047] Step S100: Obtain a preset configuration file, extract a model in a recognition model pool according to the preset configuration file, and construct a training model group and a verification model group based on a generative adversarial network;
[0048] It should be noted that the execution subject of the method of the present embodiment can be a computer terminal device with data processing, network communication and program running functions, such as a computer, a tablet computer, etc. It can also be a server device with the same or similar functions, and it can also be a cloud server virtual device with the same or similar functions. The present embodiment does not limit this. In order to facilitate understanding, the present embodiment and the following embodiments will be described taking a server device as an example.
[0049] It can be understood that the models in the above-mentioned recognition model pool can include mainstream picture classification model clusters, target detection model clusters, sequence recognition model clusters and / or speech recognition model clusters, etc. The above-mentioned recognition models can be used to recognize nine-square CAPTCHAs, character CAPTCHAs, sequence CAPTCHAs and / or speech CAPTCHAs, etc. The present embodiment does not limit this. For example, the picture classification model cluster can include vit / resnet / inception series models, and the target detection model cluster can include yolov3, yolov4, yolov5, etc.
[0050] It should be understood that the above-mentioned models can be trained by using a basic CAPTCHA database, so that the above-mentioned models have the ability to recognize CAPTCHAs. The models in the above-mentioned recognition model pool can be corresponding recognition models directly obtained from a prepared model pool, can be dynamically obtained from third-party interface transmission, or can be obtained from the recognition models output by the present embodiment. The present embodiment does not limit this.
[0051] It is also understood that the aforementioned basic CAPTCHA database can be a pre-prepared CAPTCHA material library, or it can be obtained in real time from a third-party material library through manual means. This embodiment does not impose any restrictions on this.
[0052] It should also be understood that the aforementioned transfer training of recognition models in the recognition model pool can be performed using corresponding CAPTCHA data. For example, for character verification and prompts for nine-square grid and icon selection, an RCNN (Region-CNN) model can be trained; for nine-square grid CAPTCHAs, a CNN (Convolutional Neural Networks) image recognition model can be trained; for text / icon selection, an object detection model can be trained; and for voice verification, a speech recognition model can be trained.
[0053] It should also be noted that the training and validation model groups built on generative adversarial networks mentioned above can be training and validation model groups built on ensemble models.
[0054] Step S200: Construct and generate a model based on the preset configuration file and the training model group;
[0055] It should be noted that the above steps for building a generative model can be based on iterative FGSM (Fastgradient sign method) / PGD (projected gradient descent), optimization-based C&W (a model whose final task is to learn and optimize word vectors), or adversarial example generation techniques based on GAN (Generative Adversarial Nets), and are used to iteratively build a generative model on the training group ensemble model.
[0056] Step S300: Obtain the adversarial verification code output by the generation model, and calculate the recognition rate of the adversarial verification code based on the adversarial verification code and the verification model group;
[0057] Step S400: When the recognition rate is less than a preset threshold, the generation model is determined as a verification code model to generate a verification code.
[0058] It should be noted that the aforementioned preset threshold can be obtained by calculating the average of the recognition accuracy of all verification codes, or it can be configured by the administrator in the configuration parameters. This embodiment does not impose any restrictions on this.
[0059] In a specific implementation, the generation model is used to generate the CAPTCHA, the verification model group is used to identify the CAPTCHA, and when the identification rate of the CAPTCHA generated by the generation model is less than a preset value, it is determined that the CAPTCHA output by the generation model can mislead the verification model, the iteration is stopped, the generation model at this time is output as the generation model, and version management is performed.
[0060] It can be understood that, based on the defects in the background art, the embodiment of the present application proposes a CAPTCHA generation method based on adversarial learning. The embodiment of the present application extracts a model in a recognition model pool according to a preset configuration file, and constructs a training model group and a verification model group based on a generative adversarial network; a generation model is constructed according to the preset configuration file and the training model group; an adversarial CAPTCHA output by the generation model is obtained, and the identification rate of the adversarial CAPTCHA is calculated according to the adversarial CAPTCHA and the verification model group; when the identification rate is less than a preset threshold, the generation model is determined as a CAPTCHA model for generating a CAPTCHA. According to the preset configuration file, the model in the recognition model pool is extracted to construct the training model group and the verification model group, and the generation model is constructed according to the training model and the configuration file and outputs the adversarial CAPTCHA. The adversarial CAPTCHA is input into the verification model group, so as to verify the CAPTCHA, and the generation model is determined according to the verification result, so that the adversarial sample technology is applied to the CAPTCHA identification process, thereby providing an effective verification mechanism for the generation model, thereby ensuring the security of the CAPTCHA. And because the generation model is generated based on the configuration file, the recognizability of the CAPTCHA can be adjusted by setting the configuration file, thereby reasonably balancing the human eye recognition rate, thereby improving the user experience.
[0061] In a possible embodiment, before the step of extracting a model in a recognition model pool according to the preset configuration file, the method further includes:
[0062] Step S01: constructing a recognition model pool according to the preset configuration file;
[0063] Step S02: obtaining historical CAPTCHA data, performing migration training on each recognition model in the recognition model pool according to the historical CAPTCHA data, and updating the recognition model pool.
[0064] In the embodiment method, the recognition model pool is constructed, and the recognition models in the model pool are preliminarily trained using the historical CAPTCHA data, so that the recognition models in the model pool have the ability to identify the CAPTCHA, and then the model is trained twice in combination with the subsequent steps, thereby further improving the security of the CAPTCHA.
[0065] In a possible implementation, for ease of understanding, the method further includes:
[0066] Step S401: updating the adversarial verification code into the historical verification code data when the recognition rate is not less than a preset threshold;
[0067] It should be noted that the updating of the adversarial verification code into the historical verification code data can be merging the generated adversarial verification code with the historical verification code.
[0068] Step S402: updating the generation model according to the preset configuration file, the training model group, and the updated historical verification code data, and updating the verification code model with the updated generation model.
[0069] In the embodiment of the application, the verification code in the adversarial process is merged with the historical verification code, thereby increasing the number of training samples, improving the diversity of the samples, and further improving the security of the generation model and the security of the verification code output by the generation model.
[0070] In a possible implementation, for ease of understanding, the step of constructing the generation model according to the preset configuration file and the training model group includes:
[0071] Step S201: obtaining a task type in the preset configuration file, and constructing a corresponding loss function according to the task type;
[0072] Step S202: iterating the training model group according to the preset configuration file, minimizing the loss function, and outputting a generation model.
[0073] In a possible implementation, the task type includes a nine-square verification task, a prompt word verification task, a point selection verification task, and a language verification task.
[0074] In a possible implementation, the step of obtaining the adversarial verification code output by the generation model and calculating the recognition rate of the adversarial verification code according to the adversarial verification code and the verification model group includes:
[0075] Step S301: obtaining a preset number of adversarial verification codes output by the generation model;
[0076] It should be noted that the preset number can be set by an administrator according to actual conditions, and in general, in order to improve the accuracy of the test result, the preset number is set as large as possible, for example, 1000.
[0077] Step S302: According to the verification model group, the pre-set number of anti-codes is identified, and the recognition rate of the pre-set number of anti-codes is calculated.
[0078] In a possible embodiment, the training group model and the verification group model each include: a picture classification model cluster, a target detection model cluster, a syntax recognition model cluster, and a speech recognition model cluster.
[0079] In a possible embodiment, the pre-set configuration file includes: a task type, a type of anti-code to be generated, a maximum L-p constraint of anti-interference, and a test evaluation threshold.
[0080] In a possible embodiment, for ease of understanding, the embodiment of the application also provides a system architecture diagram of the anti-code generation system based on adversarial learning, as shown in Figure 2 , Figure 2 The application provides a schematic diagram of the architecture of the anti-code generation system based on adversarial learning. The system includes a model pool, a configuration module, an attack module, an evaluation module, a monitoring module, and an automatic updating module. The model pool is used to train the identification model using initial anti-codes and store the obtained trained model; the configuration module can be used to configure a task type, a type of anti-code to be generated, for example, a nine-square grid, text point selection, or speech recognition and face recognition, and a maximum L-p constraint of anti-interference (controlling the maximum interference noise acceptable to the human eye / ear), and a test evaluation threshold; the attack module is used to output a generated model according to the related parameters of the configuration module; the evaluation module is used to evaluate the anti-codes generated by the generated model; the monitoring module is used to monitor the recognition of online anti-codes in real time; and the automatic updating module is used to determine whether the generated model needs to be updated.
[0081] In a possible application scenario, the construction of the model pool includes: the model pool refers to a model set that can be used to identify anti-codes, and includes: a mainstream picture classification model cluster, a target detection model cluster, a syntax recognition model cluster, and / or a speech recognition model cluster. Each model cluster contains models of different structures to increase the diversity of the models in the same cluster. For example, the picture classification model cluster can include vit / resnet / inception series models, the target detection model cluster can include yolov3, yolov4, yolov5, fast-rcnn, ssd, etc.
[0082] The models in the model pool can be selected by an administrator in advance, can be generated during the output of the generated model, or can be updated by the administrator according to the latest identification model.
[0083] Since the initial untrained model is directly used to participate in generating the adversarial sample and outputting the generation model, it will cause the quality of the adversarial sample to be reduced, and the security of the verification code generated by the generation model is unstable, so it cannot be directly used to participate in the process of generating the adversarial sample and outputting the generation model, in the embodiment, the untrained model is first trained by the verification code in the historical verification code material library, so as to obtain a preliminary trained model.
[0084] Among them, the identification model in the model pool is used to generate corresponding training models, attack models and verification models according to requirements.
[0085] In a possible application scenario, the configuration module is configured: the configuration module provides an entrance for user interaction in the system, and provides the user with: task type, adversarial verification code type, adversarial interference constraint and / or evaluation threshold.
[0086] Since the recognition of the human eye and / or human ear to the verification code and the security of the verification code are two conditions that are opposite and restrictive to each other, and the recognition degree of the human to the verification code is not the same in different scenes, it is necessary to set the maximum interference noise acceptable by the human by configuring an initial adversarial interference constraint, and the maximum interference noise can be judged and optimized by the recognition accuracy of the verification code output by the generation model in the actual production environment.
[0087] At the same time, the evaluation threshold can be configured by the user on the configuration module, and is a standard for judging the effect of the adversarial sample generated by the generation model. The recognition rate of the evaluation model to the adversarial sample output by the generation model is calculated, and the evaluation threshold is used to compare with the above recognition rate to judge the security level of the above generation model.
[0088] In a possible application scenario, the process of outputting the generation model G by the attack module includes: Figure 3 , Figure 3 The workflow diagram of the attack module provided by the present application; wherein the step of outputting the generation model by the attack module includes:
[0089] Step S1001: obtaining configuration parameter information, verification code type, adversarial noise L-P constraint;
[0090] It should be noted that the above configuration parameter information can be the task type and / or adversarial verification code type configured in the configuration module, or the running environment parameters of the system configured by the administrator according to the server performance.
[0091] It can be understood that the above verification code type can include: picture verification code, text point selection verification code, icon point selection verification code and / or voice verification code.
[0092] Step S1002: extracting a training model A and a verification model B from the model pool according to the verification code type;
[0093] It should be noted that the training model A and the verification model B are models in the model pool that have been initially trained, and the process of extracting the model according to the verification code type can be understood as extracting the corresponding model according to the type of verification code that needs to be generated, for example: selecting a target detection model for character verification and icon selection verification code, selecting an icon recognition model for nine-square verification code, and selecting a speech recognition model for voice verification code.
[0094] Step S1003: loading all the data of the type of verification code, and initializing the iteration number iter to 0;
[0095] It can be understood that the above-mentioned all data can be a basic verification code database, which can be a pre-prepared verification code material library, or can be obtained in real time from a third-party material library by manual artificial means, and the present embodiment does not limit this.
[0096] Step S1004: using GAN to train an adversarial verification code generation network G for the recognition model A;
[0097] It should be noted that GAN (Generative Adversarial Nets, adversarial generative network) is a deep learning model based on adversarial sample generation technology.
[0098] In specific implementation, GAN constructs a corresponding generation model G and a loss function L according to the recognition model A, iteratively runs the training program, minimizes the loss function L, until the adversarial sample output by the generation model G can mislead the verification model B, stops iteration, and outputs the generation model G at this time.
[0099] Step S1005: generating 1000 adversarial verification codes for the recognition model A using the generation network G;
[0100] Step S1006: calculating the accuracy acc of the 1000 adversarial verification codes on the verification model B, and when the above-mentioned accuracy acc is not less than a preset threshold, setting the iteration number to be increased by one, and re-executing step S1004;
[0101] Step S1007: when the above-mentioned accuracy acc is less than the preset threshold, outputting the generation model G.
[0102] In the above application scenarios, the embodiments of the present application extract a training model A and a verification model B from a model pool, and iteratively identify a generation model G on a GAN that meets the requirements of the model output, and verify the generation model G through the verification model B, and output the generation model G when the CAPTCHA generated by the generation model G meets the requirements; thereby applying the adversarial sample technology to the attack and defense confrontation scene of the CAPTCHA, increasing the security of the CAPTCHA, and using the adversarial CAPTCHA generation architecture based on GAN to decouple the training and generation of the adversarial CAPTCHA, reducing the engineering cost. Since the training model includes a target detection model, an icon recognition model and / or a speech recognition model, the type of the output generation model G can be automatically switched according to the requirements, thereby meeting the needs of different users.
[0103] In a possible application scenario, an evaluation model is also included: the evaluation model is a test model C extracted from the model pool, wherein the test model C is a recognition model different from the training model A and the verification model B, and the evaluation model is used to identify the adversarial CAPTCHA generated by the generation model G and calculate the recognition accuracy.
[0104] In a possible application scenario, a monitoring module is also included, which is used to monitor the online CAPTCHA in real time, count the verification passing rate of each CAPTCHA form, and visually display it; and is also used to monitor the growth of the passing amount in each hour of each day, and send an overrun alarm to the automatic update module when the growth of the passing amount exceeds a preset threshold. The above-mentioned preset threshold can be set by the administrator during system initialization.
[0105] In a possible application scenario, an automatic update module is also included, which is used to trigger an update when receiving an overrun alarm, that is, if the monitoring module finds that the passing amount of a certain CAPTCHA form increases sharply, the automatic update module is triggered to update the generation model G.
[0106] Referring to Figure 4 , Figure 4 The workflow diagram of the automatic update module provided by the present application.
[0107] In a possible application scenario, the workflow of the automatic update module includes:
[0108] Step S2001: monitoring and counting the passing amount of each verification form and the growth of the passing amount;
[0109] Step S2002: obtaining the current generation model and configuration parameters when the growth of the passing amount exceeds the threshold;
[0110] Step S2003: submitting the generation model and configuration parameters to the training module for retraining.
[0111] In the above application scenarios, the embodiments of the present application judge the adversarial effect of the adversarial verification code generated by the generation model by monitoring the pass volume and the pass volume growth of each verification form. When the pass volume growth exceeds a threshold value, it is determined that the adversarial effect of the adversarial verification code generated by the generation model has seriously degraded. The generation model and the configuration parameters are submitted to the training model, and the configuration parameter information in the configuration module is updated, so that the generation model can cope with different cracking models, and the generation model can be automatically updated when the adversarial effect degrades, without human intervention, reducing the degree of human participation, and increasing the security of the verification code.
[0112] In a possible application scenario, the target system is accessed by a normal user, as shown in Figure 5 , Figure 5 The present application provides a schematic diagram of a normal user accessing. In the figure, user A is a normal user, user A accesses the target system deployed in the cloud through the client, and the cloud is deployed with the adversarial learning-based verification code generation system and the target system; wherein the access process can be: user A sends an access request to the target system through the client, the access is forwarded to the adversarial learning-based verification code generation system, the adversarial learning-based verification code generation system outputs the adversarial verification code, user A identifies the adversarial verification code and inputs the adversarial verification code according to the prompt of the adversarial learning-based verification code generation system, the adversarial learning-based verification code generation system allows user A to continue accessing the target system after judging that the input verification code of user A is correct, and forwards the access request to the target system.
[0113] In a possible application scenario, user A is marked as a normal user by the adversarial learning-based verification code generation system, user A inputs the wrong answer multiple times when inputting the adversarial verification code identified by user A within one day, the adversarial learning-based verification code generation system records that the maximum L-p constraint value of the adversarial interference is too large, the adversarial learning-based verification code generation system automatically reduces the maximum L-p constraint value of the adversarial interference, updates the configuration parameters in the configuration module, and re-trains the generation model, thereby ensuring that the normal user can easily identify the verification code generated by the generation model and improving the usability of the verification code.
[0114] In a possible application scenario, the adversarial learning-based verification code generation system records the pass rate of each user marked as a normal user. When the pass rate is 100% within ten days, it is determined that the maximum L-p constraint value of the adversarial interference is too small, the adversarial learning-based verification code generation system automatically increases the maximum L-p constraint value of the adversarial interference, updates the configuration parameters in the configuration module, and re-trains the generation model, thereby increasing the security of the verification code generated by the generation model.
[0115] In a possible application scenario, the target system is accessed by a black production user, as shown inFigure 6 , Figure 6 The black production user access schematic diagram provided by the present application is shown in the figure. In the figure, the black production B is an abnormal black production user, the black production B accesses the target system deployed in the cloud through the client, the cloud is deployed with the anti-learning-based CAPTCHA generation system and the target system of the embodiment; wherein the access process can be: the black production user B sends an access request to the target system through the client, the above-mentioned access request is forwarded to the anti-learning-based CAPTCHA generation system, the anti-learning-based CAPTCHA generation system outputs the anti-learning-based CAPTCHA, the black production user B identifies the anti-learning-based CAPTCHA and inputs the anti-learning-based CAPTCHA according to the prompt of the anti-learning-based CAPTCHA generation system, and the anti-learning-based CAPTCHA generation system prohibits the black production user B from continuing to access the target system after judging that the black production user B inputs the CAPTCHA abnormally.
[0116] In a possible application scenario, the normal user and the black production user access the target system at the same time. Referring to Figure 7 , Figure 7 The induced environment user access schematic diagram provided by the present application is shown in the figure. In the figure, the user A is a normal access user, the black production B is an abnormal access user, the target system, the induced system and the anti-learning-based CAPTCHA generation system are deployed in the cloud server end, and the user A and the black production B access the target system deployed in the cloud through the client, wherein the access process can be: the user A and the black production B send an access request to the target system through the client, the above-mentioned access is forwarded to the anti-learning-based CAPTCHA generation system, the anti-learning-based CAPTCHA generation system outputs the anti-learning-based CAPTCHA, the user A and the black production B identify the anti-learning-based CAPTCHA and input the anti-learning-based CAPTCHA according to the prompt of the anti-learning-based CAPTCHA generation system, the anti-learning-based CAPTCHA generation system allows the user A to continue to access the target system after judging that the user A inputs the CAPTCHA correctly, and forwards the access request to the target system, and the anti-learning-based CAPTCHA generation system prohibits the black production user B from continuing to access the target system after judging that the black production user B inputs the CAPTCHA abnormally.
[0117] In a possible application scenario, when the black production user B accesses the target system, the CAPTCHA generation system based on adversarial learning monitors the passing rate of all CAPTCHAs of the black production user B and the time of inputting the CAPTCHA, and when the passing rate is greater than a set threshold and the time is within a normal range, it is determined that the maximum L-p constraint value of the adversarial interference is too small, the CAPTCHA generation system based on adversarial learning automatically increases the maximum L-p constraint value of the adversarial interference, updates the configuration parameters in the configuration module, re-trains the generation model and updates the generation model, continues to detect the CAPTCHA passing rate and the CAPTCHA input time of the black production user B, and when the CAPTCHA passing rate of the black production user B decreases significantly, it is determined that the black production user B is an abnormal user, and the IP address and account of the black production user B are set as abnormal users; and when the black production user B passes the CAPTCHA verification, the access request of the black production user is forwarded to the induction system, wherein the access of each module in the induction system needs to be verified again using the CAPTCHA, the CAPTCHA generation system based on adversarial learning monitors the recognition of the black production user B to different CAPTCHAs for self-learning, and further optimizes the generation model, so as to effectively cope with the endless black production attack and improve the security of the CAPTCHA.
[0118] It can be understood that the set threshold corresponding to the passing rate can be obtained by calculating the average passing rate of all users, or can be set by the administrator at the initialization time, and generally can be 90%, 85% or 80%.
[0119] It should be understood that the normal range corresponding to the time can be the time of inputting the CAPTCHA by all users, or can be set by the administrator at the initialization time, and generally can be 10s, 20s or 30s.
[0120] In a possible application scenario, the model library is automatically updated. Referring to Figure 8 , Figure 8 The model library update schematic diagram provided by the present application. In the figure, the CAPTCHA generation system based on adversarial learning is a server deployed in the cloud, and the clients A, B, N are client servers deployed with the CAPTCHA generation system based on adversarial learning. Since the model used by the black production user to attack the CAPTCHA is also updated iteratively, when the client uses the CAPTCHA generation system based on adversarial learning provided by the present application, it may consider the cost factor and choose to simplify the deployment, and the simplified deployment form is generally that the client end is deployed with the generation model, the data sending module and the data receiving module, and the cloud server is deployed with the complete CAPTCHA generation system based on adversarial learning.
[0121] In a possible application scenario, the cloud server segment deploys the CAPTCHA generation system based on adversarial learning to obtain the CAPTCHA in the client through data communication with the client, judge whether the adversarial effect of the CAPTCHA appears degradation, and update the generation model in the client when the degradation appears.
[0122] Figure 9 A structure diagram of a CAPTCHA generation system based on adversarial learning provided for an embodiment of the application is shown in FIG. 1, which includes a model construction module 100, a model generation module 200, a rate value calculation module 300, and a model determination module 400. Figure 9
[0123] The model construction module 100 is configured to obtain a preset configuration file, extract a model in a recognition model pool according to the preset configuration file, and construct a training model group and a verification model group based on a generative adversarial network.
[0124] The model generation module 200 is configured to construct a generation model according to the preset configuration file and the training model group.
[0125] The rate value calculation module 300 is configured to obtain an adversarial CAPTCHA output by the generation model, calculate an adversarial CAPTCHA recognition rate according to the adversarial CAPTCHA and the verification model group.
[0126] The model determination module 400 is configured to determine the generation model as a CAPTCHA model for generating a CAPTCHA when the recognition rate is less than a preset threshold.
[0127] The embodiment of the present application provides a kind of verification code generation system based on adversarial learning, by obtaining preset configuration file, model in identification model pool is extracted according to the above-mentioned preset configuration file, and training model group and verification model group are constructed based on generative adversarial network;According to the above-mentioned preset configuration file and the above-mentioned training model group, generate model is constructed;Adversarial verification code output by generation model is obtained, and according to the above-mentioned adversarial verification code and the above-mentioned verification model group, the recognition rate of adversarial verification code is calculated;When the above-mentioned recognition rate is less than preset threshold, the above-mentioned generation model is determined as verification code model to generate verification code.The present application extracts the model in identification model pool according to preset configuration file to construct training model group and verification model group, and generates model is constructed according to training model and configuration file and outputs adversarial verification code, and the adversarial verification code is input into verification model group, so as to verify the verification code, and the generation model is determined according to the verification result, so that adversarial sample technology can be applied to verification code identification process, and then effective verification mechanism is provided for generation model, thereby ensuring the security of verification code, and since generation model is generated by more configuration file, the identifiable degree of verification code can be adjusted by setting configuration file, and then the use experience of user is improved by reasonably considering human eye recognition rate.
[0128] It can be understood that the verification code generation system based on adversarial learning provided by the present application corresponds to the verification code generation method based on adversarial learning provided by the above-mentioned embodiments, and the related technical features of the verification code generation system based on adversarial learning can refer to the related technical features of the verification code generation method based on adversarial learning, which will not be repeated here.
[0129] Please refer to Figure 10 , Figure 10 The embodiment of the present application provides the embodiment of the device. As shown in Figure 10 , the present application provides a kind of device, including memory 1310, processor 1320 and computer program 1311 stored in memory 1310 and can be run on processor 1320, when processor 1320 executes computer program 1311, the following steps are realized: obtaining preset configuration file, model in identification model pool is extracted according to the above-mentioned preset configuration file, and training model group and verification model group are constructed based on generative adversarial network;According to the above-mentioned preset configuration file and the above-mentioned training model group, generate model is constructed;Adversarial verification code output by generation model is obtained, and according to the above-mentioned adversarial verification code and the above-mentioned verification model group, the recognition rate of adversarial verification code is calculated;When the above-mentioned recognition rate is less than preset threshold, the above-mentioned generation model is determined as verification code model to generate verification code.
[0130] It can be understood that the device provided by the present application corresponds to the verification code generation method based on adversarial learning provided by the foregoing embodiments, and the related technical features can refer to the related technical features of the verification code generation method based on adversarial learning, which will not be described here.
[0131] Please refer to Figure 11 , Figure 11 An embodiment of a computer readable storage medium provided by the present application is shown. As Figure 11 shown, the present embodiment provides a computer readable storage medium 1400, which stores a computer program 1411, and the computer program 1411 is executed by a processor to realize the following steps: obtaining a preset configuration file, extracting a model in a recognition model pool according to the preset configuration file, and constructing a training model group and a verification model group based on a generative adversarial network; constructing a generation model according to the preset configuration file and the training model group; obtaining an adversarial verification code output by the generation model, calculating the recognition rate of the adversarial verification code according to the adversarial verification code and the verification model group; and determining the generation model as a verification code model for generating a verification code when the recognition rate is less than a preset threshold.
[0132] The present application provides a verification code generation method, system, device and storage medium based on adversarial learning. The embodiment of the present application extracts a model in a recognition model pool according to a preset configuration file, constructs a training model group and a verification model group based on a generative adversarial network according to the preset configuration file, constructs a generation model according to the preset configuration file and the training model group, obtains an adversarial verification code output by the generation model, calculates the recognition rate of the adversarial verification code according to the adversarial verification code and the verification model group, and determines the generation model as a verification code model for generating a verification code when the recognition rate is less than a preset threshold. The present application extracts a model in a recognition model pool according to a preset configuration file to construct a training model group and a verification model group, and constructs a generation model according to the training model and the configuration file and outputs an adversarial verification code. The adversarial verification code is input into the verification model group, so as to verify the verification code, and the generation model is determined according to the verification result, so that the adversarial sample technology is applied to the verification code recognition process, thereby providing an effective verification mechanism for the generation model, thereby ensuring the security of the verification code. And since the generation model is generated by the configuration file, the recognizability of the verification code can be adjusted by setting the configuration file, thereby reasonably considering the human eye recognition rate, thereby improving the user experience.
[0133] It should be noted that in the above embodiments, the description of each embodiment has its own emphasis, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0134] Those skilled in the art will appreciate that embodiments of the present application can be devised for a variety of applications. It is intended that the present application be limited only by the scope of the appended claims, and it is intended that various modifications and alterations made by those skilled in the art be considered as within the scope of the present application. The embodiments of the present application will be described with reference to the attached drawings, wherein:
[0135] The present application is described in reference to the drawings using a flowchart and / or a block diagram of the method, apparatus (system) and computer program product according to embodiments of the application. It will be understood that each block of the flowchart and / or block diagram, and combinations of blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks.
[0136] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks.
[0137] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks.
[0138] While the preferred embodiments of the application have been described, additional variations and modifications can be made to the embodiments by those skilled in the art once they learn of the basic inventive concepts. Therefore, the appended claims are intended to cover all such modifications and variations as fall within the scope of the present application.
[0139] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for generating a Captcha based on adversarial learning, characterized in that, The method comprises: acquiring a preset configuration file, extracting a model in a model pool according to the preset configuration file, and constructing a training model group and a verification model group based on a generative adversarial network; constructing a first generative model according to the preset configuration file and the training model group; acquiring an anti-captcha output by the first generative model, and calculating an anti-captcha recognition rate according to the anti-captcha and the verification model group; when the recognition rate is less than a preset threshold, determining the first generative model as a first captcha model for generating a captcha; based on the captcha generated by the first captcha model, counting a first pass rate of at least one target user and a first time of inputting the captcha; in a case where the first pass rate is greater than a preset pass rate threshold and the first time is less than a preset input time, increasing a maximum L-p constraint value of an adversarial interference in the preset configuration file, and constructing a second generative model based on the training model group to obtain a second captcha model; based on the captcha generated by the second captcha model, counting a second pass rate of the target user; in a case where the second pass rate is less than the first pass rate, marking the target user as an abnormal user; in a case where the target user is an abnormal user, forwarding an access request sent by the target user to an induction system, and performing captcha verification again for each module in the induction system; based on the identification of the target user to different captchas in the induction system, updating the second captcha model, so that the updated second captcha model is used to generate a captcha. 2.The method of claim 1, wherein, Before the step of extracting a model in a model pool according to the preset configuration file, the method further comprises: constructing a model pool according to the preset configuration file; acquiring historical captcha data, and performing transfer training on each recognition model in the model pool according to the historical captcha data to update the model pool. 3.The method of claim 2, wherein, The method further comprises: when the recognition rate is not less than a preset threshold, updating the anti-captcha to the historical captcha data; updating the generative model according to the preset configuration file, the training model group, and the updated historical captcha data, and updating the captcha model with the updated generative model. 4.The method of claim 1, wherein, The step of constructing a generative model according to the preset configuration file and the training model group comprises: acquiring a task type in the preset configuration file, and constructing a corresponding loss function according to the task type; iterating the training model group according to the preset configuration file, minimizing the loss function, and outputting a generative model. 5.The method of claim 4, wherein, The task type comprises a nine-square verification task, a prompt word verification task, a point selection verification task, and a language verification task. 6.The method of claim 1, wherein, The step of acquiring an anti-captcha output by the first generative model, and calculating an anti-captcha recognition rate according to the anti-captcha and the verification model group comprises: acquiring a preset number of anti-captchas output by the first generative model; identifying the preset number of anti-captchas according to the verification model group, and calculating a recognition rate of the preset number of anti-captchas. 7.The method of claim 1, wherein, The training model group and the verification model group each include a picture classification model cluster, a target detection model cluster, a syntax recognition model cluster, and a speech recognition model cluster. 8.A Captcha generation system based on adversarial learning, characterized in that, The method comprises The model construction module is configured to acquire a preset configuration file, extract a model from a recognition model pool according to the preset configuration file, and construct a training model group and a verification model group based on a generative adversarial network; The model generation module is configured to construct a first generation model according to the preset configuration file and the training model group; The rate value calculation module is configured to acquire an adversarial verification code output by the first generation model, calculate an adversarial verification code recognition rate according to the adversarial verification code and the verification model group; The model determination module is configured to determine the first generation model as a first verification code model for generating a verification code when the recognition rate is less than a preset threshold, and calculate a first pass rate of at least one target user and a first time of inputting a verification code based on the verification code generated by the first verification code model. When the first pass rate is greater than a preset pass rate threshold and the first time is less than a preset input time, the maximum L-p constraint value of the adversarial interference in the preset configuration file is increased, a second generation model is constructed based on the training model group, and a second verification code model is obtained; a second pass rate of the target user is calculated based on the verification code generated by the second verification code model. When the second pass rate is less than the first pass rate, the target user is marked as an abnormal user; when the target user is an abnormal user, an access request sent by the target user is forwarded to an induction system, access to each module in the induction system needs to be verified again; the second verification code model is updated based on the recognition of different verification codes of the target user in the induction system, so that the updated second verification code model is used to generate a verification code.
9. An apparatus, comprising: The computer management program stored in the memory is executed by the processor to implement the steps of the adversarial learning-based verification code generation method of any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer management program stored in the memory is executed by the processor to implement the steps of the adversarial learning-based verification code generation method of any one of claims 1-7.
Citation Information
Patent Citations
Methods and apparatuses for establishing verification code generation model and generating verification code
CN108763915A