Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib2
- import cookielib
- import thread
- import re
- import os
- import sys
- from time import localtime, sleep, strftime, time
- import socket
- import threading
- import datetime
- #------------------Cookie-Jar----------
- socket.setdefaulttimeout(90.0)
- cj = cookielib.CookieJar()
- user_agent = ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) ' +
- 'Gecko/20100101 Firefox/13.0.1 ID:20120614114901')
- opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
- opener.addheaders = [('User-agent', user_agent)]
- #--------------------SETTINGS-----------
- suid = 0 # do not change
- ## change these
- logins = [["username", "password"], ["username1","password2"]]
- server = "sigil"
- secword = ""#dont edit
- numruns = 0 #can specify a number of runs. if you select 0, it will run forever
- enemyIDlist = ["939937"] #can specify one or multiple id's
- myMessage = "http://i.imgur.com/J3tjrIS.png" #can update this to whatever
- logging = True
- if server.lower() == 'sigil':
- server_id = '1'
- elif server.lower() == 'torax':
- server_id = '2'
- else:
- server_id = '1'
- #--------------------Go to site-----------
- def url_opener(url, pData=None):
- lagsafe = 1
- while lagsafe == 1:
- try:
- if not pData:
- site = opener.open(url)
- #sleep(0.3)
- lagsafe = 0
- else:
- site = opener.open(url, pData)
- #sleep(0.3)
- lagsafe = 0
- break
- except IOError, e:
- print e
- except Exception:
- print 'Unknown error, retrying...'
- except socket.timeout, e:
- print "Timeout error, retrying"
- return site
- #--------------------Create Character-----------
- def sub_string(source, start, end):
- try:
- return source.split(start)[1].split(end)[0]
- except IndexError:
- print('Could not retrieve the inbetween value')
- return False
- #------------Get Char Name------------
- def char_name(source):
- try:
- char_name = source.split('" selected>')[1].split('</option>')[0]
- except IndexError:
- char_name = "Unknown"
- print("Could not retrieve the inbetween value")
- finally:
- return char_name
- #--------------------LOGIN-----------
- def login(username, password):
- loginrpg = url_opener("http://"+server+".outwar.com/myaccount.php", "login_username=%s&login_password=%s" % (username,password)).read()
- #loginrpg = url_opener("http://"+server+".outwar.com/accounts.php?ac_serverid="+server_id+"&rg_sess_id="+rgSessId).read()
- page = url_opener("http://%s.outwar.com/myaccount.php?ac_serverid=%s" % (server, server_id))
- loginData = loginrpg.split('value="0">--Change Server')[0].split('option value=')[1:]
- #print loginData
- chars = {}
- for char in loginData:
- name = char.split('>')[1].split("</")[0]
- ID = char.split('"')[1]
- chars[name] = ID
- print name
- print("Logged in, %s chars found" % str(len(chars)))
- return chars
- def castBrute(server, myID):
- pots = url_opener("http://"+server+".outwar.com/backpack.php?potion=1&suid="+myID+"&serverid="+server_id).read()
- if "potion1.jpg" in pots:
- mybrut = pots.split("potion1.jpg")[1].split("event,")[1].split("'")[1]
- cast = url_opener("http://"+server+".outwar.com/home.php?itemaction="+mybrut+"&suid="+myID+"&serverid="+server_id).read()
- def changeChar(server, server_id, charName, charID):
- changechar = url_opener("http://"+server+".outwar.com/world.php?suid=%s&serverid=%s" % (charID,server_id))
- print("Changed chars to %s" % charName)
- def attack(server, charID):
- #castBrute(server, charID)
- for enemy in enemyIDlist:
- profile = url_opener("http://"+server+".outwar.com/profile.php?id=" + enemy + "&suid=" + charID + "&serverid=%s" % server_id).read()
- if "attackWindow" in profile:
- hash = profile.split("attackWindow('")
- hash = hash[1].split(')">')
- hash = hash[0].split("','")
- name = hash[0]
- hash = hash[3].replace("'",'')
- attack = url_opener("http://"+server+".outwar.com/somethingelse.php?attackid=" + enemy + "&r=undefined&suid=" + charID + "&serverid=%s" % server_id, "message="+myMessage+"&hash="+hash+"&rage=500").read()
- #print attack
- class ThreadClass(threading.Thread):
- #__init__ is always passed "self" first, then pass in any variables the threads will need to access
- #In this case: server, serverID, charName, and charID are the only variables used by threads
- #These variables will have to be passed into ThreadClass when you first call it
- def __init__(self, server, serverID, charName, charID, secword):
- #After you pass into __init__, assign each of the variables into self
- self.server = server
- self.serverID = serverID
- self.charName = charName
- self.charID = charID
- self.secword = secword
- threading.Thread.__init__(self)
- def run(self):
- #In this definition, put all the functions the thread needs to accomplish
- #But use the self. versions of the variables because those are specific to each threads
- changeChar(self.server, self.serverID, self.charName, self.charID)
- attack(self.server, self.charID)
- #--------------------Main Function-----------
- def main(secword):
- for lg in logins:
- print("Warming up...")
- print lg
- START_TIME = datetime.datetime.now()
- chars = login(lg[0], lg[1])
- threads = []
- for char in chars:
- thread = ThreadClass(server, server_id, char, chars[char], secword)
- threads += [thread]
- thread.start()
- for t in threads:
- t.join()
- ## charChange = changeChar(server, server_id, char, chars[char])
- ## clearBP(server)
- ## equipTrainingItems(server)
- END_TIME = datetime.datetime.now()
- total = END_TIME - START_TIME
- sec = total.seconds
- d = str(datetime.timedelta(seconds=sec))
- print('TOTAL RUN TIME: %s' % d)
- ## print "Exiting in 15 seconds.."
- ## sleep(15)
- if numruns > 0:
- curruns = 0
- while curruns < numruns:
- main(secword)
- curruns += 1
- print('Sleeping for 61 minutes')
- sleep(3660)
- else:
- while True:
- main(secword)
- print('Sleeping for 61 minutes')
- sleep(3660)
- s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement