Advertisement
Guest User

outwar python pvp auto attacker

a guest
Jan 17th, 2017
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.01 KB | None | 0 0
  1. import urllib2
  2. import cookielib
  3. import thread
  4. import re
  5. import os
  6. import webbrowser
  7. import sys
  8. import time
  9. import datetime
  10. import socket
  11. import threading
  12. import urllib
  13. import threadingPool
  14. import getpass
  15. #--------------------SETTINGS-----------
  16. #note: I(YG) did not create this aa, I only curate it. I got it from GateCrasher and that's as far down the chain as my awareness goes.
  17. #another note: I'm not responsible for any spelling errors. I've been doing my best to correct all of those, but there are tons
  18. SERVER = ""
  19. USER = ""
  20. TOTALA = 0
  21. WON = 0
  22. TOTALG = 0
  23. TOTALS = 0
  24. Header = """
  25. #------------------------------------------------------------------------------#
  26. #### # # # # # # ' ### # #
  27. # # # # # # # # # # # # # #
  28. # ## # # ### # # ### ### ### ###
  29. # # # # # # # # # # # # # # #
  30. #### ### # # # # # ### # # # #
  31.  
  32. #------------------------------------------------------------------------------#
  33. """
  34. #print HEADER
  35. def header():
  36. os.system("cls")
  37. #print Header
  38. info = "SERVER: ["+SERVER+"] | ACCOUNT: ["+USER+"] \nATTACKS WON ["+str(WON)+"/"+str(TOTALA)+"] | STRIPPED ["+str(TOTALS)+"] | GAINED ["+str(TOTALG)+"] \n"
  39. print info
  40. #------------------Cookie-Jar----------
  41. socket.setdefaulttimeout(30.0)
  42.  
  43. cj = cookielib.CookieJar()
  44. opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  45. opener.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1 ID:20120614114901')]
  46.  
  47. #------------------anti-lag-opener---------
  48. def alo(url):
  49. lagsafe = 1
  50. while lagsafe == 1:
  51. try:
  52. site = opener.open(url)
  53. lagsafe = 0
  54. except IOError:
  55. pass
  56. except Exception:
  57. pass
  58. return site
  59.  
  60. def alo2(url, pData):
  61. lagsafe = 1
  62. while lagsafe == 1:
  63. try:
  64. site = opener.open(url, pData)
  65. lagsafe = 0
  66. except IOError:
  67. pass
  68. except Exception:
  69. pass
  70. return site
  71.  
  72. def url_opener(url, p_data=None):
  73. while True:
  74. try:
  75. if not p_data:
  76. site = opener.open(url)
  77. else:
  78. site = opener.open(url, p_data)
  79. break
  80. except IOError:
  81. a=1
  82. except Exception:
  83. a=1
  84. return site
  85.  
  86. def iB(src, start, end):
  87. try:
  88. return src.split(start)[1].split(end)[0]
  89. except IndexError:
  90. msg("Could not retrieve the inbetween value.")
  91. return
  92.  
  93. def msg(out):
  94. thetime = time.strftime("[%H:%M:%S]", time.localtime(time.time()))
  95. message = thetime + " " + out
  96. print message
  97. return message
  98.  
  99. def setServerID():
  100. global SERVER_ID
  101. if SERVER.lower() == "sigil":
  102. SERVER_ID = 1
  103. else:
  104. SERVER_ID = 2
  105.  
  106. def get_char_name(char_id):
  107. checkname = url_opener("http://"+SERVER+".outwar.com/profile.php?id="+str(char_id) + "&serverid="+str(SERVER_ID)).read()
  108. char_name = checkname.split('send_ow_message.php?name=')[1].split('">')[0]
  109. #char_name = char_name.split('">View Treasury Items</a></font><Br />')[0]
  110. return char_name
  111.  
  112. def configure():
  113. header()
  114. print 'Login with session ID?: \n'
  115. sess = raw_input("yes/no: ")
  116. header()
  117. global SERVER
  118. if sess.lower() == "yes":
  119. global RG_SESS_ID
  120. print 'Enter the session_id:\n'
  121. RG_SESS_ID = raw_input('Sess_ID: ')
  122. header()
  123. print 'Please select your server sigil or torax:\n'
  124. SERVER = raw_input('Server: ')
  125. header()
  126. setServerID()
  127. loginRGSessionID()
  128. else:
  129. global USERNAME, PASSWORD
  130. print 'Enter your username:\n'
  131. USERNAME = raw_input('Username: ')
  132. header()
  133. print 'Password will not show even when typing:\n'
  134. PASSWORD = getpass.getpass()
  135. header()
  136. print 'Please select your server sigil or torax:\n'
  137. SERVER = raw_input('Server: ')
  138. header()
  139. setServerID()
  140. login()
  141.  
  142. def loginRGSessionID():
  143. msg('Trying to log in\n')
  144. loginRGA = alo("http://"+SERVER+".outwar.com/accounts.php?ac_serverid="+str(SERVER_ID)+"&rg_sess_id="+RG_SESS_ID).read()
  145. header()
  146. msg('Logged in\n')
  147. msg('Loading Accounts please wait...\n')
  148. AccountSelector()
  149. #AccountSelector(SERVER, SERVER_ID)
  150.  
  151. def login():
  152. msg('Trying to log in\n')
  153. loginRGA = alo2("http://"+SERVER+".outwar.com/myaccount.php", "login_username="+USERNAME+"&login_password="+PASSWORD).read()
  154. header()
  155. msg('Logged in\n')
  156. msg('Loading Accounts please wait...\n')
  157. AccountSelector()
  158. #AccountSelector(SERVER, SERVER_ID)
  159.  
  160. #def AccountSelector(server, serverid):
  161. def AccountSelector():
  162. x = 1
  163. c = 0
  164. global acctName, acctID
  165. acctName = []
  166. acctID = []
  167. totalName = 0
  168. name = alo("http://" + SERVER + ".outwar.com/accounts.php?ac_serverid=" + str(SERVER_ID)).read()
  169. nameReader = name
  170. nameReader = nameReader.split("\n")
  171. while x == 1:
  172. nameCode = nameReader[c].strip()
  173. if nameCode.find('star.jpg') != -1:
  174. c = c + 3
  175. nameCode = nameReader[c].split('</b>')
  176. nameCode = nameCode[0].split('<b>')
  177. nameCode = nameCode[1]
  178. acctName.append(nameCode)
  179. totalName = totalName + 1
  180. if nameCode == "</body>" or nameCode.find('Trustee Access') != -1:
  181. x = 0
  182. else:
  183. c = c + 1
  184. x = 1
  185. c = 0
  186. while x == 1:
  187. nameCode = nameReader[c].strip()
  188. if nameCode.find('world.php?suid=') != -1:
  189. nameCode = nameReader[c].split('"><font color=')[0].split('href="')[1]
  190. acctID.append(nameCode)
  191. if nameCode == '</body>':
  192. x = 0
  193. else:
  194. c = c + 1
  195. c = 0
  196. c2 = 1
  197. print ''
  198. while totalName > c:
  199. temp = acctName[c]
  200. print str(c2) + ' - ' + temp
  201. c = c + 1
  202. c2 = c2 + 1
  203. x = 1
  204. while x == 1:
  205. print ''
  206. print 'Select Account to attack with'
  207. num = raw_input('Enter #: ')
  208. number = int(num)
  209. if number > totalName or number <= 0:
  210. print 'Invalid Selection'
  211. else:
  212. global NUM_CHARS
  213. NUM_CHARS = totalName
  214. x = 0
  215. global USER, attackerID
  216. attackerID = iB(acctID[number-1], "suid=", "&")
  217. USER = acctName[number-1]
  218. header()
  219. print 'Loading ' +USER
  220. changechar = url_opener("http://"+SERVER+".outwar.com/home.php?suid="+attackerID).read()
  221. msg('You selected ' +USER)
  222.  
  223. def castbrut():
  224. print 'Casting brut on ' + USER
  225. profile = url_opener("http://"+SERVER+".outwar.com/profile.php?="+attackerID).read()
  226. if "/images/skills/skill_40.gif" in profile:
  227. print USER +" Already has a brut cast"
  228. return
  229. backpack = url_opener("http://"+SERVER+".outwar.com/backpack.php?potion=1").read()
  230. if "images/potion1.jpg" in backpack:
  231. brut = backpack.split("images/potion1.jpg")
  232. brut = brut[1].split("itempopup(event,'")
  233. brut = brut[1].split("')")
  234. brut = brut[0]
  235. cast = url_opener("http://"+SERVER+".outwar.com/home.php?itemaction="+brut).read()
  236. while 'Level 1 Brutality Potion' not in cast:
  237. print "Error casting Brut, retrying on" + USER
  238. backpack = url_opener("http://"+SERVER+".outwar.com/backpack.php?potion=1").read()
  239. if "images/potion1.jpg" in backpack:
  240. brut = backpack.split("images/potion1.jpg")
  241. brut = brut[1].split("itempopup(event,'")
  242. brut = brut[1].split("')")
  243. brut = brut[0]
  244. cast = url_opener("http://"+SERVER+".outwar.com/home.php?itemaction="+brut).read()
  245. print "Casted Brut on " + USER
  246. else:
  247. print "Casted Brut on " + USER
  248. else:
  249. window.geometry("1x1+"+str(window.winfo_screenwidth()/2)+"+"+str(window.winfo_screenheight()/2))
  250. tkMessageBox.showinfo(title="ERROR", message="Out of bruts!" % USER)
  251. print "out of Bruts"
  252.  
  253. def actlistcrew():
  254. global actstohit
  255. actstohit = ''
  256. print "Enter the crew ids you would like to load\n"
  257. crewids = raw_input("crew id: ")
  258. header()
  259. print 'Please wait a few seconds to load the crew.\n'
  260. if ',' != crewids:
  261. crewids = crewids + ','
  262. crewids = crewids.split(',')
  263. for crew in crewids:
  264. if crew != '':
  265. changechar = url_opener("http://"+SERVER+".outwar.com/crew_profile.php?id="+crew).read()
  266. actids = changechar.split('<td style="padding-left:25px;" align="left">')
  267. count = 1
  268. for actid in actids:
  269. if count > 1:
  270. actid = actid.split('</td>')
  271. actlvl = actid[2].split('<td align="center">')
  272. actlvl = actlvl[1]
  273. actid = actid[1].split('profile.php?id=')
  274. actid = actid[1].split('">')
  275. actid = actid[0]
  276. if int(actlvl) >= 65:
  277. if actstohit == '':
  278. actstohit = actid
  279. else:
  280. actstohit = actstohit + ',' + actid
  281. count = count +1
  282. actstohit = actstohit.split(',')
  283. return actstohit
  284. msg('Accounts loaded\n')
  285.  
  286. def actlisthl():
  287. header()
  288. global actstohit
  289. actstohit = ''
  290. print 'Please wait a few seconds to load the hitlist.\n'
  291. page = url_opener("http://"+SERVER+".outwar.com/crew_hitlist.php").read()
  292. page = page.split("Crew Hit List")[1]
  293. atckids = page.split("attackWindow('")[1:]
  294. ids = ''
  295. for hlids in atckids:
  296. hlid = hlids.split("','")[1]
  297. ids = ids + ',' + hlid
  298. actstohit = ids[1:].split(',')
  299. msg('Accounts loaded\n')
  300. return actstohit
  301. time.sleep(5)
  302.  
  303. def attack(actid):
  304. attackaccount = get_char_name(actid)
  305. #msg('Attacking ' + attackaccount)
  306. global WON,TOTALS,TOTALG,TOTALA
  307. while True:
  308. profile = url_opener("http://"+SERVER+".outwar.com/profile.php?serverid=2&id="+actid).read()
  309. if "attackWindow" in profile:
  310. hash = profile.split("attackWindow('")
  311. hash = hash[1].split(')">')
  312. hash = hash[0].split("','")
  313. name = hash[0]
  314. hash = hash[3].replace("'",'')
  315. attack = url_opener("http://"+SERVER+".outwar.com/somethingelse.php?serverid=2&attackid="+actid+"&r=undefined", "message="+myMessage+"&hash="+hash+"&rage=500").read()
  316. #print attack
  317. if "You have won the battle" in attack:
  318. strip = 0
  319. gain = 0
  320. if 'stripped' in attack:
  321. stripped = attack.split('stripped')[1]
  322. strip = stripped.split('xp')[0].split("'>")[1]
  323. gain = stripped.split('xp')[1].split("'>")[1]
  324. WON = WON + 1
  325. TOTALA = 1 + TOTALA
  326. TOTALS = TOTALS + int(strip)
  327. TOTALG = TOTALG + int(gain)
  328. msg('Attack won on ' + attackaccount)
  329. msg('You stripped ' +str(strip) + 'xp and gained '+str(gain)+'xp')
  330. time.sleep(1)
  331. header()
  332. break
  333. elif "is your ally" in attack.lower():
  334. msg('' + attackaccount + ' is your ally')
  335. header()
  336. break
  337. elif "This player is a member of an Allied crew" in attack:
  338. msg('' +attackaccount + ' is a member of an Allied crew')
  339. header()
  340. break
  341. elif "You can not attack this player at this time as they are" in attack:
  342. msg('' + attackaccount + ' is a puss and is under the effects of PVP Immunity.')
  343. header()
  344. break
  345. elif "You have been defeated!" in attack:
  346. msg('You have been defeated by ' + attackaccount)
  347. TOTALA = TOTALA + 1
  348. header()
  349. break
  350. else:
  351. msg('Error Attacking... Retrying')
  352. header()
  353. else:
  354. msg(USER + ' you are trying to attack '+attackaccount +' too soon')
  355. header()
  356. break
  357.  
  358. def attackPool(actstohit):
  359. pool = threadingPool.ThreadPool(5)
  360. for act in actstohit:
  361. pool.add_task(attack, act)
  362. attack(act)
  363. pool.wait_completion()
  364. ##if SERVER.lower() == "sigil":
  365. ## SERVER_ID = 1
  366. ##else:
  367. ## SERVER_ID = 2
  368. #MAIN
  369. #print get_char_name('225857')
  370. print Header
  371. header()
  372. configure()
  373. ans=True
  374. while ans:
  375. header()
  376. print("""
  377. 1. Change RGA: 5. Cast brute:
  378. 2. Change Account: 6. Attack:
  379. 3. Load a crew: 7. Exit:
  380. 4. Load Hitlist:
  381. """)
  382. ans=raw_input("What would you like to do? ")
  383. if ans=="1":
  384. configure()
  385. elif ans=="2":
  386. header()
  387. AccountSelector()
  388. elif ans=="3":
  389. header()
  390. actstohit = actlistcrew()
  391. elif ans=="4":
  392. header()
  393. actstohit = actlisthl()
  394. elif ans=="6":
  395. header()
  396. toMessage = raw_input("Would you like to send messages with your attacks? yes/no ")
  397. if 'y' in toMessage.lower():
  398. myMessage = raw_input("What would you like to message them? ")
  399. elif 'n' in toMessage.lower():
  400. myMessage = ''
  401. attackPool(actstohit)
  402. elif ans=="5":
  403. header()
  404. castbrut()
  405. elif ans=="7":
  406. print("\n Goodbye")
  407. ans = None
  408. else:
  409. print("\n Not Valid Choice Try again")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement