Weak password automatic detection method and device, electronic equipment and storage medium

By extracting image features of the login interface of the power grid system and identifying the login control, combining the user name list and weak password dictionary, the method of automated detection of weak passwords is realized, solving the problem of complex and inefficient detection in the existing technology, improving detection efficiency and accuracy, and avoiding related risks.

CN119646800APending Publication Date: 2025-03-18LUOHE POWER SUPPLY OF HENAN ELECTRIC POWER CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411804372.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

The existing technology lacks automated weak password detection methods, which leads to the complex and inefficient screening of weak passwords in the power grid system, and risks of information leakage, malicious operations and reporting and assessment.

Method used

By extracting the image of the login interface feature, obtaining the image features of the login interface, and using these features to obtain or identify the screen coordinates of the login control in the storage file. Then, based on the user name list and weak password dictionary, simulate mouse clicks and key input, and make a circular login attempt to determine whether there is a weak password for each user name.

Benefits of technology

It realizes the ability to automatically detect weak passwords in the power grid system, reduces detection complexity, improves detection efficiency and accuracy, and avoids the risks of information leakage, malicious operations and reporting and assessment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646800A_ABST
    Figure CN119646800A_ABST
Patent Text Reader

Abstract

The invention provides a weak password automatic detection method and device, electronic equipment and a storage medium, and belongs to the technical field of information security. Comprising the following steps: performing feature extraction on an image of a login interface to obtain image features of the login interface; obtaining a screen coordinate of a corresponding login control in a storage file by using the image feature of the login interface; if the acquisition from the storage file fails, identifying login controls from the login interface, and acquiring screen coordinates of each login control; associating the image features of the login interface, the type of each login control and the screen coordinates, and storing the associated image features, types and screen coordinates in a storage file; according to the screen coordinates of the login control, performing circular login attempts based on a user name list and a weak password dictionary in a mode of simulating mouse clicking and simulating key input; and judging whether each user name has a weak password or not according to a login attempt result. According to the method, the complexity of weak password testing of the power grid system can be greatly reduced, time and labor are saved, and the detection efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of information security technology, and specifically relates to an automatic detection method, a detection device, an electronic device and a storage medium for weak passwords. Background Art

[0002] A weak password refers to a password that contains only simple numbers and letters, such as "123456", because such a password can be easily cracked by others, thus putting the business system at risk.

[0003] The use of weak passwords in portal systems or other power grid business systems poses risks of information leakage, malicious operation, and notification and assessment. Currently, applicants need to screen weak passwords of users in each power grid system during network security inspections, but currently they rely mainly on manual login testing and lack automated weak password detection methods, making the work difficult. Summary of the invention

[0004] In view of the deficiencies in the prior art, the present invention provides an automatic detection method, a detection device, an electronic device and a storage medium for weak passwords.

[0005] In order to solve one, part or all of the above technical problems, the technical solution adopted by the present invention is: An automatic detection method for weak passwords, comprising: Perform feature extraction on the image of the login interface to obtain image features of the login interface; The screen coordinates of the corresponding login controls are obtained in the storage file using the image features of the login interface; if the acquisition from the storage file fails, the login controls are identified from the login interface and the screen coordinates of each login control are obtained; the image features of the login interface, the type of each login control and the screen coordinates are associated and stored in the storage file; According to the screen coordinates of the login control, cyclic login attempts are made based on the username list and weak password dictionary by simulating mouse clicks and key inputs; Determine whether each username has a weak password based on the login attempt results.

[0006] Furthermore, the method for extracting features from the image of the login interface includes: adjusting the image of the login interface to a specified size; grayscale processing the resized image; obtaining the average color value of each row of pixels in the image in turn; obtaining the variance of all average values, and using the obtained variance as a feature of the image.

[0007] Furthermore, the method for extracting features from the image of the login interface includes: identifying text from the image of the login interface; obtaining the system name of the system to be logged in from the text; and using the obtained system name as a feature of the image.

[0008] Furthermore, the method for identifying a login control from a login interface includes: identifying a target control from the login interface, obtaining a type of the target control; and filtering out a login control from the target controls according to the type of the target control.

[0009] Furthermore, the method for identifying the target control from the login interface includes: performing edge detection on the image of the login interface; performing straight line fitting on the image after edge detection; selecting horizontal straight lines from the fitted straight lines, and filtering out horizontal straight lines that are too short; using two horizontal straight lines whose starting points have similar X-axis coordinates, whose end points have similar X-axis coordinates, are adjacent in the Y-axis direction, and whose distance is 1-3 times the normal font width in the interface as the upper and lower boundaries of the target control; and determining the upper and lower boundaries and the area between them as the target control.

[0010] Furthermore, the method for identifying the target control from the login interface includes: constructing a control data set by constructing random shape controls; training a control recognition model using the control data set; and identifying the target control from the image of the login interface using the control recognition model.

[0011] Furthermore, the method of filtering out login controls from target controls according to the type of target controls includes: performing text recognition on the area near the target control; performing keyword matching on the text recognition result, and determining whether the target control is a login control based on the matching result, and if so, obtaining the type of the login control at the same time; if a verification code text box is recognized, identifying a verification code image from the attachment of the verification code text box.

[0012] A device for automatically detecting weak passwords comprises an image feature recognition unit, a screen coordinate acquisition unit, a login control recognition unit and a login attempt unit; the image feature recognition unit is used to acquire image features of a login interface; the screen coordinate acquisition unit is used to acquire the screen coordinates of corresponding login controls in a storage file using the image features of the login interface; the login control recognition unit recognizes login controls from the login interface and acquires the screen coordinates of each login control; and is also used to associate the image features of the login interface, the types of login controls and the screen coordinates and store them in a storage file; the login attempt unit is used to perform cyclic login attempts based on a user name list and a weak password dictionary in a manner of simulating mouse clicks and key inputs according to the screen coordinates of the login controls; and is used to determine whether each user name has a weak password according to the login attempt results.

[0013] An electronic device comprises a processor and a memory; the memory is used to store executable instructions, and the processor is used to execute the instructions to implement the detection method.

[0014] A computer-readable storage medium stores instructions, and when the instructions are executed, the detection method is implemented.

[0015] Compared with the prior art, the present invention has the following beneficial effects: The present invention adopts automated means, which can automatically identify login controls from the system login interface, such as a user name text box, a password text box, a login button, etc., and perform cyclic login attempts based on a user name list and a weak password dictionary to determine whether the user uses a weak password.

[0016] Through the weak password automated testing tool, the complexity of weak password testing for the power grid system can be greatly reduced, saving time and effort, improving detection efficiency and accuracy, and avoiding the risks of information leakage, malicious operation, and notification and assessment caused by the use of weak passwords. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The present invention is further described in detail below in conjunction with the accompanying drawings.

[0018] Figure 1 : Flow chart of embodiment 1 of the present invention; Figure 2 : Flow chart of step S100 of embodiment 1 of the present invention; Figure 3 : Flowchart of step S300 of embodiment 1 of the present invention; Figure 4 : A schematic diagram of Embodiment 2 of the present invention; Figure 5 : Schematic diagram of embodiment 3 of the present invention. DETAILED DESCRIPTION

[0019] In order to better understand the present invention, the content of the present invention is further clearly described below in conjunction with the embodiments and the accompanying drawings, but the protection content of the present invention is not limited to the following embodiments. In the following description, a large number of specific details are provided to provide a more thorough understanding of the present invention. However, it is obvious to those skilled in the art that the present invention can be implemented without one or more of these details.

[0020] Example 1: See Figure 1-Figure 3 The purpose of this embodiment is to provide an automatic detection method for weak passwords. The detection method includes: S100, obtaining image features of the login interface; S200, using the image features of the login interface to obtain the screen coordinates of the corresponding login control in the storage file; if the acquisition from the storage file fails, execute step S300, otherwise execute step S400; S300, identifying login controls from the login interface and obtaining the screen coordinates of each login control; associating the image features of the login interface, the type of each login control and the screen coordinates and storing them in a storage file; S400, performing cyclic login attempts based on the user name list and the weak password dictionary in a manner of simulating mouse clicks and key inputs according to the screen coordinates of the login control; S500: Determine whether each user name has a weak password based on the login attempt result.

[0021] The login control includes a user name text box, a password text box and a login button. In some cases, the login control also includes a verification code text box and a verification code image.

[0022] When step S100 is executed, after the login interface is opened, an image of the login interface is captured, and then feature extraction is performed on the image of the login interface to obtain image features of the login interface.

[0023] In one embodiment, the method for extracting features from an image of a login interface includes: S111, adjusting the image of the login interface to a specified size; S112, graying the resized image; S113, sequentially obtaining the average color value of each row of pixels in the image; S114. Obtain the variance of all average values, and use the obtained variance as a feature of the image.

[0024] The login interface of various systems basically displays the name of the system. Therefore, in another embodiment, a method for obtaining the system name as an image feature is provided. Specifically, the method for extracting features from the image of the login interface includes: S121, recognizing text from the image of the login interface; S122. Obtain the system name of the system to be logged in from the text by using regular expression matching, AI big model, etc.; S123, using the obtained system name as a feature of the image.

[0025] When step S200 is executed, the storage file is first accessed, and the image features of the login interface are queried from the storage file. If the target information is not found, the process directly jumps to step S300. If the target information is found, the screen coordinates of the login controls (user name text box, password text box, login button, etc.) are obtained from the target information. If the screen coordinates are successfully obtained, the process directly jumps to step S400, otherwise, step S300 is executed.

[0026] When step S300 is executed, the login controls are first identified from the login interface, and the type of each login control and the corresponding screen coordinates are obtained; then the image features of the login interface, the type of each login control and the screen coordinates are associated and stored in a storage file.

[0027] The next time you need to obtain the login control and its corresponding coordinates, you can directly query the image features of the login interface from the storage file, and you can also query the corresponding login control and coordinates at the same time, so that you can continue to execute the subsequent steps. After using the storage file to store information, you do not need to identify the login control every time you execute it, which can improve execution efficiency.

[0028] Login controls mainly include text boxes (user name text box, password text box) and buttons (login button), and the text boxes and buttons in the program interface have specific appearances. Therefore, first identify the text boxes and buttons from the login interface based on their appearance, and then classify the text boxes and buttons to determine the user name text box, password text box and login button, and the verification code text box can also be determined when necessary.

[0029] In general, the method for identifying a login control from a login interface includes: identifying a target control from the login interface, obtaining the type of the target control, and filtering the login control from the target controls according to the type of the target control.

[0030] In one embodiment, the method for identifying a target control from a login interface includes: S311, edge detection is performed on the image of the login interface. First, the image is grayed, and then the discontinuous nature of the gray value is used to take the line with a sudden change in gray value as the edge. For example, the edge detection algorithm such as Canny, Sobel, Laplacian in OpenCV can be used for implementation.

[0031] S312, performing straight line fitting on the image after edge detection. First, the image after edge detection is binarized, then the edge pixel points in the image are obtained, and finally straight line fitting is performed on all edge pixel points. The straight line fitting algorithm can be implemented using the fitline function of OpenCV, for example.

[0032] S313, filter out horizontal lines from the fitted lines. Filter out horizontal lines based on whether the Y-axis coordinates of the pixel points in the lines are consistent, and finally filter out short horizontal lines. For example, if the normal font width in the interface is n pixels, filter out lines shorter than 3n; generally, n is 9px-16px.

[0033] S314, two horizontal lines with similar X-axis coordinates of the starting point of the straight line, similar X-axis coordinates of the end point of the straight line, adjacent in the Y-axis direction, and a distance of 1-3 times the normal font width in the interface are used as the upper and lower boundaries of the target control. The upper and lower boundaries of the target control should be horizontal and equal in length, the Y-axis coordinates of the starting point and the end point should be consistent, and there should be no fitted straight line in the middle of the target control except the boundary, and the distance between the upper and lower boundaries should be able to display a line of fonts. This step determines the upper and lower boundaries of the target control based on these factors.

[0034] S315: Determine the upper and lower boundaries and the area between them as the target control.

[0035] S316, obtaining the screen coordinates of the target control. The screen coordinates of the target control can be obtained according to the position coordinates of the login interface on the screen and the coordinates of the target control in the image.

[0036] In another embodiment, the method for identifying a target control from a login interface includes: S321. Construct a control data set by constructing a random shape control. First, define an initial text box control or button control, and randomly set the shape of the control (such as randomly setting the size, background color, border, border color, border radius size and other parameters); then save the control as an image, and mark the control type corresponding to the image (such as a text box or button); repeat the above steps until the generated control image meets the requirements; finally, construct a control data set with these images. This step can be implemented by conventional programming methods, such as using Canvas in JavaScript.

[0037] S322: Train a control recognition model using the control data set: First, construct an initial control recognition model using a neural network, and then train the control recognition model using the control data set.

[0038] S323: Using a control recognition model, identify a target control from the image of the login interface.

[0039] S324, obtaining the screen coordinates of the target control. The screen coordinates of the target control can be obtained according to the position coordinates of the login interface on the screen and the coordinates of the target control in the image.

[0040] Methods for filtering login controls from target controls based on the type of the target control include: S331. Perform text recognition on the area near the target control. In the image of the login interface, according to the coordinates of the target control, obtain images of the area where the target control is located, the area to the left of the target control, and the area above the target control, and finally perform text recognition on the image. In the Chinese and English environment, the prompt information of the control is generally located on the left side, the upper side, or inside the control. Therefore, by performing text recognition on the images of these areas, the prompt information of the text box or button can be obtained.

[0041] S332, keyword matching is performed on the text recognition result, and whether the target control is a login control is determined according to the matching result, and if so, the type of the login control is obtained at the same time. For example, if keywords such as "user name" and "ID" are matched from the text recognition result, it means that the target control is a username control in the login control.

[0042] S333. If the verification code text box is identified, the verification code image is identified from the attachment of the verification code text box. For some login interfaces with verification codes, after the verification code text box is identified in S332, the screen coordinates of the corresponding verification code image need to be obtained. The verification code image is generally set next to the verification code text box, so the image of the area near the verification code text box is captured to identify the screen coordinates of the verification code image. If the verification code image recognition fails, a prompt can be issued, and the staff can manually select the verification code image.

[0043] When steps S400 and S500 are executed, a user name is obtained from the user name list, and then all passwords in the weak password dictionary are logged in for verification. When logging in, it is performed in a manner of simulating mouse clicks and simulated key input. For example, according to the screen coordinates of the user name text box, the corresponding coordinate point (such as the coordinates of the center of the user name text box) is clicked in a manner of simulating mouse clicks to activate the user name text box on the login interface, and then the user name is entered into the user name text box in a manner of simulating key input; after entering the password using the same method, if there is a verification code text box, the verification code image is first obtained, the verification code is identified using the verification code recognition algorithm, and then the verification code is entered into the verification code text box; finally, the login button is clicked in a manner of simulating mouse clicks to complete the login. After logging in, there is a delay for a period of time, and then the interface image is identified to determine whether the login is successful. If the login is successful, it means that the user has used a weak password. At this time, the user name and the corresponding password are recorded, and the next user name is directly obtained from the user name list for a login attempt.

[0044] After all users have attempted to log in, the corresponding users will be notified according to the recorded user names and urged to change their passwords.

[0045] The weak password dictionary includes common weak passwords, such as admin, abc123, 111111, etc., and also includes the default passwords of some systems, such as lcgc@5343, Admin@123, leadsec@7766, etc.

[0046] Example 2: See Figure 4 The purpose of this embodiment is to provide an automatic detection device for weak passwords. The detection device includes: an image feature recognition unit, a screen coordinate acquisition unit, a login control recognition unit, and a login attempt unit.

[0047] The image feature recognition unit is used to obtain the image features of the login interface. In combination with Embodiment 1, the image feature recognition unit is used to perform step S100.

[0048] The screen coordinate acquisition unit is used to acquire the screen coordinates of the corresponding login control in the storage file by using the image features of the login interface. In combination with Embodiment 1, the screen coordinate acquisition unit is used to perform step S200.

[0049] The login control identification unit identifies the login control from the login interface and obtains the screen coordinates of each login control; and is also used to associate the image features of the login interface, the type of each login control and the screen coordinates and store them in a storage file. In combination with embodiment 1, the login control identification unit is used to perform step S300.

[0050] The login attempt unit is used to perform cyclic login attempts based on the user name list and the weak password dictionary in a manner of simulating mouse clicks and key inputs according to the screen coordinates of the login control; and is used to determine whether each user name has a weak password according to the login attempt result. In combination with Example 1, the login attempt unit is used to perform steps S400 and S500.

[0051] Regarding the device in this embodiment, the specific manner in which each unit or module performs operations has been described in detail in Example 1 and will not be elaborated here.

[0052] Those skilled in the art should understand that for the convenience and simplicity of description, the present application only uses the division of the above-mentioned functional modules or units as examples in the device embodiments. In actual applications, the above-mentioned functions can be assigned to different functional modules or units as needed, that is, the internal structure of the device can be divided into different functional modules or units to complete all or part of the functions described above.

[0053] Example 3: See Figure 5The purpose of this embodiment is to provide an electronic device, including at least one processor and one or more memories for storing processor executable instructions. The processor is used to execute the instructions in the memory to implement the detection method described in Embodiment 1.

[0054] It should be noted that electronic devices can be desktop computers, portable computers, network servers, mobile phones, tablet computers, wireless terminals, embedded devices, chip systems or Figure 5 In addition, Figure 5 The components shown in the figure do not constitute a limitation on the terminal device, except Figure 5 In addition to the components shown, the electronic device may include more or fewer components than shown, or combine certain components, or arrange the components differently.

[0055] Embodiment 4: The purpose of this embodiment is to provide a computer-readable storage medium.

[0056] All or part of the processes in the above method embodiments may be completed by computer instructions to instruct relevant hardware. The program may be stored in the computer-readable storage medium. When the program is executed, the detection method described in Example 1 may be implemented.

[0057] The computer-readable storage medium may be an internal storage unit of the electronic device of Example 3, such as a hard disk or a memory. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the computer-readable storage medium may also include both an internal storage unit and an external storage device of the above-mentioned electronic device. The computer-readable storage medium is used to store computer programs and other programs and data required by the electronic device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.

[0058] In conjunction with the several embodiments provided in this application, it should be understood that the provided devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the assessment of the modules or units is only a logical function assessment. There may be other assessment methods in actual implementation, such as multiple modules or units or components can be combined or integrated into another device, or some features can be ignored or not executed.

[0059] In addition, in the embodiment of the device of the present application, each functional module or unit can be integrated into one unit, or each module or unit can exist physically separately, or two or more modules or units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional modules.

[0060] If the above-mentioned integrated unit is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks or optical disks.

[0061] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Other modifications or equivalent substitutions made to the technical solution of the present invention by ordinary technicians in the field should be included in the scope of the claims of the present invention as long as they do not depart from the spirit and scope of the technical solution of the present invention.

Claims

1. A method for automatically detecting weak passwords, characterized in that: include: Perform feature extraction on the image of the login interface to obtain image features of the login interface; The screen coordinates of the corresponding login controls are obtained in the storage file using the image features of the login interface; if the acquisition from the storage file fails, the login controls are identified from the login interface, and the screen coordinates of each login control are obtained, and the image features of the login interface, the type of each login control and the screen coordinates are associated and stored in the storage file; According to the screen coordinates of the login control, cyclic login attempts are made based on the username list and weak password dictionary by simulating mouse clicks and key inputs; Determine whether each username has a weak password based on the login attempt results.

2. The automatic detection method for weak passwords according to claim 1 is characterized in that: The method for extracting features from the image of the login interface includes: Adjust the login interface image to the specified size; Grayscale the resized image; Get the average color value of each row of pixels in the image in turn; Get the variance of all the means to obtain the variance as the feature of the image.

3. The automatic detection method for weak passwords according to claim 1 is characterized in that: The method for extracting features from the image of the login interface includes: Recognize text from images of login screens; Get the system name of the system to be logged in from the text; The obtained system name is used as the feature of the image.

4. The automatic detection method for weak passwords according to claim 1 is characterized in that: Methods for identifying login controls from the login interface include: Identify the target control from the login interface and obtain the type of the target control; Filter out the login control from the target controls based on the type of the target control.

5. The automatic detection method for weak passwords according to claim 4 is characterized in that: Methods for identifying target controls from the login interface include: Perform edge detection on the image of the login interface; Perform straight line fitting on the image after edge detection; Filter out horizontal straight lines from the fitted straight lines and filter out horizontal straight lines that are too short; Set two horizontal lines with similar X-axis coordinates of the starting point and the ending point, adjacent in the Y-axis direction, and a distance of 1-3 times the normal font width in the interface as the upper and lower boundaries of the target control; Identify the upper and lower boundaries and the area between them as the target control.

6. The automatic detection method for weak passwords according to claim 4 is characterized in that: Methods for identifying target controls from the login interface include: Construct a control data set by using the method of constructing random shape controls; Use the control data set to train a control recognition model; The control recognition model is used to identify the target control from the image of the login interface.

7. The automatic detection method for weak passwords according to claim 4 is characterized in that: Methods for filtering login controls from target controls based on the type of the target control include: Perform text recognition in the area near the target control; Perform keyword matching on the text recognition results, and determine whether the target control is a login control based on the matching results. If so, obtain the type of the login control at the same time; If the verification code text box is recognized, a verification code image is recognized from an attachment to the verification code text box.

8. An automatic detection device for weak passwords, characterized in that: It includes an image feature recognition unit, a screen coordinate acquisition unit, a login control recognition unit and a login attempt unit; The image feature recognition unit is used to obtain image features of the login interface; The screen coordinate acquisition unit is used to acquire the screen coordinates of the corresponding login control in the storage file by using the image features of the login interface; The login control identification unit identifies the login control from the login interface and obtains the screen coordinates of each login control; it is also used to associate the image features of the login interface, the type of each login control and the screen coordinates and store them in the storage file; The login attempt unit is used to perform cyclic login attempts based on the user name list and the weak password dictionary in a manner of simulating mouse clicks and simulating key inputs according to the screen coordinates of the login control; Used to determine whether each username has a weak password based on the login attempt results.

9. An electronic device, characterized in that: It comprises a processor and a memory; the memory is used to store executable instructions, and the processor is used to execute the instructions to implement the detection method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The readable storage medium stores instructions, and when the instructions are executed, the detection method according to any one of claims 1 to 7 is implemented.