#!/usr/bin/env python # snitzloc.py # Original script by Family_Guy (lhschris@gmail.com) # Script modified by Jorge Pena/Blank Denim (jorgepblank@gmail.com) # New Features: # -Authentication of user login details # -Command line execution with parameters # -Usable with any snitz forum (Unless it's somehow patched) import httplib, urllib, urllib2, cookielib, webbrowser, time, os, sys print "Snitz Location Changer by Jorge Pena" print "Base Code by Family Guy" def InstallOpener(): new_jar = cookielib.LWPCookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(new_jar)) urllib2.install_opener(opener) print "* Opener Installed" def CreateCookie(username, password, site): request = urllib2.Request(site + "/pop_profile.asp?mode=Edit", None) grab = urllib2.urlopen(request) grab.close() data = urllib.urlencode({"Name": username, "Password" : password}) request = urllib2.Request(site + "/pop_profile.asp?mode=goEdit", data) print "* Cookie Created" return request def Authenticate(request): grab = urllib2.urlopen(request) html = grab.read() grab.close() page = open("page.html", "w+") page.write(html) page.close() # Check if authentication worked checkpage = open("page.html", "r") checklines = checkpage.readlines() if "Invalid" in checklines[97]: print "Invalid Username or Password, aborting..." print "Removing \"page.html\"..." checkpage.close() os.remove("page.html") print "Exiting..." sys.exit() else: print "* Authenticated" def EditProfile(): page_two = open("page.html", "r") lines = page_two.readlines() page_two.close() #close the page os.remove("page.html") #remove the page new_add = ' ' % (new_location, new_location) lines[201] = new_add lines[97] = '