Advertisement
wandrake

Untitled

Nov 19th, 2013
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.26 KB | None | 0 0
  1. #!/usr/bin/env python2.6
  2. # -*- coding: utf-8 -*-
  3. import urllib
  4. import urllib2
  5. from time import *
  6. # build opener with HTTPCookieProcessor
  7. while 1:
  8.     sleep(1)
  9.     print "A"
  10.     o = urllib2.build_opener( urllib2.HTTPCookieProcessor() )
  11.     urllib2.install_opener( o )
  12.  
  13.     # assuming the site expects 'user' and 'pass' as query params
  14.     p = urllib.urlencode( { 'username': '----', 'password': '----', 'provider': 'LDAP UniPi' } )
  15.  
  16.  
  17.     # perform login with params
  18.     #f = o.open( 'https://auth5.unipi.it/auth/perfigo_cm_validate.jsp',  p )
  19.     f = o.open( 'https://131.114.189.142/auth/perfigo_cm_validate.jsp',  p )
  20.     data = f.read()
  21.     #e=open('ciccio', 'w')
  22.     #e.write(data)
  23.     #e.close()
  24.     f.close()
  25.  
  26.     p = urllib.urlencode( { 'username': '----', 'password': '----', 'provider': 'LDAP UniPi', 'remove_old': '1' } )
  27.  
  28.     # perform login with params
  29.     #f = o.open( 'https://auth5.unipi.it/auth/perfigo_cm_validate.jsp',  p )
  30.     f = o.open( 'https://131.114.189.142/auth/perfigo_cm_validate.jsp',  p )
  31.     #e = open('cacca', 'w')
  32.     data = f.read()
  33.     #e.write(data)
  34.     #e.close()
  35.     f.close()
  36.     sleep(10000)
  37.  
  38.  
  39. # second request should automatically pass back any
  40. # cookies received during login... thanks to the HTTPCookieProcessor
  41. f = o.open( 'http://www.google.it' )
  42. data = f.read()
  43. f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement