wandrake

Untitled

Feb 27th, 2012
655
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python2.6
  2. # -*- coding: utf-8 -*-
  3.  
  4. import urllib
  5. import urllib2
  6. # build opener with HTTPCookieProcessor
  7. o = urllib2.build_opener( urllib2.HTTPCookieProcessor() )
  8. urllib2.install_opener( o )
  9.  
  10. # assuming the site expects 'user' and 'pass' as query params
  11. p = urllib.urlencode( { 'username': '', 'password': '', 'provider': 'LDAP UniPi' } )
  12.  
  13.  
  14. # perform login with params
  15. f = o.open( 'https://auth1.unipi.it/auth/perfigo_cm_validate.jsp',  p )
  16. data = f.read()
  17. e.close()
  18. f.close()
  19.  
  20. p = urllib.urlencode( { 'username': '', 'password': '', 'provider': 'LDAP UniPi', 'remove_old': '1' } )
  21.  
  22. # perform login with params
  23. f = o.open( 'https://auth1.unipi.it/auth/perfigo_cm_validate.jsp',  p )
  24. data = f.read()
  25. e.close()
  26. f.close()
  27.  
  28. # second request should automatically pass back any
  29. # cookies received during login... thanks to the HTTPCookieProcessor
  30. f = o.open( 'http://www.google.it' )
  31. data = f.read()
  32. f.close()
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×