Advertisement
wandrake

Untitled

Apr 29th, 2011
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. #!/usr/bin/env python2.6
  2. # -*- coding: utf-8 -*-
  3. import urllib
  4. import urllib2
  5.  
  6. while True:
  7.     # build opener with HTTPCookieProcessor
  8.     o = urllib2.build_opener( urllib2.HTTPCookieProcessor() )
  9.     urllib2.install_opener( o )
  10.  
  11.     p = urllib.urlencode( { 'username': 'tuouser', 'password': 'tuapass', 'provider': 'LDAP-Studenti' } )
  12.  
  13.     # perform login with params
  14.     f = o.open( 'https://auth3.unipi.it/auth/perfigo_cm_validate.jsp',  p )
  15.     data = f.read()
  16.     f.close()
  17.  
  18.     p = urllib.urlencode( { 'username': 'tuouser', 'password': 'tuapass', 'provider': 'LDAP-Studenti', 'remove_old': '1' } )
  19.  
  20.     # perform login with params
  21.     f = o.open( 'https://auth3.unipi.it/auth/perfigo_cm_validate.jsp',  p )
  22.     data = f.read()
  23.     f.close()
  24.  
  25.     # second request should automatically pass back any
  26.     # cookies received during login... thanks to the HTTPCookieProcessor
  27.     f = o.open( 'http://www.google.it' )
  28.     data = f.read()
  29.     f.close()
  30.  
  31.     time.sleep(10000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement