Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python2.6
- # -*- coding: utf-8 -*-
- import urllib
- import urllib2
- from time import *
- # build opener with HTTPCookieProcessor
- while 1:
- sleep(1)
- print "A"
- o = urllib2.build_opener( urllib2.HTTPCookieProcessor() )
- urllib2.install_opener( o )
- # assuming the site expects 'user' and 'pass' as query params
- p = urllib.urlencode( { 'username': '----', 'password': '----', 'provider': 'LDAP UniPi' } )
- # perform login with params
- #f = o.open( 'https://auth5.unipi.it/auth/perfigo_cm_validate.jsp', p )
- f = o.open( 'https://131.114.189.142/auth/perfigo_cm_validate.jsp', p )
- data = f.read()
- #e=open('ciccio', 'w')
- #e.write(data)
- #e.close()
- f.close()
- p = urllib.urlencode( { 'username': '----', 'password': '----', 'provider': 'LDAP UniPi', 'remove_old': '1' } )
- # perform login with params
- #f = o.open( 'https://auth5.unipi.it/auth/perfigo_cm_validate.jsp', p )
- f = o.open( 'https://131.114.189.142/auth/perfigo_cm_validate.jsp', p )
- #e = open('cacca', 'w')
- data = f.read()
- #e.write(data)
- #e.close()
- f.close()
- sleep(10000)
- # second request should automatically pass back any
- # cookies received during login... thanks to the HTTPCookieProcessor
- f = o.open( 'http://www.google.it' )
- data = f.read()
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement