易語(yǔ)言驗(yàn)證碼識(shí)別技術(shù)帶源碼(Easy language code identification technology with source code)_第1頁(yè)
易語(yǔ)言驗(yàn)證碼識(shí)別技術(shù)帶源碼(Easy language code identification technology with source code)_第2頁(yè)
易語(yǔ)言驗(yàn)證碼識(shí)別技術(shù)帶源碼(Easy language code identification technology with source code)_第3頁(yè)
易語(yǔ)言驗(yàn)證碼識(shí)別技術(shù)帶源碼(Easy language code identification technology with source code)_第4頁(yè)
易語(yǔ)言驗(yàn)證碼識(shí)別技術(shù)帶源碼(Easy language code identification technology with source code)_第5頁(yè)
已閱讀5頁(yè),還剩19頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、易語(yǔ)言驗(yàn)證碼識(shí)別技術(shù)帶源碼(Easy language code identification technology with source code)The simulation wizard is the first publicly available software to validate the code recognition technology,The use of simulation wizard produced a large number of free, commercial group software, for many complex BT verifica

2、tion code can be successfully identified.But the code still needs exquisite skills and patience. Please keep this in mind.Verification code identification is not suitable for impetuous people to do.Verification of code is a special technique, and any open authentication code will soon fail.Because t

3、he code is open, related sites will soon change the verification code.So I'll just introduce the principle.Here, the verification code recognition technology is purely based on technical research purposes.This technology is also used to make more websites take more effective precautions.The veri

4、fication code recognition technology to prohibit any person by spamming information presented here.The verification code introduced in this paper is suitable for more complex picture verification code, and is also the method adopted by most websites.Some of the site's verification code is very s

5、imple, for example, in the web page directly display the verification code character, not the picture, or the file name of the picture is directly on the verification code characters.Or there are other rules to follow, or there are other obvious vulnerabilities can be used (for example, by rewriting

6、 access to the source code of the verification page, so that the verification code does not refresh).This kind of verification code recognition is very simple, as long as master the web library, element library function, you don't need to use the method described below.First, download the verifi

7、cation code sampleOpen the c:test folder and select "view thumbnails."",Then run the LAScript script again, and each time you run it, check out the automatically generated images under c:test, and change the characters on the picture to the filenameFor example, when the picture shows

8、5, the file name is changed to 5.jpg.If you change the complex verification code, you can use more than a few samples for each character, the first character is the verification code character, second characters can be any character.For example: 5a.jpg, 5b.jpg, 5c.jpg. And so on.The more samples you

9、 have, the stronger your ability to identify.IMG = image.new ();- download the image without a suffix to display the specified *.bmp formatImg:getURL ("http:/www.*.com/test.asp", "*.png");Assert (img:ok (), "download validation code failed");Img:Crop (4, 3, 56, 18)Img:s

10、ave ("c:testtest.jpg") - save to hard disk- resolution pictures, specify a row and the four columnImg2, img3, img4, img5 = img:split (1,4);Img2:save ("c:test0001.jpg")Img3:save ("c:test0002.jpg")Img4:save ("c:test0003.jpg")Img5:save ("c:test0004.jpg"

11、)Image.del (IMG);How to determine the name of the picture suffixIn the entire verification code recognition process, the format and suffix must not be wrong, otherwise it will fail.Usually: ASP verification code is BMP format, PHP verification code is PNG format, other verification code is a lot of

12、jpg format.Simple, on the verification code, right-click the "save the picture as", you can see the format (not necessarily accurate).In addition, you can open the file header in binary with UltraEdit and so onFirst download:STR = web.getURL ("http:/www.*.com/test.asp")String.sav

13、e (STR, "c:test.bin")Then open the test.bin with UE to see the header of the file (the first line)JPG file header has JFIF wordsPNG file header has PNG wordsGIF file header has GIF wordsIf you don't know, don't specify the suffix at this pointImg:getURL ("http:/vwww.*.com/test

14、.asp", "" ")So you can download itTwo. Generate sample database of verification codeCopy the code below and paste it into the script block of the FAP program, and click "replay" to run",Finally, click "read the source code"".You can see the generated

15、 validation code samples in the "data block" at the bottom of the ApeML source code.To copy the content of the data block, the FAP simulation program that needs to be identified by the verification code covers the data block.Local, tkey, =A=0, B=0, C=0, D=0, F=0, G=0, H=0, I=0, J=0, K=0, L

16、=0, M=0, N=0, O=0, P=0, Q=0, R=0, S=0, Z=0, T=0, E=0, U=0, V=0, W=0, X=0, Y=0;Add all numeric keys to the dictionaryFor I =0,9,1 doTkeytoString (I) = 0;End;If a character has more than one sample, such as 5A.jpg 5B.jpg 5C.jpgFor K, V in pairs (tkey) doIf (#k) =2) then - if not the key elements of tw

17、o charactersTkeyk. "A"=0;Tkeyk. "B"=0;Tkeyk. "C"=0;Tkeyk=nil; delete single character nameEnd;End;The -k parameter is the key, and the V parameter represents the value of a typical tkeyle iterator callback functionLoadtkey = function (k, V)Local img = image.new ();Img:l

18、oad ("C:test", ".k.", ".Jpg");Assert (img:ok (), "C:test".k. ".jpg". "n is not a valid picture");Img:bpp (1);Img:bpp (24);- remove the clutter on the verification code by the last two sentencesImg:Crop (1, 0, 9, 10) - prune a single charact

19、erImg:median (2) - median filter to further remove clutterTkeyk= string.encode (img:getBytes ("*.jpg"), ""); - because it is converted to a string or binary, so Base64 is encodedImage.del (IMG);End;- traverse all the elements of table tkey, and call loadtkey to load the picture f

20、ileFor K, V in pairs (tkey) doLoadtkey (k, V);End;Save all the pictures to the data islands,Ape:saveTable (tkey, "verification code sample")Three, verification code recognitionAdd the following code to the init script block in the front of the FAP simulation program- read Base64 encoded pi

21、cture data from data blockCodekey = ape:loadTable ("verification code sample");Local timg = ; - this is an array of images, used to image data reduction after the verification code sample storageThere must be a conversion, because codekey is just an ordinary string encoded by Base64, and t

22、img will be a real picture object (binary data)Restore to picture objectToImage = function (k, V)Local img = image.new ();Local STR = string.decode (V, ""); - first Base64 decoding, converting pure text into binary dataImg:setBytes (STR, "*.jpg") - restore binary data to imagesTi

23、mgk = img;End;- loading verification code samplesTkey = ape:loadTable ("verification code sample");For K, V in pairs (tkey) do - verification samplesToImage (k, V) - convert to imageEnd;Convert the picture validation code to the string functionFunction ImgToString (IMG)Function test (imgX)

24、 -test is an inner function that is contained in a functionSleep (0);Local limit = (60 * 20) + (60 * 20); minimum similarity local keyword declared as a local variableLocal Chr = "A" - read characters-testimg is an internal function that is contained in a function. As a callback function o

25、f table.foreach, the k parameter represents the key, and the V parameter represents the valueTestimg = function (k, V)Call the image.testXX () function to get the similarity. Similar functions also have image.testX () image.test ()Local n = imgX:testXX (timgk);If (n<limit) then - comparison of mi

26、nimum similarityLimit = n;Chr = k.""End;End;- traverse the timg table and call the testimg functionFor K, V in pairs (timg) doTestimg (k, V);End;Return string.left (Chr, 1) - returns the first string character read (if each character has more than one sample)End;- trim the pictureImage.Cro

27、p (IMG, 4, 3, 56, 18)Img:bpp (1);Img:bpp (24);The procedure above must be exactly the same as the code when the sample is downloaded.- using split function to split picturesLocal img2, img3, img4, img5 = img:split (1,4);Win.messagePrint ("checking pictures, please wait.");Return test (img2

28、).test (img3).test (img4).test (img5);End;Where you need to identify the verification code, add the following code:IMG = image.new ()Img:getURL ("http:/www.*.com/test.asp", "*.jpg")Because the verification code and page refresh is not the same, the verification code to the screen

29、Local x, y = mouse.getPos ()Img:paint (x, y, 60, 20)Local STR = ImgToString (IMG);Below, we convert each character of the verification code to uppercase, and control the keyboard order keyCode1 = string.upper (string.sub (STR, 1,1);Code2 = string.upper (string.sub (STR, 2,2);CODE3 = string.upper (st

30、ring.sub (STR, 3,3);Code4 = string.upper (string.sub (STR, 4,4);Key.press (100, code1, code2, CODE3, code4);We use the analog button to enter the validation code.In fact, most of the time we can use simpler methods, as follows:Ele = wb:getEle ("code control name");Ele:setAttribute ("v

31、alue", STR)Why is my verification code different from that on the page?Because we've used the img:getURL to read the authentication code, the code has been refreshed.So the verification code is not the same as what is displayed on the page, you just need to identify the latest validation co

32、de.How to get the picture directly on the page instead of downloading it againSome of the verification code is bound to the page, you must identify the verification code on the page.You can use the image.capture function on the screen of the picture can be directly screenshots.Please refer to the im

33、age.capture function.The better way is to copy the pictures from the page to the clipboard directly using the ele:exec ("Copy") function.Then use the img:getClipBD () to get the picture.Please refer to the ele:exec ("Copy") function img:getClipBD () functionFour, about cutting pi

34、cturesLooking at the diagram above, Crop is to select the area inside the green box to clear the area outside the green boxYou have to make sure that the area is exactly four blocks (assuming there are four characters in the code)After that, the call img:split (1,4) is divided into four charactersTh

35、e picture is divided into small four copies of its width should be just above the red box width.Like the green box, I don't mix the painting here so that everyone can see it clearly.If your Crop parameter is wrong, then split goes wrongAfter downloading the verification code picture,You can use

36、image editing software to open high magnification.Five. Use the seed filling algorithm to remove the interference line on the verification codeThe use of simulation sprite authentication code is powerful, a function that can remove the mottled miscellaneous points.Img:bpp (1)Img:bpp (24)After the fi

37、rst two codes, it's very fast, and all the background, the interference, the noise are gone.But sometimes there are a lot of interference lines in the code, and the random changes in location are too harmful,At this point, we first remove the interference lines and remove the background extracti

38、on characters before processing the verification codeHere is a simulated sprite after the initial processing of the verification code picture. Has removed the mottled, miscellaneous points, but there is still interference lineOne alternative is to filter it with a median filter. Img:median (2); a fu

39、nction call is OK, but.Well, although the line was removed, the original characters were destroyed a little.Here is the source code that uses the seed filling algorithm to remove the interference line, not only can remove the clutter,And you can remove the surrounding space,A little modification can

40、 have more usesThe following is the effect of automatic processingHere's all the source code:-A table structure x=0; y=0 is used to represent the coordinates on the imageA table structure is represented by a set of dots to represent a line on the image. All connected black dots are thought to be

41、 a "connecting line".Find the longest "connected line", which is considered to be the character, and the rest is considered as a miscellaneous point.The algorithm principle is similar to the seed filling algorithm.Let's first use the img:bpp function to process black and whit

42、e images, and then remove the initial colors.First find a black spot, create a "coordinate point" object, and add it to the "connected line".Then in the black spots around the 8 points, and then find the black point, found to add to the "connecting line", so that always

43、 recursiveUntil you traverse all the points of the image, there may be several pieces.Method of clearing miscellaneous pointsImage.scan (IMG);Clear the dots and cut away the space around themImage.scan (IMG, true);-Function image.scan (IMG, crop)- use a table array to record all the "connected

44、lines"Assert (img:ok), "the parameters of image.scan must be a valid picture"Local tlines =;First, calculate the height and width of the picture to avoid repeating callsLocal w = img:width ();Local H = img:height ();In the form of table -definition of an array corresponding to each point in the image.It acts like a switch, the first value is false, but the black spot is first traversed. Change this value to true.Next time, w

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論