Advertisement
Guest User

Untitled

a guest
Oct 8th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.10 KB | None | 0 0
  1. import urllib
  2. import urllib2
  3. import cookielib
  4. import threading
  5. import time
  6. from multiprocessing.dummy import Pool as ThreadPool
  7. #import webbrowser
  8. cj = cookielib.CookieJar()
  9.  
  10. opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  11. opener.addheaders = [('User-agent', 'Mozilla/19.0 (Macintosh; Intel Mac OS X 10_7_1) Gecko/20100101 Firefox/13.0.1 ID:20120614114901')]
  12.  
  13. logins = []
  14. server = "sigil"
  15. crews = ['Charming Heights', "Immortal Soldiers", "G e n o c i d e"]
  16. prefix = "http://"+server+".outwar.com/"
  17. min_Lev = 65
  18. trustees = open("trustees.txt", "r+")
  19. vList = trustees.read()
  20. users = vList.split("<login_u>")[1].split(",")
  21. passes = vList.split("<login_p>")[1].split(",")
  22. for m in users:
  23. logins.append([m, passes[users.index(m)]])
  24. tList = vList.split("<trustees>")[1]
  25. trustees.close()
  26.  
  27.  
  28. perms = [['potion', '1'], ['lingbuff', '2'], ['teleport', '3']]
  29.  
  30.  
  31. if server.lower() == "sigil":
  32. serverid = "1"
  33. elif server.lower() == "torax":
  34. serverid = "2"
  35. else:
  36. serverid = "1"
  37.  
  38.  
  39. def alo(url):
  40. lagsafe = 1
  41. while lagsafe == 1:
  42. try:
  43. site = opener.open(url)
  44. lagsafe = 0
  45. except IOError:
  46. print "URLError: Site not loading. Retrying..."
  47. return site
  48. def alo2(url, pData):
  49. lagsafe = 1
  50. while lagsafe == 1:
  51. try:
  52. site = opener.open(url, pData)
  53. lagsafe = 0
  54. except IOError:
  55. print "URLError: Site not loading. Retrying..."
  56. return site
  57.  
  58. def login_rga(user, password):
  59. login = alo2(prefix+'index.php', 'login_username='+user+'&login_password='+password).read()
  60. return login
  61.  
  62.  
  63. def getSUIDs(user,passs):
  64. login_rga(user, passs)
  65. suids = alo(prefix+'myaccount.php?ac_serverid=%s' % serverid).read()
  66. newSuids = suids.split('Trustee Access')[0].split('characterTable')[3].split(server)
  67. suids2 = []
  68. for v in newSuids:
  69. if 'suid' in v and 'PLAY!' not in v:
  70. if int(v.split('75px;">')[1].split('</td')[0]) > min_Lev:
  71. suids2.append([v.split('suid=')[1].split('&ser')[0], v.split('">')[1].split('</a')[0], v.split('75px;">')[1].split('</td')[0]])
  72. return suids2
  73.  
  74. def waiting(incdec="inc", num='.'):
  75. if thisval == "go":
  76. basic = '.'
  77. print num
  78. if incdec == "inc":
  79. while len(num) < 10:
  80. time.sleep(1)
  81. waiting("inc", num + basic)
  82. time.sleep(1)
  83. waiting("dec", num+basic)
  84. else:
  85. while len(num) > 1:
  86. num = num.replace('.', '', 1)
  87. time.sleep(1)
  88. waiting("dec", num)
  89. time.sleep(1)
  90. waiting("inc", num+basic)
  91. else:
  92. return
  93.  
  94. def edit_trustees(p):
  95. tPage = alo(prefix+'ajax/trustees.php?get=true&t_serv='+serverid+'&t_char='+p).read()
  96. return tPage
  97. def rem_trustees(x):
  98. edit_trustees(x[0])
  99. rPage = alo(prefix+'ajax/trustees.php?t_char='+x[0]+"&t_serv="+serverid+'&remove-all=1').read()
  100. if 'success' in rPage.lower():
  101. return "Successfully removed trustees for " +x[1]
  102. else:
  103. return "Failed to remove trustees for " + x[1]
  104. def make_tList(x):
  105. nList = x.replace(" ", "").split(',')
  106. nList = ",%20".join(nList)
  107. return nList
  108.  
  109. def get_permIDs(x, perm):
  110. aPage = alo(prefix + 'ajax/trustees.php?get=true&t_char='+x[0]+'&t_serv='+serverid).read()
  111. aPage = aPage.split('},')
  112. newP = []
  113. for p in aPage:
  114. p = p.split('accountid":"')[1].split('","')[0]
  115. newP.append('['+p+']=1')
  116. permid = ('&'+perm[0]).join(newP)
  117. url = 'ajax/trustees.php?update=1&type='+perm[1]+'&t_serv='+serverid+'&t_char='+x[0]+'&'+perm[0]+permid
  118. return url
  119. def getCrew(me):
  120. page = alo(prefix+"profile.php?id="+me+"&suid=%s&serverid=%s" % (me, serverid)).read()
  121. if 'crew_profile' in page:
  122. page = page.split('crew_profile.php')[2].split('">')[1].split('</a>')[0]
  123. return page
  124. def add_trustees(x):
  125. if int(x[2]) > min_Lev:
  126. crew = getCrew(x[0])
  127. if crew:
  128. for m in crews:
  129. if m in crew:
  130. edit_trustees(x[0])
  131. rem_trustees(x)
  132. aPage = alo(prefix+'ajax/trustees.php?add='+tList+'&t_char='+x[0]+"&t_serv="+serverid).read()
  133. if 'success' in aPage.lower():
  134. for z in perms:
  135. pPage = alo(prefix+get_permIDs(x, z)).read()
  136. #return "Successfully added "+ z[0] + " perms for " +x[1]
  137. thisBoi.append("Successfully updated trustees for " +x[1])
  138.  
  139. else:
  140. thisBoi.append("Failed to update trustees for " + x[1])
  141. thisBoi = []
  142. mz = threading.Thread(target=waiting)
  143. thisval = "go"
  144. mz.start()
  145. threads = []
  146. for i in logins:
  147. if i[1] != "__":
  148. print i
  149. pool = ThreadPool(8)
  150. pool.map(lambda x: add_trustees(x), getSUIDs(i[0],i[1]))
  151.  
  152.  
  153. for g in threads:
  154. g.join()
  155. thisval = "stop"
  156. print "Done.\n\n -------------------"
  157.  
  158. for m in thisBoi:
  159. print m + '\n'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement