Skip to content

Instantly share code, notes, and snippets.

Created January 7, 2017 10:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
A simple Python script to log into IIITD's firewall
import urllib
import urllib2
import time
link = ""
req = urllib2.Request(link)
response = urllib2.urlopen(req)
a =
c = a[a.find("magic"):]
e = c[:c.find(">")]
d = e.split("value=")[1].split("\"")[1]
print "Already logged in"
username = raw_input("Username: ")
pwd = raw_input("Password: ")
k = {"magic":d,"username":username,"password":pwd}
url = response.url
data = urllib.urlencode(k)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
print "Logged in"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment