Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib
- import urllib2
- import cookielib
- import threading
- import time
- from multiprocessing.dummy import Pool as ThreadPool
- #import webbrowser
- cj = cookielib.CookieJar()
- opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
- opener.addheaders = [('User-agent', 'Mozilla/19.0 (Macintosh; Intel Mac OS X 10_7_1) Gecko/20100101 Firefox/13.0.1 ID:20120614114901')]
- logins = []
- server = "sigil"
- crews = ['Charming Heights', "Immortal Soldiers", "G e n o c i d e"]
- prefix = "http://"+server+".outwar.com/"
- min_Lev = 65
- trustees = open("trustees.txt", "r+")
- vList = trustees.read()
- users = vList.split("<login_u>")[1].split(",")
- passes = vList.split("<login_p>")[1].split(",")
- for m in users:
- logins.append([m, passes[users.index(m)]])
- tList = vList.split("<trustees>")[1]
- trustees.close()
- perms = [['potion', '1'], ['lingbuff', '2'], ['teleport', '3']]
- if server.lower() == "sigil":
- serverid = "1"
- elif server.lower() == "torax":
- serverid = "2"
- else:
- serverid = "1"
- def alo(url):
- lagsafe = 1
- while lagsafe == 1:
- try:
- site = opener.open(url)
- lagsafe = 0
- except IOError:
- print "URLError: Site not loading. Retrying..."
- return site
- def alo2(url, pData):
- lagsafe = 1
- while lagsafe == 1:
- try:
- site = opener.open(url, pData)
- lagsafe = 0
- except IOError:
- print "URLError: Site not loading. Retrying..."
- return site
- def login_rga(user, password):
- login = alo2(prefix+'index.php', 'login_username='+user+'&login_password='+password).read()
- return login
- def getSUIDs(user,passs):
- login_rga(user, passs)
- suids = alo(prefix+'myaccount.php?ac_serverid=%s' % serverid).read()
- newSuids = suids.split('Trustee Access')[0].split('characterTable')[3].split(server)
- suids2 = []
- for v in newSuids:
- if 'suid' in v and 'PLAY!' not in v:
- if int(v.split('75px;">')[1].split('</td')[0]) > min_Lev:
- suids2.append([v.split('suid=')[1].split('&ser')[0], v.split('">')[1].split('</a')[0], v.split('75px;">')[1].split('</td')[0]])
- return suids2
- def waiting(incdec="inc", num='.'):
- if thisval == "go":
- basic = '.'
- print num
- if incdec == "inc":
- while len(num) < 10:
- time.sleep(1)
- waiting("inc", num + basic)
- time.sleep(1)
- waiting("dec", num+basic)
- else:
- while len(num) > 1:
- num = num.replace('.', '', 1)
- time.sleep(1)
- waiting("dec", num)
- time.sleep(1)
- waiting("inc", num+basic)
- else:
- return
- def edit_trustees(p):
- tPage = alo(prefix+'ajax/trustees.php?get=true&t_serv='+serverid+'&t_char='+p).read()
- return tPage
- def rem_trustees(x):
- edit_trustees(x[0])
- rPage = alo(prefix+'ajax/trustees.php?t_char='+x[0]+"&t_serv="+serverid+'&remove-all=1').read()
- if 'success' in rPage.lower():
- return "Successfully removed trustees for " +x[1]
- else:
- return "Failed to remove trustees for " + x[1]
- def make_tList(x):
- nList = x.replace(" ", "").split(',')
- nList = ",%20".join(nList)
- return nList
- def get_permIDs(x, perm):
- aPage = alo(prefix + 'ajax/trustees.php?get=true&t_char='+x[0]+'&t_serv='+serverid).read()
- aPage = aPage.split('},')
- newP = []
- for p in aPage:
- p = p.split('accountid":"')[1].split('","')[0]
- newP.append('['+p+']=1')
- permid = ('&'+perm[0]).join(newP)
- url = 'ajax/trustees.php?update=1&type='+perm[1]+'&t_serv='+serverid+'&t_char='+x[0]+'&'+perm[0]+permid
- return url
- def getCrew(me):
- page = alo(prefix+"profile.php?id="+me+"&suid=%s&serverid=%s" % (me, serverid)).read()
- if 'crew_profile' in page:
- page = page.split('crew_profile.php')[2].split('">')[1].split('</a>')[0]
- return page
- def add_trustees(x):
- if int(x[2]) > min_Lev:
- crew = getCrew(x[0])
- if crew:
- for m in crews:
- if m in crew:
- edit_trustees(x[0])
- rem_trustees(x)
- aPage = alo(prefix+'ajax/trustees.php?add='+tList+'&t_char='+x[0]+"&t_serv="+serverid).read()
- if 'success' in aPage.lower():
- for z in perms:
- pPage = alo(prefix+get_permIDs(x, z)).read()
- #return "Successfully added "+ z[0] + " perms for " +x[1]
- thisBoi.append("Successfully updated trustees for " +x[1])
- else:
- thisBoi.append("Failed to update trustees for " + x[1])
- thisBoi = []
- mz = threading.Thread(target=waiting)
- thisval = "go"
- mz.start()
- threads = []
- for i in logins:
- if i[1] != "__":
- print i
- pool = ThreadPool(8)
- pool.map(lambda x: add_trustees(x), getSUIDs(i[0],i[1]))
- for g in threads:
- g.join()
- thisval = "stop"
- print "Done.\n\n -------------------"
- for m in thisBoi:
- print m + '\n'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement