Skip to content

Instantly share code, notes, and snippets.

@celoron
Created January 23, 2013 11:31
Show Gist options
  • Select an option

  • Save celoron/4604590 to your computer and use it in GitHub Desktop.

Select an option

Save celoron/4604590 to your computer and use it in GitHub Desktop.
very simple script that can login facebook.
import cookielib, urllib2, time
from pyquery import PyQuery as pq
email="mail@mail.com"
pwd="yeasure :D"
cj = cookielib.CookieJar()
go = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
d= pq(go.open("http://www.facebook.com/").read())
lsd = d("input").filter(lambda i, this: pq(this).attr("name") == 'lsd').attr("value")
lgnrnd= d("input").filter(lambda i, this: pq(this).attr("name") == 'lgnrnd').attr("value")
data= ""
#bot protectors
data+= "lsd=%s&" % lsd
data+= "lgnrnd=%s&" % lgnrnd
data+= "lgnjs=%s&" % time.time()
#login req
data+= "email=%s&" % email
data+= "pass=%s&" % pwd
h=go.open("https://www.facebook.com/login.php", data).read()
open("out.html", "w+").write(h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment