Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the recognition of CAPTCHA in the new edition of C# Unicom

Shulou Source: shulou.com Published: 2022-06-02 20:29:11 10月03日 Update

Today, I will talk to you about how to realize the identification of the new version of C# Unicom CAPTCHA. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

I wrote an article about the realization of automatic recharge of Unicom's top-up card. Recently, I found that the official website of Unicom had been revised. I casually looked at it and found that the new version of the verification code was different from the previous one. I sent some time to study his identification code, and its current verification code is as follows:

Now let's talk about the identification steps.

1. Convert grayscale images

2. Clear the border of 2px

3. Number of split CAPTCHA codes (4)

4. Generate a font library

After the above steps, you can get the following effect

The following is part of the implementation code

Public String GetCheckString (Bitmap bitmap) {UnCodebase ud = new UnCodebase (bitmap); ud.GrayByPixels (); ud.ClearPicBorder (2); ud.CutMap (14,15,0,0); bitmap = ud.bmpobj; / / bitmap = ud.ClearNoise (128,1); String chkcode = "" Bitmap [] arrmap = ud.SplitImg (bitmap, 4,1); foreach (Bitmap item in arrmap) {String str = ud.GetCodebybitmap (item, 128); Boolean isEques = false; foreach (String strss in code) {String [] a = strss.Split (':') If (str = = a [1]) {chkcode + = a [0]; isEques = true; break;}} if (! isEques) {String strCurrent = "" Double max = 0; foreach (String strss in code) {int len1, len2, min, count = 0; String [] a = strss.Split (':'); len1 = a [1] .length; len2 = str.Length Min = len1; if (min > len2) {min = len2;} for (int I = 0; I < min) Count++; +) {if (str [I] = = a [1] [I]) {count++;}} double currrent = (count * 100.0 / min) If (max < currrent) {max = currrent; strCurrent = a [0] .trim ();}} chkcode + = strCurrent.Trim ();}} return chkcode }

After these treatments, the success rate of recognition is more than 90%.

The following is the test address, code 100%C# implementation, to facilitate asp.net calls. If it is a bit of trouble for asp.net to call unmanaged, you have to put it under System32 or an absolute path.

After reading the above, do you have any further understanding of how to realize the CAPTCHA identification of the new version of C# Unicom? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Verification content clocking code steps trouble difference success number picture address font success rate effect time more grayscale knowledge article industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Microsoft Docker Linux Shulou Information