Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[SOURCE] Twitter Sign-Up (WebRequests) + CONFIRM + Other Useful Bot Functions

I was going to make a Twitter bot but I got a different project to work on..



The confirmation email works with YopMail, so sign up with [email protected] and use the same email to confirm.

Twitter Sign Up:

Code
Private Shared CookieContainer As Net.CookieContainer
    Public Const USER_AGENT As String = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"
    
    
#Region "SignUp Function"
    Shared Function SignUp(ByVal name As String, ByVal username As String, ByVal password As String, ByVal email As String)
        Dim ValueRequest, PostRequest As Net.HttpWebRequest
        Dim ValueResponse As Net.HttpWebResponse
        Dim ValueStream As IO.Stream
        Dim ValueReader As IO.StreamReader
        Dim ValueSource As String

        Dim PostResponse As Net.HttpWebResponse
        Dim PostStream As IO.Stream
        Dim PostReader As IO.StreamReader
        Dim PostBytes As Byte()
        Dim PostSource As String
        Dim PostString As String
        Dim AuthToken As String
        CookieContainer = New Net.CookieContainer
        
        Try
            ValueRequest = Net.HttpWebRequest.Create("https://twitter.com/signup")
            ValueRequest.Timeout = 10000
            ValueRequest.UserAgent = USER_AGENT
            ValueRequest.CookieContainer = CookieContainer
            ValueResponse = ValueRequest.GetResponse
            ValueStream = ValueResponse.GetResponseStream
            ValueReader = New IO.StreamReader(ValueStream)
            ValueSource = ValueReader.ReadToEnd()
            AuthToken = Split(ValueSource, "hidden""")(3).Split("""")(1)

            PostString = "authenticity_token=" & AuthToken & "&user%5Bname%5D=" & name.Replace(" ", "+") & "&user%5Bemail%5D=" & email.Replace("@", "%40") & "&user%5Buser_password%5D=" & password & "&user%5Bscreen_name%5D=" & username & "&user%5Bremember_me_on_signup%5D=&asked_cookie_personalization_setting=1&context=front&ad_ref=&user%5Bdiscoverable_by_email%5D=1&user%5Bsend_email_newsletter%5D=1"
            PostRequest = Net.HttpWebRequest.Create("https://twitter.com/account/create")
            PostRequest.Timeout = 10000
            PostRequest.CookieContainer = CookieContainer
            PostRequest.UserAgent = USER_AGENT
            PostRequest.Method = "POST"
            PostBytes = System.Text.Encoding.UTF8.GetBytes(PostString)
            PostRequest.ContentLength = PostBytes.Length
            PostStream = PostRequest.GetRequestStream
            PostStream.Write(PostBytes, 0, PostBytes.Length)
            PostStream.Flush()
            PostStream.Close()
            PostResponse = PostRequest.GetResponse
            PostStream = PostResponse.GetResponseStream
            PostReader = New IO.StreamReader(PostStream)
            PostSource = PostReader.ReadToEnd
            Return PostSource.Contains("Your timeline is currently empty.")
        Catch ex As Exception
            MsgBox(ex.Message)
            Return False
        End Try

        ValueRequest = Nothing
        ValueResponse = Nothing
        ValueStream = Nothing
        ValueReader = Nothing
        ValueSource = Nothing

        PostRequest = Nothing
        PostResponse = Nothing
        PostStream = Nothing
        PostReader = Nothing
        PostSource = Nothing
    End Function
#End Region

GetConfirmLink Function (returns the YopMail Link to the confirm email):

Code
#Region "GetConfirmLink Function"
    Shared Function GetConfirmLink(ByVal email As String)
        Dim s As String = wc.DownloadString("http://www.yopmail.com/en/rss.php?login=" & email).Replace("</guid", "ʘ")
        If s.Contains("Confirm your Twitter account,") Then
            Return "http://www.yopmail.com/en/mail.php?id=m" & Split(s, "Confirm your Twitter account,")(1).Split("ʘ")(0).Substring(Split(s, "Confirm your Twitter account,")(1).Split("ʘ")(0).LastIndexOf(">") + 1)
        Else
            Return False
        End If
    End Function
#End Region

ExtractConfirmLinkFromEmail Function (Returns the actual twitter.com link to confirm the new account)

Code
#Region "ExtractConfirmLinkFromEmail Function"
    Shared Function ExtractConfirmLinkFromEmail(ByVal url As String)
        Return "https://twitter.com/account/confirm_email" & Split(wc.DownloadString(url), "https://twitter.com/account/confirm_email")(1).Split("""")(0).Replace("&amp;", "&")
    End Function
#End Region



Other useful functions for botting (Includes an Enum for mixing up the format instead of using one single username format):


Code
#Region "UsernameFormat Enum"
    Enum UsernameFormat
        InitialsNumbers = 0
        FirstNameNumbers = 1
        FirstNameRandomWordNumbers = 2
        InitialsRandomWordNumbers = 3
        RandomWordInitialsNumbers = 4
        RandomWordNameNumbers = 5
        LastNameNumbers = 6
        LastNameNumbersRandomWord = 7
        LastNameRandomWordNumbers = 8
        NumbersLastNameFirstName = 9
        NumbersFirstNameRandomWord = 10
    End Enum
#End Region

#Region "RandomUsername Function"
    Shared Function RandomUsername(ByVal Name As String)
        Dim Values As Array = [Enum].GetValues(GetType(UsernameFormat))
        Dim Format As UsernameFormat = Values.GetValue(New Random(Now.Millisecond).Next(0, 10))
        Select Case Format
            Case UsernameFormat.InitialsNumbers
                Return Name.Split(" ")(0).Chars(1) & Name.Split(" ")(1).Chars(1) & RandomNumber()
            Case UsernameFormat.FirstNameNumbers
                Return Name.Split(" ")(0) & RandomNumber()
            Case UsernameFormat.FirstNameRandomWordNumbers
                Return Name.Split(" ")(0) & RandomWord() & RandomNumber()
            Case UsernameFormat.InitialsRandomWordNumbers
                Return Name.Split(" ")(0).Chars(1) & Name.Split(" ")(1).Chars(1) & RandomWord() & RandomNumber()
            Case UsernameFormat.RandomWordInitialsNumbers
                Return RandomWord() & Name.Split(" ")(0).Chars(1) & Name.Split(" ")(1).Chars(1) & RandomNumber()
            Case UsernameFormat.RandomWordNameNumbers
                Return RandomWord() & Name.Replace(" ", "") & RandomNumber()
            Case UsernameFormat.LastNameNumbersRandomWord
                Return Name.Split(" ")(1) & RandomNumber() & RandomWord()
            Case UsernameFormat.LastNameNumbers
                Return Name.Split(" ")(1) & RandomNumber()
            Case UsernameFormat.NumbersLastNameFirstName
                Return RandomNumber() & Name.Split(" ")(1) & Name.Split(" ")(0)
            Case UsernameFormat.NumbersFirstNameRandomWord
                Return RandomNumber() & Name.Split(" ")(0) & RandomWord()
            Case UsernameFormat.LastNameRandomWordNumbers
                Return Name.Split(" ")(1) & RandomWord() & RandomNumber()
        End Select
        Return RandomNumber() & RandomNumber() & RandomNumber() & RandomNumber() & RandomNumber()
    End Function
#End Region

#Region "RandomName Function"
    Shared Function RandomName()
        Dim s As String = wc.DownloadString("http://www.fakenamegenerator.com/")
        Return Split(s, "given-name"">")(1).Split("<")(0) & " " & Split(s, "family-name"">")(1).Split("<")(0)
    End Function
#End Region

#Region "RandomWord Function"
    Private Shared Function RandomWord()
        Return wc.DownloadString("http://www.wordgenerator.net/application/p.php?id=dictionary_words&type=50_definition&spaceflag=false").Split("<")(0).Replace(" ", "")
    End Function
#End Region

#Region "RandomNumber Function"
    Shared Function RandomNumber()
        Threading.Thread.Sleep(1)
        Return New Random(Now.Millisecond).Next(1000, 99999)
    End Function
#End Region


Enjoy.
Well the captcha is going to be activated after the first registration hit, so this pretty much works only for the first account. :P

There's also http://msdn.microsoft.com/en-us/library/...ncode.aspx so you don't need to .replace yourself.
(Jul 6, 2012 07:47 PM)facebookdoom Wrote:  Well the captcha is going to be activated after the first registration hit, so this pretty much works only for the first account. :P

There's also http://msdn.microsoft.com/en-us/library/...ncode.aspx so you don't need to .replace yourself.

I made it so mine used proxies, it didn't get any captchas at all.
(Jul 6, 2012 07:53 PM)Cody8295 Wrote:  I made it so mine used proxies, it didn't get any captchas at all.

There's a registration limit, around 10 accounts per IP. The first registration is always without captcha. Try it multiple times from the same proxy or your own IP and you'll see.
(Jul 6, 2012 07:55 PM)facebookdoom Wrote:  There's a registration limit, around 10 accounts per IP. The first registration is always without captcha. Try it multiple times from the same proxy or your own IP and you'll see.

That's why I was using fresh proxies, haha.
Could I get a link to someone's that is working? I tried it myself and it never seems to work -_-

Thanks!
~KyleBoyer
[Image: vfhNNbJ.gif]
(Jul 8, 2012 07:58 PM)Team4o4 Wrote:  Could I get a link to someone's that is working? I tried it myself and it never seems to work -_-

Thanks!
~KyleBoyer

It worked fine for me, make sure you're not signing up more than once on one IP.
(Jul 8, 2012 08:11 PM)Cody8295 Wrote:  It worked fine for me, make sure you're not signing up more than once on one IP.

I made sure of that and when it didn't work I went on twitter and signed up by hand and I got no captcha... Could I just try out one of yours?
[Image: vfhNNbJ.gif]
(Jul 8, 2012 08:12 PM)Team4o4 Wrote:  I made sure of that and when it didn't work I went on twitter and signed up by hand and I got no captcha... Could I just try out one of yours?

Maybe the username is taken or the password isn't acceptable, or maybe you're using a bad email.
(Jul 8, 2012 08:14 PM)Cody8295 Wrote:  Maybe the username is taken or the password isn't acceptable, or maybe you're using a bad email.

Username was 15 characters long, numbers letters and caps, email was the [email protected] and the password was 6 characters long numbers and letters... Can I seriously see someones source?
[Image: vfhNNbJ.gif]
(Jul 8, 2012 08:20 PM)Team4o4 Wrote:  Username was 15 characters long, numbers letters and caps, email was the [email protected] and the password was 6 characters long numbers and letters... Can I seriously see someones source?

Well it worked perfectly fine for me. I don't know why it doesn't work for you.
(Jul 8, 2012 08:22 PM)Cody8295 Wrote:  Well it worked perfectly fine for me. I don't know why it doesn't work for you.

Can I just try yours out?
35charslong
[Image: vfhNNbJ.gif]
(Jul 8, 2012 08:24 PM)Team4o4 Wrote:  Can I just try yours out?
35charslong

The source in the code box is my source. I just fill in the rest of the info with random stuff.
(Jul 8, 2012 08:25 PM)Cody8295 Wrote:  The source in the code box is my source. I just fill in the rest of the info with random stuff.

I tried it all... But like can I try out someone's already compiled one or something?
[Image: vfhNNbJ.gif]
(Jul 8, 2012 08:26 PM)Team4o4 Wrote:  I tried it all... But like can I try out someone's already compiled one or something?
Render the result source of the response in a webbrowser, then you can see whats happening.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by NinjaDec 24, 2017 02:22 PM 15 579 Dec 24, 2017 02:22 PM
Last Post: Ninja
[Python] by XoggJan 11, 2017 12:13 PM 14 320 Jan 11, 2017 12:13 PM
Last Post: xthanos
[Shell] by AlexDec 1, 2016 04:24 AM 1 102 Dec 1, 2016 04:24 AM
Last Post: Travelers