Advertisement
Guest User

for raven

a guest
Jan 27th, 2017
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.57 KB | None | 0 0
  1. import time
  2. import bs4
  3. import requests
  4. import re
  5. import sys
  6.  
  7. '''
  8. Notice:
  9. If you don't trust this script, don't run it.
  10. You have the source code, so judge how trust worthy it is.
  11. If anything bad happens after running this script, I am not liable, running
  12. this script is cheating, do so at your own risk.
  13.  
  14. Requirements:
  15. Python 3 - https://www.python.org/downloads/
  16. (I recommend installing pip and adding the PATH variable after
  17. installation)
  18. (If you already have Python 2 installed then it's up to you to install
  19. the required packages to the correct version, good luck)
  20. BeautifulSoup4 - pip install beautifulsoup4
  21. https://www.crummy.com/software/BeautifulSoup/bs4/doc/
  22. Requests - pip install requests
  23. http://docs.python-requests.org/en/master/user/install/
  24. lxml - pip install lxml
  25. (Can be a bitch to install on Windows, read the guide on their website)
  26. http://lxml.de/installation.html
  27.  
  28. Usage:
  29. (After installing Python3, BeautifulSoup4, Requests, and lxml)
  30.  
  31. - navigate to directory containing this file in the command prompt/shell/
  32. powershell/terminal/whatever your OS uses
  33. e.g. cd /home/rev/scripts/
  34. - run:
  35. python autoIG.py
  36. - profit
  37.  
  38. - to only do crimes:
  39. python autoIG.py -c
  40.  
  41. - to only do gta:
  42. python autoIG.py -g
  43.  
  44. - to only do jail busting:
  45. python autoIG.py -j
  46.  
  47. This script is a bit shit, sometimes it says you've failed to steal a car when
  48. you've succeeded, it was written very quickly, chill.
  49.  
  50. This script was written as a proof of concept more than anything. Goodgy got
  51. banned for scripting, and people seemed to think scripting was just running and
  52. autoclicker. I wanted to see how easy botting Infamous Gangsters was, as it
  53. turned out, very easy. This script started being written on 09/10/2016.
  54.  
  55. The game has died, and Rev has done nothing to help the game for years.
  56.  
  57. Rev, if you're reading this, you let your game die, I imagine it was a good
  58. source of profit, and could have made you a lot more money if you'd developed
  59. it.
  60.  
  61. You had a large community of people who have spent millions of hours playing a
  62. game you made, people who cared about the game and wanted it to do well.
  63.  
  64. Many players have put forward the idea of letting the playerbase help develop
  65. features in the game, because we were tired of the game being stagnant.
  66.  
  67. If you're making less money it's because of your lack of effort towards the
  68. game, and because taking away legitimate players' money on a "guilty until
  69. proven innocent" basis is pathetic.
  70.  
  71. You've brought this upon yourself.
  72. '''
  73.  
  74. # 1 - bust top player with timer under 100s
  75. # 2 - bust top player
  76. BUST_TYPE = 1
  77.  
  78. # headers so this doesn't look like a bot...
  79. 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" }
  80.  
  81. # game urls
  82. URL = "https://infamousgangsters.com/"
  83. LOGIN_URL = "https://infamousgangsters.com/checkuser.php"
  84. SUCCESS_URL = "https://infamousgangsters.com/site.php?page=viewigtopic&id=433&forum=1"
  85. CRIMES_URL = "https://infamousgangsters.com/site.php?page=crimes"
  86. GTA_URL = "https://infamousgangsters.com/site.php?page=gta"
  87. JAIL_URL = "https://infamousgangsters.com/site.php?page=jail"
  88.  
  89. # data necessary for logging in
  90. USERNAME_FIELD = "username"
  91. PASSWORD_FIELD = "password"
  92. TIMESTAMP_FIELD = "login_timestamp"
  93. TIMESTAMP2_FIELD = "login_timestamp2"
  94. EXTRA_FIELD = "extra"
  95. SUBLOGIN_FIELD = "sublogin"
  96. EXTRA_VALUE = "1566666"
  97. SUBLOGIN_VALUE = "+Login+"
  98.  
  99. # time to wait after doing each activity
  100. # jail time can be changed as you please
  101. # gta/crimes can be increased if you want
  102. GTA_WAIT = 300
  103. JAIL_WAIT = 10
  104. CRIME_WAIT = 10
  105.  
  106. # each activity runs for 1 hour (3600 seconds)
  107. # change to suit your preferences
  108. COUNTER_TIME_LIMIT = 3600
  109. countertime = 0
  110.  
  111. # running totals for each activity done
  112. crimescounter = 0
  113. gtacounter = 0
  114. bustcounter = 0
  115.  
  116. injailcounter = 0
  117.  
  118. ACTIVITIES = ["crimes", "gta", "jail"]
  119.  
  120. # main method, logs in then runs loop
  121. def run():
  122. soup = gotoindex(URL)
  123. biscuits = login(soup)
  124. soup = get(SUCCESS_URL, biscuits)
  125. args = sys.argv
  126. if (len(args) > 1):
  127. if args[1] == "-c":
  128. # run only crimes
  129. runloop(biscuits, 0)
  130. elif args[1] == "-g":
  131. # run only gta
  132. runloop(biscuits, 1)
  133. elif args[1] == "-j":
  134. # run only jail busts
  135. runloop(biscuits, 2)
  136. else:
  137. # run standard loop
  138. runloop(biscuits, None)
  139. else:
  140. runloop(biscuits, None)
  141.  
  142. # main loop, runs each activity, keeps track of time
  143. def runloop(biscuits, constactivity):
  144. startactivity = 0
  145. activityincrementer = 1
  146. if (constactivity != None):
  147. startactivity = constactivity
  148. activityincrementer = 0
  149. activityint = startactivity
  150. while(1):
  151. global countertime
  152. countertime = int(time.time())
  153. print("Activity for " + str(COUNTER_TIME_LIMIT) + "s: " + ACTIVITIES[activityint])
  154. while(int((time.time()) - countertime) < COUNTER_TIME_LIMIT):
  155. if (activityint == 0):
  156. loopcrimes(biscuits, 1)
  157. elif (activityint == 1):
  158. loopgta(biscuits, 1)
  159. elif (activityint == 2):
  160. loopjail(biscuits, 1)
  161. activityint = (activityint + activityincrementer) % len(ACTIVITIES)
  162.  
  163. # do all available crimes (apart from minigames)
  164. def docrimes(biscuits):
  165. global injailcounter
  166. if (injailcounter > 0):
  167. print("")
  168. injailcounter = 0
  169. soup = get(CRIMES_URL, biscuits)
  170. checkboxes = soup.find_all("input", {"type" : "checkbox" })
  171. visiblecheckboxes = [checkbox for checkbox in checkboxes if checkbox["value"] != "aaaa"]
  172. statuses = soup.find_all("font", {"color" : "red" })
  173. payload = {}
  174. for i in range(len(visiblecheckboxes)):
  175. if (i != 0 and i != 5):
  176. if ("available" in statuses[i].text):
  177. cb = visiblecheckboxes[i]
  178. payload[cb["name"]] = cb["value"]
  179. soup = post(CRIMES_URL, payload, biscuits)
  180. global crimescounter
  181. crimescounter += 1
  182. print("Crimes committed (" + str(crimescounter) + ") [" + timestamp() + "]")
  183. return soup
  184.  
  185. # do gta
  186. def dogta(biscuits):
  187. global injailcounter
  188. if (injailcounter > 0):
  189. print("")
  190. injailcounter = 0
  191. soup = get(GTA_URL, biscuits)
  192. stealstring = "Steal a car!"
  193. code = soup.find("input", {"value" : stealstring})["name"]
  194. payload = { "pagenumber" : 0,
  195. code : stealstring }
  196. soup = post(GTA_URL, payload, biscuits)
  197. html = soup.prettify()
  198. result = re.search("You stole.+\d\d%\sdamage", html)
  199. if (result != None):
  200. car = result.group(0)
  201. global gtacounter
  202. gtacounter += 1
  203. print(car + " (" + str(gtacounter) + ") [" + timestamp() + "]")
  204. else:
  205. print("Failed to steal a car [" + timestamp() + "]")
  206. return soup
  207.  
  208. # bust someone out of jail
  209. def bust(biscuits):
  210. global injailcounter
  211. if (injailcounter > 0):
  212. print("")
  213. injailcounter = 0
  214. soup = get(JAIL_URL, biscuits)
  215. bustid = getbustid(soup)
  216. if (bustid == ""):
  217. return
  218. payload = { "bustid" : bustid }
  219. soup = post(JAIL_URL, payload, biscuits)
  220. html = soup.prettify()
  221. relevanthtml = html[0:html.find("id=\"bustform")]
  222. result1 = re.search("You successfully busted ([\w\d]+) from jail!", relevanthtml)
  223. result2 = re.search("You received[\s<b>\n]*\$([\d,]+)[\s</b>\n]*for the bust!", relevanthtml)
  224. if (result1 != None):
  225. name = result1.groups(0)[0]
  226. if (result2 != None):
  227. money = result2.groups(0)[0]
  228. else:
  229. money = "0"
  230. global bustcounter
  231. bustcounter += 1
  232. print("Successfully busted " + name + " for $" + money + " (" + str(bustcounter) + ") [" + timestamp() + "]")
  233. else:
  234. print("Failed to bust [" + timestamp() + "]")
  235.  
  236. # get id from configured option
  237. def getbustid(soup):
  238. form = soup.find("form", {"id":"bustform"})
  239. rows = form.find_all("tr")[2:]
  240. bustid = ""
  241. if (BUST_TYPE == 1):
  242. for i in range(len(rows)):
  243. row = rows[i]
  244. element = row.find("font", {"class":"countdown"})
  245. results = re.search("\d+", element.text)
  246. if (results != None):
  247. timeremaining = int(results.group(0))
  248. if (timeremaining < 100):
  249. bustid = row.find("input")["value"]
  250. break
  251. elif (BUST_TYPE == 2):
  252. row = rows[0]
  253. bustid = row.find("input")["value"]
  254. return bustid
  255.  
  256. # loops to sleep while in jail, and perform activity when out
  257.  
  258. def loopcrimes(biscuits, iters):
  259. for i in range(iters):
  260. injail = True
  261. while (injail):
  262. injail = checkinjail(biscuits)
  263. if (injail):
  264. time.sleep(JAIL_WAIT)
  265. docrimes(biscuits)
  266. time.sleep(CRIME_WAIT)
  267.  
  268. def loopgta(biscuits, iters):
  269. for i in range(iters):
  270. injail = True
  271. while (injail):
  272. injail = checkinjail(biscuits)
  273. if (injail):
  274. time.sleep(JAIL_WAIT)
  275. dogta(biscuits)
  276. time.sleep(GTA_WAIT)
  277.  
  278. def loopjail(biscuits, iters):
  279. for i in range(iters):
  280. injail = True
  281. while (injail):
  282. injail = checkinjail(biscuits)
  283. if (injail):
  284. time.sleep(JAIL_WAIT)
  285. bust(biscuits)
  286. time.sleep(JAIL_WAIT)
  287.  
  288. # check if currently in jail
  289. # adds "." to line every 10 seconds if still in jail
  290. def checkinjail(biscuits):
  291. global injailcounter
  292. soup = get(JAIL_URL, biscuits)
  293. html = soup.prettify()
  294. result = re.search("You are in jail!", html)
  295. val = result != None
  296. if (val and injailcounter == 0):
  297. print("In Jail! [" + timestamp() + "]")
  298. injailcounter += 1
  299. elif (val and injailcounter > 0):
  300. sys.stdout.write('.')
  301. sys.stdout.flush()
  302. injailcounter += 1
  303. return val
  304.  
  305. def timestamp():
  306. return str(int(time.time()) - countertime) + "s"
  307.  
  308. # navigate to homepage with headers
  309. def gotoindex(url):
  310. response = requests.get(url, headers=HEADERS)
  311. html = response.text
  312. soup = bs4.BeautifulSoup(html, "lxml")
  313. return soup
  314.  
  315. # login, username/password are in plaintext, cba with stars or whatever
  316. def login(soup):
  317. username = input("Username: ")
  318. password = input("Password: ")
  319. timestamp = str(int(time.time()))
  320. timestamp2 = soup.find(id=TIMESTAMP2_FIELD).value
  321. payload = { TIMESTAMP_FIELD : timestamp,
  322. TIMESTAMP2_FIELD : timestamp2,
  323. EXTRA_FIELD : EXTRA_VALUE,
  324. USERNAME_FIELD : username,
  325. PASSWORD_FIELD : password,
  326. SUBLOGIN_FIELD : SUBLOGIN_VALUE }
  327. response = requests.post(LOGIN_URL, data=payload, headers=HEADERS)
  328. html = response.text
  329. soup = bs4.BeautifulSoup(html, "lxml")
  330. print("Logged in.")
  331. return response.cookies
  332.  
  333. # send get request
  334. def get(url, biscuits):
  335. response = requests.get(url, cookies=biscuits, headers=HEADERS)
  336. html = response.text
  337. soup = bs4.BeautifulSoup(html, "lxml")
  338. return soup
  339.  
  340. # send post request
  341. def post(url, payload, biscuits):
  342. response = requests.post(url, data=payload, cookies=biscuits, headers=HEADERS)
  343. html = response.text
  344. soup = bs4.BeautifulSoup(html, "lxml")
  345. return soup
  346.  
  347. # run
  348. if __name__ == "__main__":
  349. run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement