IMPORTANT: Please read our Guide To Quality Writing before you begin posting!

Dismiss Notice
Please note that we are only approving writers from the US, UK and Canada at this time.

[Python] Create your own account generator!

Discussion in 'Programming' started by fabiof00, Jun 15, 2015.

  1. fabiof00

    fabiof00 New Member

    Joined:
    Jun 15, 2015
    Posts:
    0
    Likes Received:
    0
    Gender:
    Male
    Today, I will be showing you how to create your very own account creator. The example register form we will be using is: http://www.kongregate.com/accounts/new - Kongregate, a website which hosts many different games (like Miniclip). To make our lives easier we will be using a module called 'mechanize'. This module is not part of the Python standard library so you must install it.

    Step 1) Importing 'mechanize'

    import mechanize

    All this is doing is importing the module so we can use the functions/methods built in this module.





    Step 2) Defining the 'url' variable

    import mechanize

    url = "http://www.kongregate.com/accounts/new"

    This is optional but it will make your code easier on the eye



    Step 3) Creating the 'mechanize.Browser' object

    import mechanize

    url = "http://www.kongregate.com/accounts/new"

    br = mechanize.Browser()

    This is creating an instance of the 'mechanize.Browser' object, so we now have a browser.



    ​Step 4) Visiting our 'url'

    import mechanize

    url = "http://www.kongregate.com/accounts/new"

    br = mechanize.Browser()
    br.open(url)

    Now the 'br' (our browser) will visit the page which has been passed through the 'open()' function, in our case it is our 'url' variable



    Step 5) Finding our form



    1. Go on to the page where your register form is, for us it is this
    2. Open Inspect Element
    3. Highlight your form using the Inspect tool
    4. Find the forms 'name' or 'id' attribute (or any other attribute which you are sure is unique for that form only)
    Now that we have the form we wish to target's 'id' or 'name' attribute we can target it, using Python

    import mechanize

    url = "http://www.kongregate.com/accounts/new"

    br = mechanize.Browser()
    br.open(url)


    for form in br.forms(): #This will loop through all the forms in the page
    if form.attrs["id"] == "registration_form": #When the form with the attribute 'id' is found it will stop
    br.form = form #This will assign br.form to the form which we found
    break #This will break out of the loop


    Step 6) Filling in our form



    1. Go on to the page where your register form is, for us it is this
    2. Open Inspect Element
    3. Highlight an input field on your register form using the Inspect tool
    4. Find out the 'name' attribute for each of these inputs
    5. Go back to 3. until you have the 'name' attributes of all the inputs you must fill to submit the form
    Now that we have the 'name' attributes of all the inputs we wish to fill, we can fill them.

    Syntax:

    br.form[<YOUR INPUT'S 'NAME' ATTRIBUTE GOES HERE>] = "<VALUE>"



    import mechanize


    url = "http://www.kongregate.com/accounts/new"


    br = mechanize.Browser()
    br.open(url)




    for form in br.forms():
    if form.attrs["id"] == "registration_form":
    br.form = form
    break


    br.form["user[email_address]"] = "yourrandemailhere"
    br.form["user[password]"] = "yourrandpasshere"
    br.form["user[birth_date(1i)]"] = ["1993"]
    br.form["user[username]"] = "yourrandusernamehere"


    Step 7) Submit the form

    import mechanize

    url = "http://www.kongregate.com/accounts/new"

    br = mechanize.Browser()
    br.open(url)


    for form in br.forms():
    if form.attrs["id"] == "registration_form":
    br.form = form
    break

    br.form["user[email_address]"] = "yourrandemailhere"
    br.form["user[password]"] = "yourrandpasshere"
    br.form["user[birth_date(1i)]"] = ["1993"]
    br.form["user[username]"] = "yourrandusernamehere"

    br.submit()

    That's it! If you have any problems making your own account creator please reply to this thread. This will not work on forms which have Captcha. If you have made an account creator using this method reply to the thread so I can add it to the list below.



    Kongregate Account Creator:

    import mechanize


    url = "http://www.kongregate.com/accounts/new"

    br = mechanize.Browser()
    br.open(url)


    for form in br.forms():
    if form.attrs["id"] == "registration_form":
    br.form = form
    break

    br.form["user[email_address]"] = "yourrandemailhere"
    br.form["user[password]"] = "yourrandpasshere"
    br.form["user[birth_date(1i)]"] = ["1993"]
    br.form["user[username]"] = "yourrandusernamehere"

    br.submit()
     

Share This Page