Advertisement
Guest User

Untitled

a guest
May 20th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.75 KB | None | 0 0
  1. import sys
  2. import json
  3. import time
  4. import requests
  5. import datetime
  6.  
  7. auto_buy_new_spin = False
  8. default_retry_time = 1 * 60
  9. username = "corridalecomputers@gmail.com"
  10. password = "intenseepicsgg"
  11. use_jwt = False
  12. jwt_token = ""
  13.  
  14. for arg in sys.argv:
  15.     if arg.startswith("-jwt"):
  16.         jwt_token = sys.argv[sys.argv.index(arg) + 1]
  17.         use_jwt = True
  18.     elif arg.startswith("-u"):
  19.         username = sys.argv[sys.argv.index(arg) + 1]
  20.     elif arg.startswith("-p"):
  21.         password = sys.argv[sys.argv.index(arg) + 1]
  22.     elif arg.startswith("-a"):
  23.         auto_buy_new_spin = True
  24.  
  25. def getJWT(email, password):
  26.     url = "https://api.epics.gg/api/v1/auth/login?categoryId=1&gameId=1"
  27.  
  28.     payload = "{\"email\":\""+email+"\",\"password\":\""+password+"\"}"
  29.     headers = {
  30.         'Accept': "*/*",
  31.         'Accept-Language': "en-US,nl;q=0.7,en;q=0.3",
  32.         'Referer': "https://app.epics.gg/",
  33.         'Content-Type': "application/json",
  34.         'X-User-JWT': "",
  35.         'Origin': "https://app.epics.gg",
  36.         'DNT': "1",
  37.         'Connection': "keep-alive",
  38.         'TE': "Trailers",
  39.         'Pragma': "no-cache",
  40.         'Cache-Control': "no-cache",
  41.         'cache-control': "no-cache",
  42.         }
  43.  
  44.     response = requests.request("POST", url, data=payload, headers=headers)
  45.  
  46.     if json.loads(response.text)['success']:
  47.         return json.loads(response.text)['data']['jwt']
  48.     else:
  49.         return False;
  50.  
  51. def getSpinnerId(jwt_token):
  52.     url = "https://api.epics.gg/api/v1/spinner?categoryId=1&gameId=1"
  53.  
  54.     headers = {
  55.         'Accept': "*/*",
  56.         'Accept-Language': "en-US,nl;q=0.7,en;q=0.3",
  57.         'X-User-JWT': "" + jwt_token + "",
  58.         'Origin': "https://app.epics.gg",
  59.         'DNT': "1",
  60.         'Connection': "keep-alive",
  61.         'TE': "Trailers",
  62.         'Pragma': "no-cache",
  63.         'Cache-Control': "no-cache",
  64.         'cache-control': "no-cache",
  65.         }
  66.  
  67.     response = requests.request("GET", url, headers=headers)
  68.  
  69.     return json.loads(response.text)['data']['id']
  70.  
  71.  
  72. def runSpinner(spinner_id, jwt_token):
  73.     url = "https://api.epics.gg/api/v1/spinner/spin"
  74.  
  75.     payload = "{\"spinnerId\":" + str(spinner_id) +"}"
  76.     headers = {
  77.         'Accept': "*/*",
  78.         'Accept-Language': "en-US,nl;q=0.7,en;q=0.3",
  79.         'Referer': "https://app.epics.gg/csgo/spinner",
  80.         'Content-Type': "application/json",
  81.         'X-User-JWT': "" + jwt_token + "",
  82.         'Origin': "https://app.epics.gg",
  83.         'DNT': "1",
  84.         'Connection': "keep-alive",
  85.         'TE': "Trailers",
  86.         'Pragma': "no-cache",
  87.         'Cache-Control': "no-cache",
  88.         'cache-control': "no-cache",
  89.         }
  90.  
  91.     response = requests.request("POST", url, data=payload, headers=headers)
  92.  
  93.     return json.loads(response.text)['success']
  94.  
  95. def buySpin(jwt_token, amount):
  96.     url = "https://api.epics.gg/api/v1/spinner/buy-spin"
  97.  
  98.     payload = "{\"amount\":" + str(amount) +"}"
  99.     headers = {
  100.         'Accept': "*/*",
  101.         'Accept-Language': "en-US,nl;q=0.7,en;q=0.3",
  102.         'Referer': "https://app.epics.gg/",
  103.         'Content-Type': "application/json",
  104.         'X-User-JWT': "" + jwt_token + "",
  105.         'Origin': "https://app.epics.gg",
  106.         'DNT': "1",
  107.         'Connection': "keep-alive",
  108.         'TE': "Trailers",
  109.         'Pragma': "no-cache",
  110.         'Cache-Control': "no-cache",
  111.         'cache-control': "no-cache",
  112.         }
  113.  
  114.     response = requests.request("POST", url, data=payload, headers=headers)
  115.     return json.loads(response.text)['success']
  116.  
  117. def getLatestWin(jwt_token):
  118.     url = "https://api.epics.gg/api/v1/spinner/history?categoryId=1&gameId=1"
  119.  
  120.     headers = {
  121.         'Accept': "*/*",
  122.         'Accept-Language': "en-US,nl;q=0.7,en;q=0.3",
  123.         'X-User-JWT': "" + jwt_token + "",
  124.         'Origin': "https://app.epics.gg",
  125.         'DNT': "1",
  126.         'Connection': "keep-alive",
  127.         'TE': "Trailers",
  128.         'Pragma': "no-cache",
  129.         'Cache-Control': "no-cache",
  130.         'cache-control': "no-cache",
  131.         }
  132.  
  133.     response = requests.request("GET", url, headers=headers)
  134.  
  135.     return json.loads(response.text)['data']['spins'][0]['name']
  136.  
  137. def getBalance(jwt_token):
  138.     url = "https://api.epics.gg/api/v1/balance?categoryId=1&gameId="
  139.  
  140.     headers = {
  141.         'Accept': "*/*",
  142.         'Accept-Language': "en-US,nl;q=0.7,en;q=0.3",
  143.         'X-User-JWT': "" + jwt_token + "",
  144.         'Origin': "https://app.epics.gg",
  145.         'DNT': "1",
  146.         'Connection': "keep-alive",
  147.         'TE': "Trailers",
  148.         'Pragma': "no-cache",
  149.         'Cache-Control': "no-cache",
  150.         'cache-control': "no-cache",
  151.         }
  152.  
  153.     response = requests.request("GET", url, headers=headers)
  154.     return json.loads(response.text)['data']
  155.  
  156. def log(message):
  157.     print(message)
  158.  
  159. loops = 10
  160.  
  161. while True:
  162.  
  163.  
  164.     if not use_jwt:
  165.         if loops > 9:
  166.             jwt_token = getJWT(username, password)
  167.             loops = 0
  168.  
  169.     if auto_buy_new_spin:
  170.         current_balance = getBalance(jwt_token)
  171.         while current_balance > 9:
  172.             log("("+username+") Balance: " + str(current_balance))
  173.             if buySpin(jwt_token, 1):
  174.                 log("("+username+") Bought 1 spin.")
  175.             else:
  176.                 log("("+username+") Could not buy 1 spin...")
  177.                 break
  178.  
  179.             current_balance = getBalance(jwt_token)
  180.             log("New balance: " + str(current_balance))
  181.             time.sleep(5)
  182.  
  183.     result = runSpinner(getSpinnerId(jwt_token), jwt_token)
  184.  
  185.     if result == True:
  186.         time.sleep(1)
  187.         log("("+username+") You got: " + getLatestWin(jwt_token))
  188.         time.sleep(2)
  189.     else:
  190.         #log("("+username+") waiting " + str(default_retry_time) + " seconds.")
  191.         time.sleep(default_retry_time)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement