#!/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] = '

' num = 0 print "* Profile edited" return lines def SaveProfile(lines): num = 0 test_file = open("profile.html", "w") line_c = len(lines) while num 1: if sys.argv[1] == "--help" or sys.argv[1] == "-h": print "USAGE: snitzloc.py [URL] [USER] [PASS] [LOC]" print " [URL] - The URL to the forum without a trailing backslash. For example http://www.jinx.com/forum" print " [USER] - Your UserName in the forum." print " [PASS] - Your PassWord in the forum." print " [LOC] - Your desired location." sys.exit() site = sys.argv[1] username = sys.argv[2] password = sys.argv[3] new_location = sys.argv[4] else: site = raw_input( "Path to Forum (Ex. http://www.jinx.com/forum): ") username = raw_input("Username: ") password = raw_input("Password: ") new_location = raw_input("Desired location: ") InstallOpener() Authenticate(CreateCookie(username, password, site)) SaveProfile(EditProfile()) print "[NOTE] Open up \"profile.html\" and click \"submit\" to finish." PasteBin

pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

PasteBin - Home - Help - Archive
Syntax Highlighting:
To highlight particular lines, prefix each line with @@
Pressing TAB inserts 3 spaces