Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import bs4
- import requests
- import re
- import sys
- '''
- Notice:
- If you don't trust this script, don't run it.
- You have the source code, so judge how trust worthy it is.
- If anything bad happens after running this script, I am not liable, running
- this script is cheating, do so at your own risk.
- Requirements:
- Python 3 - https://www.python.org/downloads/
- (I recommend installing pip and adding the PATH variable after
- installation)
- (If you already have Python 2 installed then it's up to you to install
- the required packages to the correct version, good luck)
- BeautifulSoup4 - pip install beautifulsoup4
- https://www.crummy.com/software/BeautifulSoup/bs4/doc/
- Requests - pip install requests
- http://docs.python-requests.org/en/master/user/install/
- lxml - pip install lxml
- (Can be a bitch to install on Windows, read the guide on their website)
- http://lxml.de/installation.html
- Usage:
- (After installing Python3, BeautifulSoup4, Requests, and lxml)
- - navigate to directory containing this file in the command prompt/shell/
- powershell/terminal/whatever your OS uses
- e.g. cd /home/rev/scripts/
- - run:
- python autoIG.py
- - profit
- - to only do crimes:
- python autoIG.py -c
- - to only do gta:
- python autoIG.py -g
- - to only do jail busting:
- python autoIG.py -j
- This script is a bit shit, sometimes it says you've failed to steal a car when
- you've succeeded, it was written very quickly, chill.
- This script was written as a proof of concept more than anything. Goodgy got
- banned for scripting, and people seemed to think scripting was just running and
- autoclicker. I wanted to see how easy botting Infamous Gangsters was, as it
- turned out, very easy. This script started being written on 09/10/2016.
- The game has died, and Rev has done nothing to help the game for years.
- Rev, if you're reading this, you let your game die, I imagine it was a good
- source of profit, and could have made you a lot more money if you'd developed
- it.
- You had a large community of people who have spent millions of hours playing a
- game you made, people who cared about the game and wanted it to do well.
- Many players have put forward the idea of letting the playerbase help develop
- features in the game, because we were tired of the game being stagnant.
- If you're making less money it's because of your lack of effort towards the
- game, and because taking away legitimate players' money on a "guilty until
- proven innocent" basis is pathetic.
- You've brought this upon yourself.
- '''
- # 1 - bust top player with timer under 100s
- # 2 - bust top player
- BUST_TYPE = 1
- # headers so this doesn't look like a bot...
- HEADERS = { "User-agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36" }
- # game urls
- URL = "https://infamousgangsters.com/"
- LOGIN_URL = "https://infamousgangsters.com/checkuser.php"
- SUCCESS_URL = "https://infamousgangsters.com/site.php?page=viewigtopic&id=433&forum=1"
- CRIMES_URL = "https://infamousgangsters.com/site.php?page=crimes"
- GTA_URL = "https://infamousgangsters.com/site.php?page=gta"
- JAIL_URL = "https://infamousgangsters.com/site.php?page=jail"
- # data necessary for logging in
- USERNAME_FIELD = "username"
- PASSWORD_FIELD = "password"
- TIMESTAMP_FIELD = "login_timestamp"
- TIMESTAMP2_FIELD = "login_timestamp2"
- EXTRA_FIELD = "extra"
- SUBLOGIN_FIELD = "sublogin"
- EXTRA_VALUE = "1566666"
- SUBLOGIN_VALUE = "+Login+"
- # time to wait after doing each activity
- # jail time can be changed as you please
- # gta/crimes can be increased if you want
- GTA_WAIT = 300
- JAIL_WAIT = 10
- CRIME_WAIT = 10
- # each activity runs for 1 hour (3600 seconds)
- # change to suit your preferences
- COUNTER_TIME_LIMIT = 3600
- countertime = 0
- # running totals for each activity done
- crimescounter = 0
- gtacounter = 0
- bustcounter = 0
- injailcounter = 0
- ACTIVITIES = ["crimes", "gta", "jail"]
- # main method, logs in then runs loop
- def run():
- soup = gotoindex(URL)
- biscuits = login(soup)
- soup = get(SUCCESS_URL, biscuits)
- args = sys.argv
- if (len(args) > 1):
- if args[1] == "-c":
- # run only crimes
- runloop(biscuits, 0)
- elif args[1] == "-g":
- # run only gta
- runloop(biscuits, 1)
- elif args[1] == "-j":
- # run only jail busts
- runloop(biscuits, 2)
- else:
- # run standard loop
- runloop(biscuits, None)
- else:
- runloop(biscuits, None)
- # main loop, runs each activity, keeps track of time
- def runloop(biscuits, constactivity):
- startactivity = 0
- activityincrementer = 1
- if (constactivity != None):
- startactivity = constactivity
- activityincrementer = 0
- activityint = startactivity
- while(1):
- global countertime
- countertime = int(time.time())
- print("Activity for " + str(COUNTER_TIME_LIMIT) + "s: " + ACTIVITIES[activityint])
- while(int((time.time()) - countertime) < COUNTER_TIME_LIMIT):
- if (activityint == 0):
- loopcrimes(biscuits, 1)
- elif (activityint == 1):
- loopgta(biscuits, 1)
- elif (activityint == 2):
- loopjail(biscuits, 1)
- activityint = (activityint + activityincrementer) % len(ACTIVITIES)
- # do all available crimes (apart from minigames)
- def docrimes(biscuits):
- global injailcounter
- if (injailcounter > 0):
- print("")
- injailcounter = 0
- soup = get(CRIMES_URL, biscuits)
- checkboxes = soup.find_all("input", {"type" : "checkbox" })
- visiblecheckboxes = [checkbox for checkbox in checkboxes if checkbox["value"] != "aaaa"]
- statuses = soup.find_all("font", {"color" : "red" })
- payload = {}
- for i in range(len(visiblecheckboxes)):
- if (i != 0 and i != 5):
- if ("available" in statuses[i].text):
- cb = visiblecheckboxes[i]
- payload[cb["name"]] = cb["value"]
- soup = post(CRIMES_URL, payload, biscuits)
- global crimescounter
- crimescounter += 1
- print("Crimes committed (" + str(crimescounter) + ") [" + timestamp() + "]")
- return soup
- # do gta
- def dogta(biscuits):
- global injailcounter
- if (injailcounter > 0):
- print("")
- injailcounter = 0
- soup = get(GTA_URL, biscuits)
- stealstring = "Steal a car!"
- code = soup.find("input", {"value" : stealstring})["name"]
- payload = { "pagenumber" : 0,
- code : stealstring }
- soup = post(GTA_URL, payload, biscuits)
- html = soup.prettify()
- result = re.search("You stole.+\d\d%\sdamage", html)
- if (result != None):
- car = result.group(0)
- global gtacounter
- gtacounter += 1
- print(car + " (" + str(gtacounter) + ") [" + timestamp() + "]")
- else:
- print("Failed to steal a car [" + timestamp() + "]")
- return soup
- # bust someone out of jail
- def bust(biscuits):
- global injailcounter
- if (injailcounter > 0):
- print("")
- injailcounter = 0
- soup = get(JAIL_URL, biscuits)
- bustid = getbustid(soup)
- if (bustid == ""):
- return
- payload = { "bustid" : bustid }
- soup = post(JAIL_URL, payload, biscuits)
- html = soup.prettify()
- relevanthtml = html[0:html.find("id=\"bustform")]
- result1 = re.search("You successfully busted ([\w\d]+) from jail!", relevanthtml)
- result2 = re.search("You received[\s<b>\n]*\$([\d,]+)[\s</b>\n]*for the bust!", relevanthtml)
- if (result1 != None):
- name = result1.groups(0)[0]
- if (result2 != None):
- money = result2.groups(0)[0]
- else:
- money = "0"
- global bustcounter
- bustcounter += 1
- print("Successfully busted " + name + " for $" + money + " (" + str(bustcounter) + ") [" + timestamp() + "]")
- else:
- print("Failed to bust [" + timestamp() + "]")
- # get id from configured option
- def getbustid(soup):
- form = soup.find("form", {"id":"bustform"})
- rows = form.find_all("tr")[2:]
- bustid = ""
- if (BUST_TYPE == 1):
- for i in range(len(rows)):
- row = rows[i]
- element = row.find("font", {"class":"countdown"})
- results = re.search("\d+", element.text)
- if (results != None):
- timeremaining = int(results.group(0))
- if (timeremaining < 100):
- bustid = row.find("input")["value"]
- break
- elif (BUST_TYPE == 2):
- row = rows[0]
- bustid = row.find("input")["value"]
- return bustid
- # loops to sleep while in jail, and perform activity when out
- def loopcrimes(biscuits, iters):
- for i in range(iters):
- injail = True
- while (injail):
- injail = checkinjail(biscuits)
- if (injail):
- time.sleep(JAIL_WAIT)
- docrimes(biscuits)
- time.sleep(CRIME_WAIT)
- def loopgta(biscuits, iters):
- for i in range(iters):
- injail = True
- while (injail):
- injail = checkinjail(biscuits)
- if (injail):
- time.sleep(JAIL_WAIT)
- dogta(biscuits)
- time.sleep(GTA_WAIT)
- def loopjail(biscuits, iters):
- for i in range(iters):
- injail = True
- while (injail):
- injail = checkinjail(biscuits)
- if (injail):
- time.sleep(JAIL_WAIT)
- bust(biscuits)
- time.sleep(JAIL_WAIT)
- # check if currently in jail
- # adds "." to line every 10 seconds if still in jail
- def checkinjail(biscuits):
- global injailcounter
- soup = get(JAIL_URL, biscuits)
- html = soup.prettify()
- result = re.search("You are in jail!", html)
- val = result != None
- if (val and injailcounter == 0):
- print("In Jail! [" + timestamp() + "]")
- injailcounter += 1
- elif (val and injailcounter > 0):
- sys.stdout.write('.')
- sys.stdout.flush()
- injailcounter += 1
- return val
- def timestamp():
- return str(int(time.time()) - countertime) + "s"
- # navigate to homepage with headers
- def gotoindex(url):
- response = requests.get(url, headers=HEADERS)
- html = response.text
- soup = bs4.BeautifulSoup(html, "lxml")
- return soup
- # login, username/password are in plaintext, cba with stars or whatever
- def login(soup):
- username = input("Username: ")
- password = input("Password: ")
- timestamp = str(int(time.time()))
- timestamp2 = soup.find(id=TIMESTAMP2_FIELD).value
- payload = { TIMESTAMP_FIELD : timestamp,
- TIMESTAMP2_FIELD : timestamp2,
- EXTRA_FIELD : EXTRA_VALUE,
- USERNAME_FIELD : username,
- PASSWORD_FIELD : password,
- SUBLOGIN_FIELD : SUBLOGIN_VALUE }
- response = requests.post(LOGIN_URL, data=payload, headers=HEADERS)
- html = response.text
- soup = bs4.BeautifulSoup(html, "lxml")
- print("Logged in.")
- return response.cookies
- # send get request
- def get(url, biscuits):
- response = requests.get(url, cookies=biscuits, headers=HEADERS)
- html = response.text
- soup = bs4.BeautifulSoup(html, "lxml")
- return soup
- # send post request
- def post(url, payload, biscuits):
- response = requests.post(url, data=payload, cookies=biscuits, headers=HEADERS)
- html = response.text
- soup = bs4.BeautifulSoup(html, "lxml")
- return soup
- # run
- if __name__ == "__main__":
- run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement