Quantcast

Jump to content


Photo

{Python} Is this the correct way to login to neopets?


  • Please log in to reply
6 replies to this topic

#1 jimmylegend

jimmylegend
  • 21 posts

Posted 15 November 2009 - 11:24 AM

I've heard this way can get you banned but this is the way I login.


import urllib
import urllib2
import cookielib

username = raw_input("Username: ")
password = raw_input("Password: ")

cookieJar = cookielib.LWPCookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookieJar))
opener.addheaders = [('User-agent', "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.4) Gecko/20061201 Firefox/2.0.0.4 (Ubuntu-feisty)")]
form = { "username" : username,
              "password" : password }

encodedForm = urllib.urlencode(form)
url = "http://www.neopets.com/login.phtml"
request = urllib2.Request(url, encodedForm)
page = opener.open(request)
contents = page.read()
    
if "logout" in contents:
    print "logged in"


#2 Backslash

Backslash
  • 47 posts

Posted 15 November 2009 - 12:06 PM

I cant make anything with python but I think i can read it...

One question, wheres the postdata?
and make sure you go to the Login page, enter username, check for errors, then enter password, check for errors, and yeah that should be it.

Also, if you notice in livehttpheaders at the end of each login URL there is "&x=#&y=#"

make sure to have a function make a random number between 0 and 40 in those #s.

#3 jimmylegend

jimmylegend
  • 21 posts

Posted 15 November 2009 - 12:18 PM

I cant make anything with python but I think i can read it...

One question, wheres the postdata?
and make sure you go to the Login page, enter username, check for errors, then enter password, check for errors, and yeah that should be it.

Also, if you notice in livehttpheaders at the end of each login URL there is "&x=#&y=#"

make sure to have a function make a random number between 0 and 40 in those #s.




If I don't have those will I get banned?

#4 Backslash

Backslash
  • 47 posts

Posted 15 November 2009 - 12:37 PM

Theres not really a guarantee but its just safe to do so, most modern programs do this and i think so does NeoCodex programs (that is if you didnt move your cookies from your browser to the program)

#5 jimmylegend

jimmylegend
  • 21 posts

Posted 15 November 2009 - 12:47 PM

Theres not really a guarantee but its just safe to do so, most modern programs do this and i think so does NeoCodex programs (that is if you didnt move your cookies from your browser to the program)


the program stores cookies

#6 ShadowLink64

ShadowLink64
  • 16735 posts


Users Awards

Posted 15 November 2009 - 02:52 PM

It should be fine except that I think you might be missing a "hidden" attribute in your post-data. There's username, password, but also "destination" isn't there?

Also, you are using a really old browser User-Agent from Linux. I would update that. :p

#7 Backslash

Backslash
  • 47 posts

Posted 15 November 2009 - 03:36 PM

Yes,
destination=%2Findex.phtml



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users