szlqa1 发表于 2012-9-27 13:55:37

100元找人把下面的AU3脚本写成DLL

Const $DEATHBYCAPTCHA_VERSION = "DBC/AutoIt v4.0.4"
Const $DEATHBYCAPTCHA_HOST = "api.dbcapi.me"
Const $DEATHBYCAPTCHA_PORTS =
Const $DEATHBYCAPTCHA_BASE64_TABLE = StringToASCIIArray("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=")


Func _DeathByCaptchaBase64Encode($buf)
    Local $c = 0, $i = 1, $j = 0, $l = BinaryLen($buf), $m = Mod($l, 3)
    Local $dest = ""
    While $i <= $l - $m
      $c = BitOR(BitShift(BinaryMid($buf, $i, 1), -16), BitShift(BinaryMid($buf, $i + 1, 1), -8), BinaryMid($buf, $i + 2, 1))
      $dest &= Chr($DEATHBYCAPTCHA_BASE64_TABLE)
      $dest &= Chr($DEATHBYCAPTCHA_BASE64_TABLE)
      $dest &= Chr($DEATHBYCAPTCHA_BASE64_TABLE)
      $dest &= Chr($DEATHBYCAPTCHA_BASE64_TABLE)
      $i += 3
      $j += 4
    WEnd
    If 1 = $m Then
      $dest &= Chr($DEATHBYCAPTCHA_BASE64_TABLE)
      $dest &= Chr($DEATHBYCAPTCHA_BASE64_TABLE)
      $dest &= Chr($DEATHBYCAPTCHA_BASE64_TABLE)
      $dest &= Chr($DEATHBYCAPTCHA_BASE64_TABLE)
    ElseIf 2 = $m Then
      $c = BitOR(BitShift(BinaryMid($buf, $i, 1), -8), BinaryMid($buf, $i + 1, 1))
      $dest &= Chr($DEATHBYCAPTCHA_BASE64_TABLE)
      $dest &= Chr($DEATHBYCAPTCHA_BASE64_TABLE)
      $dest &= Chr($DEATHBYCAPTCHA_BASE64_TABLE)
      $dest &= Chr($DEATHBYCAPTCHA_BASE64_TABLE)
    EndIf
    Return $dest
EndFunc

Func _DeathByCaptchaCall($buf)
    $buf &= Chr(13)
    $buf &= Chr(10)
    Local $response = ""
    TCPStartUp()
    Local $sock = TCPConnect(TCPNameToIp($DEATHBYCAPTCHA_HOST), Random($DEATHBYCAPTCHA_PORTS, $DEATHBYCAPTCHA_PORTS, 1))
    If 0 < $sock Then
      Local $n = 0
      While 0 < StringLen($buf)
            $n = TCPSend($sock, $buf)
            If 0 < $n Then
                $buf = StringTrimLeft($buf, $n)
            EndIf
      WEnd
      Do
            $response &= TCPRecv($sock, 1024)
      Until @error OR 0 == StringCompare(Chr(10), StringRight($response, 1))
      TCPCloseSocket($sock)
    EndIf
    TCPShutdown()
    Return $response
EndFunc


; Uploads a CAPTCHA.
; Call with your DeathByCaptcha username/password and CAPTCHA file name.
; Returns unique CAPTCHA ID on success, 0 otherwise.
Func DeathByCaptchaUpload($username, $password, $captchaFileName)
    Local $f = FileOpen($captchaFileName, 16)
    If -1 < $f Then
      Local $img = FileRead($f)
      If @error Then
            $img = Binary("")
      EndIf
      FileClose($f)
      If 0 < BinaryLen($img) Then
            Local $a = StringRegExp(_DeathByCaptchaCall('{"version":"' & $DEATHBYCAPTCHA_VERSION & '","cmd":"upload","username":"' & $username & '","password":"' & $password & '","captcha":"' & _DeathByCaptchaBase64Encode($img) & '"}'), '"captcha"\s?:\s?(\d+)', 1)
            If 0 < UBound($a) Then
                Return Int($a)
            EndIf
      EndIf
    EndIf
    Return 0
EndFunc

; Fetches a CAPTCHA text.
; Call with unique CAPTCHA ID.
; Returns "" if the CAPTCHA is not solved or does not exist.
Func DeathByCaptchaGetText($captchaId)
    Local $a = StringRegExp(_DeathByCaptchaCall(StringFormat('{"version":"%s","cmd":"captcha","captcha":%d}', $DEATHBYCAPTCHA_VERSION, $captchaId)), '"text"\s?:\s?"([^"]+)"', 1)
    If 0 < UBound($a) Then
      Return $a
    Else
      Return ""
    EndIf
EndFunc

; Remove an unsolved CAPTCHA you won't to be solved anymore.
; Call with your DeathByCaptcha username/password and unique CAPTCHA ID.
; Returns 1 on success, 0 otherwise.
Func DeathByCaptchaRemove($username, $password, $captchaId)
    Return StringRegExp(_DeathByCaptchaCall(StringFormat('{"version":"%s","cmd":"remove","username":"%s","password":"%s","captcha":%d}', $DEATHBYCAPTCHA_VERSION, $username, $password, $captchaId)), '"captcha"\s?:\s?0')
EndFunc

; Reports a CAPTCHA as incorrectly solved.
; Call with your DeathByCaptcha username/password and unique CAPTCHA ID.
; Returns 1 on success, 0 otherwise.
Func DeathByCaptchaReport($username, $password, $captchaId)
    Return StringRegExp(_DeathByCaptchaCall(StringFormat('{"version":"%s","cmd":"report","username":"%s","password":"%s","captcha":%d}', $DEATHBYCAPTCHA_VERSION, $username, $password, $captchaId)), '"is_correct"\s?:\s?false')
EndFunc

; Decodes a CAPTCHA by uploading it and polling for its status repeatedly.
; Call with your DeathByCaptcha username/password, CAPTCHA file name and
; solving timeout (in seconds).Returns an two-elements array with CAPTCHA
; unique ID (zero if not solved) and text (empty string if not solved).
; Removes unsolved CAPTCHAs automatically.
Func DeathByCaptchaDecode($username, $password, $captchaFileName, $timeout)
    Local $result =
    $result = DeathByCaptchaUpload($username, $password, $captchaFileName)
    If 0 < $result Then
      Local $deadline = $timeout * 1000
      While 0 = StringLen($result) AND 0 < $deadline
            Sleep(10000)
            $deadline -= 10000
            $result = DeathByCaptchaGetText($result)
      WEnd
      If 0 = StringLen($result) Then
            $result = 0
      EndIf
    EndIf
    Return $result
EndFunc


; Usage example
; =============
;
; Call DeathByCaptchaDecode() function with your DBC username, password,
; CAPTCHA file name, and desired solving timeout (in seconds) as arguments.
; You'll receive an array of two elements: numeric CAPTCHA ID and its text;
; CAPTCHA ID will be greater than zero if the CAPTCHA was solved.
;
;$result = DeathByCaptchaDecode($CmdLine, $CmdLine, $CmdLine, 60)
;MsgBox(0, "decode()", StringFormat('ID: %s, text: %s', $result, $result))



联系QQ:2466186871
可以用其他语言写DLL,要支持多线程运行

szlqa1 发表于 2012-9-27 13:58:16

QQ在线等......

xx44t10 发表于 2012-9-27 23:03:25

春天花会开。。。貌似明年春天才有人来接

debu99 发表于 2012-10-4 14:55:29

100也太少了吧

qiziyun7410 发表于 2012-12-27 16:40:48

这个是个网络方面的脚本吧!!!!!!!!!

huangwei 发表于 2013-1-5 21:33:04

不错,挺好的。谢谢
页: [1]
查看完整版本: 100元找人把下面的AU3脚本写成DLL