I saw the method of violent cracking on the Internet. If I use the image additional code to prohibit external submission of 10 passwords to error account and 50 passwords, the password error and trivial IP 10 seconds of anti -refresh interval registration page, the login page will be prohibited from submitting external submission. In this way, the brute cracked should not play.
Asp file: code.asp
Data file: body.fix, head.fix
Usage: <IMG SRC = http://blog.netbei.com/code.asp>
Response.buffer = true
Numcode
Function Numcode ()
Response.expires = -1
Response.addheader Pragma, No-Cache
Response.adheader cache-clm, no-cache
Dim Znum, I, J
dim ados, ados1
Randomize timeer
Generate random four digits:
znum = cint (8999*RND 1000)
Pass to session
Session (getcode) = znum
The for loop is to put the random number into an array of 3 settlement 3, which is convenient for providing to the subsequent array transformation
dim zimg (3), nstr
Nstr = cstr (znum)
For i = 0 to 3
zimg (i) = cint (mid (nstr, i 1,1)))
Next
dim pos
'Define two adodb.stream binary objects, for the use of image data operation:
set ados = Server.createObject (Adodb.Stream)
Ados.mode = 3
Ados.type = 1
Ados.open
set ados1 = server.createObject (adodb.stream)
Ados1.mode = 3
Ados1.type = 1
Ados1.open
'Load 0 ~ 9 digital data 10x100, GBR array data, each 320 bytes, 10 numbers 3200byte
'BGR one point, 10x10 points a number, one point three bytes (binary 8 -bit, hexadecimal 00 ~ ff)
'A line of 10 points 30 byte line ending 00 00 00 two -byte 32 bytes, so a 10x100 is less than long image, each number 10x10 is 320 bytes
'Those growing greater than wide, there is no way to end the mark 0000, it is 300 bytes directly
These are the data of the BMP 24bit.
'As for the head, it is also very simple, including length and width, image start marking and so
Ados.loadFromFile (server.mappath (body.fix))
Ados1.Write Ados.read (1280)
'The first for loop, and the corresponding four numbers are extracted from the number of random numbers generated from 10x100
But vertical number array
for i = 0 to 3
Ados.position = (9-zimg (i))*320
Ados1.position = i*320
Ados1.Write Ados.read (320)
next
'Clear the data of ADOS that has been used up, and adjust the new image head 54 byte of the header file
Ados.loadFromFile (server.mappath (head.fix))
Pos = lenb (ados.read ())
Ados.positation = POS 'Specify POS position, you can add graphic data to the position of 54 bytes
The second for loop, the number of numbers of numbers, from vertical blocks to horizontal numeric blocks
The method is to extract 4 times 320 bytes to write 30 bytes to ADOS objects, and then extract image data that shifts the second line.
30 bytes are due to the end label with a row of 00 00 in BMP.
for i = 0 to 9 STEP 1
for j = 0 to 3
Ados1.position = i*32 J*320
Ados.positation = POS 30*JI*120
Ados.write ados1.read (30)
next
next
Ados.positation = 0
Response.binarywrite directly sends image data to the client
Response.contenttype = Image/BMP
Response.binarywrite ados.read ()
Ados.close: set ados = Nothing
Ados1.Close: set ados1 = Nothing
END FUNCTION reprint, please indicate from the outdated IM286.com, this post address: http://www.im286.com/viewthread.php? TID = 1690246
To understand these codes, it is mainly to understand the object of the binary data in ASP, adodb.stream! This program mainly uses adodb.stream. If you have this foundation, you can further add more functions such as adding miscellaneous points, gradient background colors, numbers of numbers, short strokes, and impossible to improve the recognition of OCR. There is no good identification engine yet. Yesterday, I downloaded 90%of the verification code claiming to recognize the image verification code! Identify 4321 to 89910, so the image code is still safer.
I saw the method of violent cracking on the Internet. If I use the image additional code to prohibit external submission of 10 passwords to error account and 50 passwords, the password error and trivial IP 10 seconds of anti -refresh interval registration page, the login page will be prohibited from submitting external submission. In this way, the brute cracked should not play.
Asp file: code.asp
Data file: body.fix, head.fix
Usage: <img src = "http://blog.netbei.com/code.asp">>
Response.buffer = true
Numcode
Function Numcode ()
Response.expires = -1
Response.addheader "Pragma", "no-Cache"
Response.addheader "cache-clm", "no-cache"
Dim Znum, I, J
dim ados, ados1
Randomize timeer
Generate random four digits:
znum = cint (8999*RND 1000)
Pass to session
Session ("getcode") = znum
The for loop is to put the random number into an array of 3 settlement 3, which is convenient for providing to the subsequent array transformation
dim zimg (3), nstr
Nstr = cstr (znum)
For i = 0 to 3