Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report