1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

decaptcher API example

Discussion in 'Visual Basic .NET' started by voidale, Mar 10, 2010.

  1. voidale

    voidale Jr. VIP Jr. VIP Premium Member

    Joined:
    Sep 29, 2008
    Messages:
    583
    Likes Received:
    176
    Hey anyone has a code with decaptcher API ?
    I'm trying to add decaptcher.com to my bot but dunno how:confused:
     
  2. gimme4free

    gimme4free Executive VIP Jr. VIP Premium Member

    Joined:
    Oct 22, 2008
    Messages:
    1,879
    Likes Received:
    1,932
  3. Knoxgates

    Knoxgates Supreme Member

    Joined:
    Aug 9, 2008
    Messages:
    1,266
    Likes Received:
    918
    voidale which one you are looking for . c# or vb

    EDIT: Thread posted in vb.net.
     
    Last edited: Mar 10, 2010
  4. voidale

    voidale Jr. VIP Jr. VIP Premium Member

    Joined:
    Sep 29, 2008
    Messages:
    583
    Likes Received:
    176
    Yeah vb.net, I'm still looking for it
    @gimme4free yea it's I'm using vb.net for like 5 days only lol
     
  5. smack

    smack Junior Member

    Joined:
    Feb 1, 2010
    Messages:
    182
    Likes Received:
    78
    Occupation:
    Software Engineer/Evil Genius
    Location:
    inside .NET
    is your intention to use their DLL that encompasses their API, or to use their HTTP API?
     
  6. pyronaut

    pyronaut Executive VIP

    Joined:
    Dec 9, 2008
    Messages:
    1,229
    Likes Received:
    1,422
    I use C# which i can show you how to use the code (I didn't end up using the code they give you, just the DLL).

    Pro Tip : Download a .net reflector. I use "Red Gate's". But i cant remember where i got it from. From there, go to the downloads section and find a tool that is built in .net and has decaptcher support. Reflect/decompile the application and read their code to get an idea of how you're supposed to use it.

    I'm not saying completely rip their code, but I can remember when i first tried using Decaptcher it was absolute hell. And their coding is shonky as hell...

    Ontop of that, Dont use their HTTP api, Multi-Part forms and .net don't mix.
     
    • Thanks Thanks x 1
  7. voidale

    voidale Jr. VIP Jr. VIP Premium Member

    Joined:
    Sep 29, 2008
    Messages:
    583
    Likes Received:
    176
    Downloaded the net reflector checked 1 software source couldn't find the decaptcher part :rolleyes:
    lol looking for more apps to see, seems hard to rip off their code too :eek:

    edit: I found 1 bot with the decaptcher code but i can't really understand how to use it ;/
     
    Last edited: Mar 11, 2010
  8. mline

    mline Newbie

    Joined:
    Jan 30, 2010
    Messages:
    49
    Likes Received:
    18
    I'd suggest just accessing it via http. Their dll is really rather poor and the comments/documentation were written by someone who clearly does not speak english as their first language...or they're from georgia. This isnt direct source or anything, it utilized my custom http class which has a fair amount of browser logic built into it. but it should give you a general idea of how to POST the picture to decaptcher. No, there isn't any reason for building the POST string the way I am instead of using stringbuilder...well, misguided laziness. But you get the picture. Anything else you need to know is available in decaptchers documentation.

    Code:
          
          Dim http As New HTTPsession(SessionType.Standard)
          Dim resp As HttpResponse
          Dim bound As String = rndNum(15, False)
          Dim postData As String
          Dim sreq As New SearchRequisites
          Dim dRet As New DecaptcherReturn
    
          With http
             .ConnectionTimeout = 15
             .TransferTimeout = 90
             .ContentType = "multipart/form-data; boundary=---------------------------" & bound
          End With
    
          With sreq
             .AddAND("<table><tr>")
             .AddAND("</tr></table>")
          End With
    
          bound = "-----------------------------" & bound
    
          postData = bound & vbNewLine & _
             "Content-Disposition: form-data; name=""function""" & vbNewLine & vbNewLine & _
             "picture2" & vbNewLine & bound & vbNewLine & _
             "Content-Disposition: form-data; name=""username""" & vbNewLine & vbNewLine & _
             name & vbNewLine & bound & vbNewLine & _
             "Content-Disposition: form-data; name=""password""" & vbNewLine & vbNewLine & _
             pw & vbNewLine & bound & vbNewLine & _
             "Content-Disposition: form-data; name=""pict""; filename=""" & rndStr(10, True) & "." & fileExt & """" & vbNewLine & _
             "Content-Type: " & fileType & vbNewLine & vbNewLine & _
             img & vbNewLine & bound & vbNewLine & _
             "Content-Disposition: form-data; name=""pict_to""" & vbNewLine & vbNewLine & _
             "2" & vbNewLine & bound & vbNewLine & _
             "Content-Disposition: form-data; name=""pict_type""" & vbNewLine & vbNewLine & _
             PictType & vbNewLine & bound & "--"
    
     
    • Thanks Thanks x 1
  9. Knoxgates

    Knoxgates Supreme Member

    Joined:
    Aug 9, 2008
    Messages:
    1,266
    Likes Received:
    918
    This doesn't work if it is obfuscate with smart assembly.
     
  10. mline

    mline Newbie

    Joined:
    Jan 30, 2010
    Messages:
    49
    Likes Received:
    18
    PS- If you really, really, really rather work with the DLL and API (which, again, seriously, are horrible) this is the function from the class i made when the http dns for decaptcher was fucked for like 2 weeks, which interopts in the shared dll methods. You will need to build a class around those shared dll methods (already in the vb.net source for decaptcher).

    Code:
          Public Function SolveCaptcha(ByVal img As String, ByVal timeoutSetting As TimeoutLimits, _
                                        Optional ByVal pictureType As Integer = 0, Optional ByVal fileExt As String = "jpg", _
                                        Optional ByVal fileType As String = "image/jpeg") As DecaptcherResult
    
             Dim dID As Integer
             Dim dRet As Integer
             Dim picByte As Byte()
             Dim _captcha As Byte()
             Dim major_id As Integer()
             Dim minor_id As Integer()
             Dim captchaText As String = ""
             Dim bufSize As Integer = 255
             Dim picTo() As Integer
             Dim picType() As Integer
             Dim dResult As New DecaptcherAPI.DecaptcherResult
    
             Try
                dID = CCprotoInit()
                If dID >= 0 Then
                   dRet = CCprotoLogin(dID, _host, _port, _name, _name.Length, _pw, _pw.Length)
                   If dRet = 0 Then
    
                      _captcha = New Byte(255) {}
                      major_id = New Integer(1) {}
                      minor_id = New Integer(1) {}
                      picByte = Encoding.Default.GetBytes(img)
                      picTo = New Integer(1) {}
                      picType = New Integer(1) {}
                      picType(0) = pictureType
    
                      Select Case timeoutSetting
                         Case TimeoutLimits.Infinite : picTo(0) = 1
                         Case TimeoutLimits.NinetySeconds : picTo(0) = 4
                         Case TimeoutLimits.ServiceDefault : picTo(0) = 0
                         Case TimeoutLimits.SixtySeconds : picTo(0) = 2
                         Case TimeoutLimits.ThirtySeconds : picTo(0) = 3
                      End Select
    
                      dRet = CCprotoPicture2(dID, picByte(0), picByte.Length, picTo(0), picType(0), _captcha(0), 255, major_id(0), minor_id(0))
                      captchaText = New String(Encoding.Default.GetChars(_captcha))
                      captchaText = Replace(captchaText, Chr(0), "")
    
                      dResult = New DecaptcherAPI.DecaptcherResult(dRet, captchaText, major_id(0), minor_id(0))
                   End If
    
                   dRet = CCprotoClose(dID)
                   dRet = CCprotoDestroy(dID)
                End If
             Catch ex As Exception
                Debug.WriteLine(ex.ToString)
             End Try
    
             img = Nothing
             picByte = Nothing
    
             Return dResult
          End Function
     
    • Thanks Thanks x 1
  11. pyronaut

    pyronaut Executive VIP

    Joined:
    Dec 9, 2008
    Messages:
    1,229
    Likes Received:
    1,422
    Generally speaking. If it's a cracked software, or just someone being nice sharing their software. They aren't going to have it obbed.

    There is a craigs decaptcher addon shared somewhere on here. And that's what I decompiled to learn how to use decaptcher.
     
  12. mline

    mline Newbie

    Joined:
    Jan 30, 2010
    Messages:
    49
    Likes Received:
    18
    No offense, that is an absolutely ridiculous statement. I assume you mean multi-part's dont work well with whatever class or namespace you're using. But if you can't use multipart forms .net you're really excluding yourself from a lot of sites, almost everywhere bases any picture upload they have on it (myspace, CL, facebook, etc). There are about an infinite number of ways in which you can submit multipart. It's no different than any other POST string you may have to compile. It's simply formatted differently.
     
    Last edited: Mar 11, 2010
  13. smack

    smack Junior Member

    Joined:
    Feb 1, 2010
    Messages:
    182
    Likes Received:
    78
    Occupation:
    Software Engineer/Evil Genius
    Location:
    inside .NET

    how do you figure?