A few years ago, I read an article titled "how to identify advanced verification codes". Many of the things mentioned in this article are what I usually use, therefore, I learned how to use the Verification Code of Baidu Post Bar. Shows the verification code of Baidu Post Bar.
After a day or two, the recognition accuracy of a single character that has been manually split is not low, but it never solves the problem of sticking character segmentation, and then it is put down.
In the past two days, I was asked to help crack the verification code of a website. I looked at the traditional digital verification code without sticking, twisting, and skewing. So I started to crack it.
Shows the verification code to be recognized:
From the above verification code, we can see that the attack does not need to consider character segmentation, but only need to focus on removing the background. At first glance, the background noise around each character is very similar to the color of the character. It seems that it is not easy to filter and adjust the background noise, but only keep the character itself. In fact, it is not easy to do it. Several threshold-based processing operations have been considered at first, and the processing results are not satisfactory at all. After several failed attempts, considering that the verification code is mainly about the foreground and background color, I plan to analyze the color distribution histogram of the verification code to see if I can find a breakthrough. Because the color of the noise around each character is related to the color of the character, it is irrelevant to the color of other characters, so the analysis of the next color histogram is only for a single character after segmentation.
For example, the color histogram corresponding to each character after segmentation is shown in:
Zookeeper
Zookeeper
Zookeeper
Zookeeper
After drawing the color distribution histogram of each character, we can see at a glance that there is a pattern behind the verification code. Further analysis shows that the isolated small block area on the left side of the histogram is the color of the character, while the large block area on the right side is all background colors. Therefore, as long as we get the color range of the Left Block of the histogram, unless it is a mix of characters, it is difficult to obtain the range.
After the background is removed and the image is binarization, the following character image is displayed:
->
The next thing we need to do is to identify these two-value image characters without any background. There are many methods. I use machine learning, when the background is removed successfully, the recognition rate is almost 100%.
Finally, the effect demo program of the cracking is provided: the effect demo program.