Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import urllib, urllib2, cookielib
  2.  
  3. username = 'myuser'
  4. password = 'mypassword'
  5.  
  6. cj = cookielib.CookieJar()
  7. opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  8. login_data = urllib.urlencode({'username' : username, 'password' : password})
  9. opener.open('http://www.example.com/login.php', login_data)
  10. resp = opener.open('http://www.example.com/hiddenpage.php')
  11. if 'My profile' in resp.read():
  12. print("LOGGED IN")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement