include ltGDIPlus.au3gt include ltarray.au3gt include ltfile.au3gt
InetGetquotpassport.cdcgames/VerifyCode.aspxquotquotcode.jpgquot1 Global TempNum0 Global FirstNum0 Global SecondNum0 Global ThirdNum0 Global FourthNum0 Global CodeNumquotquot Global Line1 Global Line2 Global Line22 Global Line3 Global Line33 Global Line4 Global Line44 Global Line5 Global Line55 Global Line6 Global Line66 Global Line7 Global Line77 Global Line8 Global Line88 Global Line9 Global Line99 Global Line10 Global Line102 Global Line11 Global
Line112 Global Line12 Global ZeroNums12quot000000000000quot Global ZeroNums18quot000000000000000000quot Global
ZeroNums24quot000000000000000000000000quot Global
ZeroNums36quot000000000000000000000000000000000000quot Global
ZeroNums48quot000000000000000000000000000000000000000000000000quot Global aRecords Global aRray12 Global Row0 数组列数Global Cro0 行数
_ArrayDisplaya_Imagequot处理后的数组一维数组quot Func myArrayChangeSCfunc_array func_sc_type0 func_sc0x777777 func_bg0xffffff数组中的颜值做黑白变化If Not IsArrayfunc_array Or fu
nc_sc_typelt1 Or func_sc_typegt3 Or func_sc_type0 Then Return func_array If UBoundfunc_array2gt0 Then二维Local i_widthUBoundfunc_array1 Local i_heightUBoundfunc_array2 Local
a_returni_widthi_height x y s For y0 To i_height-1 For x 0 To i_width-1 a_returnxy func_arrayxy Select Case func_sc_type1黑白If a_returnxygtfunc_sc Then
a_returnxyfunc_bg Else a_returnxy0 EndIf Case func_sc_type2反相黑白If
a_returnxyltfunc_sc Then a_returnxyfunc_bg Else a_returnxy0 EndIf Case
func_sc_type3相当于1但黑用原代替就是保留原If a_returnxygtfunc_sc Then a_returnxyfunc_bg EndIf EndSelect Next Next Else Local i_heightUBoundfunc_array Local a_returni_height y For y0 To i_height-1 a_returny myChangeRegExpSCfunc_arrayy func_sc_type func_sc func_bg正则变化Next EndIf Return a_return EndFunc 以下三龊 际﹎yArrayChangeSC使用的不做详细介绍了Func myChangeRegExpSCfunc_string func_sc_type0 func_sc0xeeeeee
func_bg0xffffff将串做黑白变化If func_stringquotquot Or func_sc_typelt1 Or
func_sc_typegt3 Or ModStringLenfunc_string6ltgt0 Then Return func_string func_string StringRegExpReplacefunc_string quot.6quot quot0quot func_sc myGetRegExpSCfunc_sc ConsoleWri
tefunc_scampCRLF func_string StringRegExpReplacefunc_stringfunc_scquot______quot Select Case func_sc_type1 func_string StringRegExpReplacefunc_stringquot0-9A-F6quotquot000000quot
func_string StringReplacefunc_stringquot______quotHexfunc_bg6 Case
func_sc_type2 func_string
StringRegExpReplacefunc_stringquot0-9A-F6quotHexfunc_bg6 func_string StringReplacefunc_stringquot______quotquot000000quot Case func_sc_type3
func_string StringReplacefunc_stringquot______quotHexfunc_bg6 func_string StringReplacefunc_stringquotquot quotquot EndSelect Return func_string EndFunc Func myGetRegExpSCfunc_sc0x777777获取变化黑白临界值的正则表达式供myChangeRegExpSC调用func_scHexfunc_sc6 Local iss_RegExp For i1 To 6 sStringLeftfunc_sci If StringRights1ltgtquotFquot Then Select Case i6 s_RegExp amp myRegExpStringLefts5 amp myRegExpStringRights1 Case i5 s_RegExp ampmyRegExpHexNumberquot0xquotamps1iampquot0-9A-Fquot Case Else s_RegExp
ampmyRegExpHexNumberquot0xquotamps1i amp quot0-9A-Fquotamp6-iampquotquot EndSelect EndIf Next If StringRights_RegExp1quotquot Then
s_RegExpStringTrimRights_RegExp1 Return s_RegExp EndFunc Func myRegExpfunc_string供myGetRegExpSC调用单字符转正则If func_stringquotquot Then Return quotquot Local s_RegExpquotquot s_tmpquotquot For i1 To StringLenfunc_string s_tmpNumberquot0xquotampStringMidfunc_string i1 Select Case s_tmplt9 s_RegExp ampquotquotamps_tmp ampquot-9A-Fquot Case s_tmp9 s_RegExp ampquot9A-Fquot Case s_tmp0xF s_RegExp ampquotFquot Case Else s_RegExp ampquotquotampHexs_tmp1ampquot-Fquot EndSelect Next Return s_RegExp EndFunc 以下为前面已经说明过的函数将图形文件读入二维数组
----------------------------------------------------------------------------------------------- Func myReadImageToArrays_ImageFile b_Array2dFalse成功则返回数组.失败返回
0.b_Array2dTrue返回二维数组False返回一维数组Local hBitmap BitmapData i_width i_height Scan0 pixelData s_BMPData i_Stride _GDIPlus_Startup hBitmap
_GDIPlus_BitmapCreateFromFiles_ImageFile If error Then _GDIPlus_ShutDown Return 0无效的图形文件或未到该文件EndIf i_width
_GDIPlus_ImageGetWidthhBitmap Rowi_width i_height
_GDIPlus_ImageGetHeighthBitmap Croi_height BitmapData
_GDIPlus_BitmapLockBitshBitmap 0 0 i_width i_height GDIP_ILMREAD
GDIP_PXF24RGB MsgBox0hBitmapBitmapData If error Then ...... i_Stride DllStructGetDataBitmapData quotStridequotStride - Offset in bytes between consecutive scan lines of the bitmap. If the stride is positive the bitmap is top-down. If the stride is negative the bitmap is bottom-up. Scan0 DllStructGetDataBitmapData
quotScan0quotScan0 - Pointer to the first index 0 scan line of the bitmap. pixelData DllStructCreatequotubyte lDataquot amp Absi_Stride i_height amp quotquot Scan0 不要使用官方论坛上提供的Absi_Stride i_height-1否则无法正确处理gif冗余等情形MsgBox0quotquotpixelData s_BMPData DllStructGetDatapixelData quotlDataquot
s_BMPData StringTrimLefts_BMPData2去掉头部quot0xquot
_GDIPlus_BitmapUnlockBitshBitmap BitmapData _GDIPlus_ImageDisposehBitmap
_WinAPI_DeleteObject hBitmap _GDIPlus_Shutdown If b_Array2d Then要求返回二维数组Local a_returni_widthi_height x y s For y0 To i_height-1 sStringMids_BMPData yi_Stride21 i_width6 不要使
用一些例子中提出的sStringMids_BMPData yi_width61 i_width6经实际测试该方式无法正确处理: GIF冗余带隐藏内容的图形文件一种数据加密方式或者多页图形文件当然这些情形比较少见下同For x 0 To i_width-1
a_returnxy Numberquot0xquotampStringMidsx61 6 Next Next Else要求返回一维数组Local a_returni_height y For y0 To i_height-1 a_returnyStringMids_BMPData
yi_Stride21 i_width6 见上说明Next EndIf Return a_return EndFunc gtmyReadImageToArray Func ReadFirstNum 读取第一个字符CheckNum1 CheckNum2 CheckNum3 CheckNum4 CheckNum5 CheckNum6 CheckNum7 CheckNum8 CheckNum9 CheckNum0 FirstNumTempNum EndFunc Func ReadSecondNum 读取第二个字符for m1 to aRecords0 Step 1 将字符数组整个左移60个字符aRecordsmStringTrimLeftaRecordsm60 Next CheckNum1 CheckNum2 CheckNum3 CheckNum4 CheckNum5 CheckNum6 CheckNum7 CheckNum8 CheckNum9 CheckNum0 SecondNumTempNum EndFunc Func ReadThirdNum 读取
第三个字符for m1 to aRecords0 Step 1 将字符数组再次整个左移60位aRecordsmStringTrimLeftaRecordsm60 Next CheckNum1 CheckNum2 CheckNum3 CheckNum4 CheckNum5 CheckNum6 CheckNum7 CheckNum8 CheckNum9 CheckNum0 ThirdNumTempNum En
dFunc Func ReadFourthNum 读取第四个字符for m1 to aRecords0 Step 1 再次左移60 aRecordsmStringTrimLeftaRecordsm60 Next CheckNum1 CheckNum2 CheckNum3 CheckNum4 CheckNum5 CheckNum6 CheckNum7 CheckNum8 CheckNum9 CheckNum0 FourthNumTempNum EndFunc Func ChuShiHua 初始化变量Line1quotquot Line2quotquot Line22quotquot
Line3quotquot Line33quotquot Line4quotquot Line44quotquot Line5quotquot
Line55quotquot Line6quotquot Line66quotquot Line7quotquot Line77quotquot
Line8quotquot Line88quotquot Line9quotquot Line99quotquot Line10quotquot
Line102quotquot Line11quotquot Line112quotquot Line12quotquot EndFunc Func CheckNum1 判断数字1 特征信息1第一行43-54 第二行31-54 第三四五六七八九十十一十二行43-54 ChuShiHua
Line1StringLeftStringTrimLeftaRecords14212
Line2StringLeftStringTrimLeftaRecords23024
Line3StringLeftStringTrimLeftaRecords34212
Line4StringLeftStringTrimLeftaRecords44212
Line5StringLeftStringTrimLeftaRecords54212
Line6StringLeftStringTrimLeftaRecords64212
Line7StringLeftStringTrimLeftaRecords74212
Line8StringLeftStringTrimLeftaRecords84212
Line9StringLeftStringTrimLeftaRecords94212
Line10StringLeftStringTrimLeftaRecords104212
Line11StringLeftStringTrimLeftaRecords114212
Line12StringLeftStringTrimLeftaRecords124212
MsgBox0quotcheck1quotLine1ampquotquotampLine2ampquotquotampLine22ampquotq uotampLine3ampquotquotampLine33ampquotquotampLine4ampquotquotampLine44am pquotquotampLine5ampquotquotampLine55ampquotquotampLine6ampquotquotampLin e66ampquotquotampLine7ampquotquotampLine77ampquotquotampLine8ampquotquota mpLine88am
pquotquotampLine9ampquotquotampLine99ampquotquotampLine10ampqu otquotampLine102ampquotquotampLine11ampquotquotampLine112ampquotquotampLi ne12 if Line1ZeroNums12 And Line3ZeroNums12 And Line4ZeroNums12 And
Line5ZeroNums12 And Line6ZeroNums12 And Line7ZeroNums12 And
Line8ZeroNums12 And Line9ZeroNums12 And Line10ZeroNums12 And
Line11ZeroNums12 And Line12ZeroNums12 And Line2ZeroNums24 Then TempNumquot1quot EndIf EndFunc Func CheckNum2 判断数字2 特征信息2第一行37-60 第二行31-42 和55-66 第三行25-36 和61-72 第四五行61-72 第六行55-66 第七行49-60 第八行43-54 第九行37-48 第十行31-42 第十一行
25-36 第十二行25-72 ChuShiHua Line1StringLeftStringTrimLeftaRecords13612 Line2StringLeftStringTrimLeftaRecords23012
Line22StringLeftStringTrimLeftaRecords25412
Line3StringLeftStringTrimLeftaRecords32412
Line33StringLeftStringTrimLeftaRecords36012
Line4StringLeftStringTrimLeftaRecords46012
Line5StringLeftStringTrimLeftaRecords56012
Line6StringLeftStringTrimLeftaRecords65412
Line7StringLeftStringTrimLeftaRecords74812
Line8StringLeftStringTrimLeftaRecords84212
Line9StringLeftStringTrimLeftaRecords93612
Line10StringLeftStringTrimLeftaRecords103012
Line11StringLeftStringTrimLeftaRecords112412
Line12StringLeftStringTrimLeftaRecords122448
MsgBox0quotCheck2quotLine1ampquotquotampLine2ampquotquotampLine22ampquot quotampLine3ampquotquotampLine33ampquotquotampLine4ampquotquotampLine44a mpquotquotampLine5ampquotquotampLine55ampquotquotampLine6ampquotquotampLi ne66ampquo
tquotampLine7ampquotquotampLine77ampquotquotampLine8ampquotquot ampLine88ampquotquotampLine9ampquotquotampLine99ampquotquotampLine10ampq uotquotampLine102ampquotquotampLine11ampquotquotampLine112ampquotquotampL ine12 if Line1ZeroNums12 And Line2ZeroNums12 And Line3ZeroNums12 And
Line22ZeroNums12 And Line33ZeroNums12 And Line4ZeroNums12 And
Line5ZeroNums12 And Line6ZeroNums12 And Line7ZeroNums12 And
Line8ZeroNums12 And Line9ZeroNums12 And Line10ZeroNums12 And
Line11ZeroNums12 And Line12ZeroNums48 Then TempNumquot2quot EndIf EndFunc Func CheckNum3 判断数字3 特征信息3第一十二行37-60 第二十一行31-42 和55-66 第三十行25-36 和61-72 第四八九行61-72 第五七行55-66 第六行43-60 ChuShiHua Line1StringLeftStringTrimLeftaRecords13624
autoitLine2StringLeftStringTrimLeftaRecords23012
Line22StringLeftStringTrimLeftaRecords25412
Line3StringLeftStringTrimLeftaRecords32412
Line33StringLeftStringTrimLeftaRecords36012
Line4StringLeftStringTrimLeftaRecords46012
Line5StringLeftStringTrimLeftaRecords55412
Line6StringLeftStringTrimLeftaRecords64218
Line7StringLeftStringTrimLeftaRecords75412
Line8StringLeftStringTrimLeftaRecords86012
Line9StringLeftStringTrimLeftaRecords96012
Line10StringLeftStringTrimLeftaRecords102412
Line102StringLeftStringTrimLeftaRecords106012
Line11StringLeftStringTrimLeftaRecords113012
Line112StringLeftStringTrimLeftaRecords115412
Line12StringLeftStringTrimLeftaRecords123624
MsgBox0quotcheck3quotLine1ampquotquotampLine2ampquotquotampLine22ampquotq uotampLine3ampquotquotampLine33ampquotquotampLine4ampquotquotampLine44am pquotquotampLine5ampquotquotampLine55ampquotquotampLine6ampquotquotampLin e66ampquotquotampLine7ampquotquotampLine77ampquotquotampLine8ampquotquota mpLine88ampquotquotampLine9ampquotquotampLine99ampquotquotampLine10ampqu otquotampLine102ampquotquotampLine11ampquotquotampLine112ampquotquotampLi ne12 if Line1ZeroNums24 And Line12ZeroNums24 And Line2ZeroNums12 And
Line22ZeroNums12 And Line3ZeroNums12 And Line33ZeroNums12 And
Line4ZeroNums12 And Line5ZeroNums12 And Line7ZeroNums12 And
Line8ZeroNums12 And Line9ZeroNums12 And Line10ZeroNums12 And
Line102ZeroNums12 And Line11ZeroNums12 And Line112ZeroNums12 And
Line6ZeroNums18 Then TempNumquot3quot EndIf EndFunc Func CheckNum4 判断数字4 特征信息4第.
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论