Advertisement
Guest User

xafloc

a guest
Feb 8th, 2017
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.25 KB | None | 0 0
  1. import urllib2
  2. import cookielib
  3. import thread
  4. import re
  5. import os
  6. import sys
  7. from time import localtime, sleep, strftime, time
  8. import socket
  9. import threading
  10. import datetime
  11.  
  12.  
  13. #------------------Cookie-Jar----------
  14. socket.setdefaulttimeout(90.0)
  15.  
  16. cj = cookielib.CookieJar()
  17. user_agent = ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) ' +
  18. 'Gecko/20100101 Firefox/13.0.1 ID:20120614114901')
  19. opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  20. opener.addheaders = [('User-agent', user_agent)]
  21.  
  22. #--------------------SETTINGS-----------
  23. suid = 0 # do not change
  24.  
  25.  
  26. ## change these
  27. logins = [["username", "password"], ["username","password"]] #follow the template
  28. server = "sigil"
  29. secword = ""#dont edit
  30.  
  31. enemyIDlist = ["idofchartohit", "idofchartohit"]#id's of char(s) you want to attack
  32. myMessage = "http://i.imgur.com/J3tjrIS.png" #message to be sent with attacks
  33.  
  34. logging = True
  35.  
  36. if server.lower() == 'sigil':
  37. server_id = '1'
  38. elif server.lower() == 'torax':
  39. server_id = '2'
  40. else:
  41. server_id = '1'
  42.  
  43. #--------------------Go to site-----------
  44. def url_opener(url, pData=None):
  45. lagsafe = 1
  46. while lagsafe == 1:
  47. try:
  48. if not pData:
  49. site = opener.open(url)
  50. #sleep(0.3)
  51. lagsafe = 0
  52. else:
  53. site = opener.open(url, pData)
  54. #sleep(0.3)
  55. lagsafe = 0
  56. break
  57. except IOError, e:
  58. print e
  59. except Exception:
  60. print 'Unknown error, retrying...'
  61. except socket.timeout, e:
  62. print "Timeout error, retrying"
  63. return site
  64.  
  65. #--------------------Create Character-----------
  66.  
  67. def sub_string(source, start, end):
  68. try:
  69. return source.split(start)[1].split(end)[0]
  70. except IndexError:
  71. print('Could not retrieve the inbetween value')
  72. return False
  73.  
  74. #------------Get Char Name------------
  75. def char_name(source):
  76. try:
  77. char_name = source.split('" selected>')[1].split('</option>')[0]
  78. except IndexError:
  79. char_name = "Unknown"
  80. print("Could not retrieve the inbetween value")
  81. finally:
  82. return char_name
  83.  
  84.  
  85. #--------------------LOGIN-----------
  86.  
  87. def login(username, password):
  88. loginrpg = url_opener("http://"+server+".outwar.com/myaccount.php", "login_username=%s&login_password=%s" % (username,password)).read()
  89. #loginrpg = url_opener("http://"+server+".outwar.com/accounts.php?ac_serverid="+server_id+"&rg_sess_id="+rgSessId).read()
  90. loginData = loginrpg.split('value="0">--Change Server')[0].split('option value=')[1:]
  91. #print loginData
  92. chars = {}
  93. for char in loginData:
  94. name = char.split('>')[1].split("</")[0]
  95. ID = char.split('"')[1]
  96. chars[name] = ID
  97. print name
  98.  
  99. print("Logged in, %s chars found" % str(len(chars)))
  100.  
  101. return chars
  102. def castBrute(server, myID):
  103. pots = url_opener("http://"+server+".outwar.com/backpack.php?potion=1&suid="+myID+"&serverid="+server_id).read()
  104. if "potion1.jpg" in pots:
  105. mybrut = pots.split("potion1.jpg")[1].split("event,")[1].split("'")[1]
  106. cast = url_opener("http://"+server+".outwar.com/home.php?itemaction="+mybrut+"&suid="+myID+"&serverid="+server_id).read()
  107. def changeChar(server, server_id, charName, charID):
  108.  
  109. changechar = url_opener("http://"+server+".outwar.com/world.php?suid=%s&serverid=%s" % (charID,server_id))
  110.  
  111. print("Changed chars to %s" % charName)
  112.  
  113.  
  114.  
  115. def attack(server, charID):
  116. castBrute(server, charID)
  117. for enemy in enemyIDlist:
  118. profile = url_opener("http://"+server+".outwar.com/profile.php?id=" + enemy + "&suid=" + charID).read()
  119. if "attackWindow" in profile:
  120. hash = profile.split("attackWindow('")
  121. hash = hash[1].split(')">')
  122. hash = hash[0].split("','")
  123. name = hash[0]
  124. hash = hash[3].replace("'",'')
  125. attack = url_opener("http://"+server+".outwar.com/somethingelse.php?attackid=" + enemy + "&r=undefined&suid=" + charID, "message="+myMessage+"&hash="+hash+"&rage=500").read()
  126. #print attack
  127.  
  128.  
  129.  
  130. class ThreadClass(threading.Thread):
  131.  
  132. #__init__ is always passed "self" first, then pass in any variables the threads will need to access
  133. #In this case: server, serverID, charName, and charID are the only variables used by threads
  134. #These variables will have to be passed into ThreadClass when you first call it
  135. def __init__(self, server, serverID, charName, charID, secword):
  136.  
  137. #After you pass into __init__, assign each of the variables into self
  138. self.server = server
  139. self.serverID = serverID
  140. self.charName = charName
  141. self.charID = charID
  142. self.secword = secword
  143.  
  144.  
  145.  
  146. threading.Thread.__init__(self)
  147.  
  148. def run(self):
  149. #In this definition, put all the functions the thread needs to accomplish
  150. #But use the self. versions of the variables because those are specific to each threads
  151.  
  152. changeChar(self.server, self.serverID, self.charName, self.charID)
  153. attack(self.server, self.charID)
  154.  
  155.  
  156.  
  157.  
  158.  
  159. #--------------------Main Function-----------
  160. def main(secword):
  161. for lg in logins:
  162. print("Warming up...")
  163. print lg
  164.  
  165. START_TIME = datetime.datetime.now()
  166. chars = login(lg[0], lg[1])
  167.  
  168. threads = []
  169.  
  170. for char in chars:
  171.  
  172. thread = ThreadClass(server, server_id, char, chars[char], secword)
  173. threads += [thread]
  174. thread.start()
  175.  
  176. for t in threads:
  177. t.join()
  178.  
  179. ## charChange = changeChar(server, server_id, char, chars[char])
  180. ## clearBP(server)
  181. ## equipTrainingItems(server)
  182.  
  183. END_TIME = datetime.datetime.now()
  184. total = END_TIME - START_TIME
  185.  
  186. sec = total.seconds
  187. d = str(datetime.timedelta(seconds=sec))
  188.  
  189. print('TOTAL RUN TIME: %s' % d)
  190. ## print "Exiting in 15 seconds.."
  191. ## sleep(15)
  192.  
  193. while True:
  194. main(secword)
  195. print('Sleeping for 61 minutes')
  196. sleep(3660)
  197. s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement