├── .gitignore ├── README.md ├── coloredterm.py ├── config.yml ├── main.py ├── miner.py ├── network.py ├── player.py ├── requirements.txt ├── update.py └── utils.py /.gitignore: -------------------------------------------------------------------------------- 1 | config.yml 2 | *.pyc 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vHackOSBOT 🤖 2 | 3 | A Bot for the vHackOS made in Python 🐍 4 | 5 | ## Requirements 6 | 7 | * Python 2.7/Python 3.x 8 | * Requests 9 | * Ruamel.yaml 10 | * coloredlogs 11 | * terminaltables 12 | 13 | ## Getting started 14 | 15 | Edit **config.yml** with your credentials. 16 | ```python 17 | pip install -r requirements.txt 18 | 19 | python main.py 20 | ``` 21 | ## Screenshots 22 | 23 | ![alt text](https://brasilturbo.com/s8h8AUor.png) 24 | 25 | ## Contributing 26 | 27 | You can contribute and improve the bot through the [Pull requests](https://github.com/OlympicCode/vHackOSBot-Python/pull/new/master) or open a [issue](https://github.com/OlympicCode/vHackOSBot-Python/issues/new). 28 | -------------------------------------------------------------------------------- /coloredterm.py: -------------------------------------------------------------------------------- 1 | from colorama import init 2 | from colorama import Fore, Back, Style 3 | 4 | 5 | init() 6 | 7 | 8 | class colored(): 9 | def __init__(self, msglog, message): 10 | self.mlog = msglog 11 | self.msg = message 12 | 13 | def autocolored(self): 14 | color = { 15 | 16 | #global message 17 | "ErrorRequest": Fore.RED, 18 | "ErrorJson": Fore.RED, 19 | "BadRequest": Fore.RED, 20 | "showResult": Fore.RED, 21 | 22 | # update message 23 | "showMsgUpdatefull": Fore.BLUE, 24 | "showMsgUpdate": Fore.BLUE, 25 | 26 | # Network message 27 | "showMsgEndAttack": Fore.GREEN, 28 | "showMsgErrorAPI": Fore.GREEN, 29 | "showMsgDoesntPossibleAttack": Fore.BLUE, 30 | "showMsgWriteLog": Fore.YELLOW, 31 | "showMsgCollectMoneyUser": Fore.BLUE, 32 | "showMsgErrorSdk=0": Fore.BLUE, 33 | "showMsgCollectMoneyUser": Fore.BLUE, 34 | "showMsgCollectMoneyUser": Fore.BLUE, 35 | "showMsgGenerateMWK": Fore.BLUE, 36 | 37 | #Miner message 38 | "MinerMsgLeft": Fore.BLUE, 39 | "MinerStarting": Fore.BLUE, 40 | "MinerMsgTime": Fore.BLUE 41 | } 42 | 43 | return "{} {} {}".format(color[self.mlog], self.msg, Style.RESET_ALL) 44 | -------------------------------------------------------------------------------- /config.yml: -------------------------------------------------------------------------------- 1 | username: putyournamehere # <- Your Username Account 2 | password: putyourpasshere # <- Your Password Account 3 | 4 | debug: false # < debug mode dev online 5 | 6 | sync_mobile: false # < If your are uID and accessToken and your phone bot use configuration for login please replace your uid and accesstoken sync to phone. (Recommended OFF) 7 | 8 | # example ['All', '!showMsgTotalBruteForceInfo'] < show all but don't show Total Brute Force Information return bot print. 9 | # example ['showMsgTotalBruteForceInfo'] < just show Total Brute Force Information return bot print. 10 | show_info: [All] # < show the return bot print information 11 | 12 | # attack mode it's method for attack the bot 13 | # ~ all > all method atack 14 | # ~ just_collect > just collect money to your List bruteforce passed 15 | # ~ just_attack > just add for new user player don't try to attack your bruteforce list 16 | attack_mode: All 17 | 18 | uID: # < Automatically added uID for your account don't change /!\ 19 | accessToken: # < Automatically added accessToken for your account don't change /!\ 20 | update: [SDK, SDK, AV, BP, IPSP] 21 | msgLog: 22 | timeSleep: 1 # < Recommended minimal value 2 23 | version: 2.3.2 24 | errorTime: 25 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from update import Update 2 | from network import Network 3 | from utils import Utils 4 | from miner import Miner 5 | import sys 6 | import os 7 | try: 8 | import fcntl 9 | except: 10 | pass 11 | 12 | 13 | class run(): 14 | def __init__(self, ut): 15 | update = Update(ut) 16 | network = Network(ut) 17 | miner = Miner(ut) 18 | 19 | 20 | if __name__ == '__main__': 21 | ut = Utils() 22 | ut.check_version() 23 | try: 24 | fl = fcntl.fcntl(sys.stdin.fileno(), fcntl.F_GETFL) 25 | fcntl.fcntl(sys.stdin.fileno(), fcntl.F_SETFL, fl | os.O_NONBLOCK) 26 | except: 27 | pass 28 | while 1: 29 | main = run(ut) 30 | -------------------------------------------------------------------------------- /miner.py: -------------------------------------------------------------------------------- 1 | from utils import Utils 2 | from player import Player 3 | import os, time, datetime, sys 4 | 5 | class Miner(): 6 | def __init__(self, ut): 7 | self.ut = ut 8 | self.Configuration = self.ut.readConfiguration() 9 | self.store = self.ut.requestString("store.php", 10 | accesstoken=self.Configuration["accessToken"]) 11 | self.myinfo = self.ut.account() 12 | self.runMiner() 13 | 14 | def runMiner(self): 15 | if 'minerLeft' in self.myinfo.keys(): 16 | self.minefinish = int(self.myinfo['minerLeft']) 17 | self.ut.viewsPrint("MinerMsgLeft", "minerLeft ({}) secondes".format(self.minefinish)) 18 | else: 19 | self.ut.viewsPrint("MinerMsgError", 'Unexpected myinfo string {}'.format(self.myinfo)) 20 | sys.exit() 21 | if self.minefinish > 0: 22 | self.ut.viewsPrint("MinerMsgTime", "waiting until {} --- {}".format(self.ut.tuntin(self.minefinish), datetime.timedelta(seconds=(self.minefinish)))) 23 | 24 | else: 25 | result = self.MinerInfo() 26 | if result['result'] == '0': 27 | if result['running'] == '2' and result['claimed'] == '0': 28 | collectresult = self.doCollect() 29 | if collectresult['result'] != '0': 30 | self.ut.viewsPrint("MinerMsgerror", 'something went wrong collecting') 31 | sys.exit() 32 | elif result['running'] == '0' and result['claimed'] == '0': 33 | mineresult = self.doMine() 34 | if mineresult['result'] != '0': 35 | self.ut.viewsPrint("MinerMsgerror", 'something went wrong collecting') 36 | sys.exit() 37 | elif mineresult['result'] == '0': 38 | self.ut.viewsPrint("MinerStarting", " started mining {} --- {}".format(self.ut.tuntin(int(mineresult['left'])), datetime.timedelta(seconds=(int(mineresult['left']))))) 39 | 40 | def doMine(self): 41 | result = self.ut.requestString("mining.php", accesstoken=self.Configuration["accessToken"], action="100") 42 | return result 43 | 44 | def doCollect(self): 45 | result = self.ut.requestString("mining.php", accesstoken=self.Configuration["accessToken"], action="200") 46 | return result 47 | 48 | def MinerInfo(self): 49 | result = self.ut.requestString("mining.php", accesstoken=self.Configuration["accessToken"]) 50 | return result 51 | -------------------------------------------------------------------------------- /network.py: -------------------------------------------------------------------------------- 1 | from utils import Utils 2 | from player import Player 3 | import os 4 | import time 5 | 6 | 7 | class Network(): 8 | def __init__(self, ut): 9 | self.ut = ut 10 | self.Configuration = self.ut.readConfiguration() 11 | self.targetBruted = self.ut.requestString("tasks.php", 12 | accesstoken=self.Configuration["accessToken"]) 13 | self.network = self.ut.requestString("network.php", 14 | accesstoken=self.Configuration["accessToken"], lang="en") 15 | 16 | 17 | if self.Configuration["attack_mode"] == "All" or self.Configuration["attack_mode"] == "just_attack": 18 | self.startFunctionAttack() 19 | 20 | if self.Configuration["attack_mode"] == "All" or self.Configuration["attack_mode"] == "just_recolt": 21 | self.createMalwareKit() 22 | self.RecoltMoney() 23 | 24 | def startFunctionAttack(self): 25 | # collect information in network. 26 | if "ips" not in self.network: 27 | self.ut.viewsPrint("showMsgErrorAPI", "You dont have ips in the network app... weird ... please wait") 28 | return False 29 | 30 | collect_scan_player = [(x["ip"], x["fw"], x["open"], x["level"]) \ 31 | for x in self.network["ips"]] 32 | 33 | p = Player(self.ut) 34 | for info_player in collect_scan_player: 35 | ip = str(info_player[0]) 36 | firewall = int(info_player[1]) 37 | 38 | # currency calcule for attack 39 | calc_attack = (firewall / int(p.getHelperApplication()["SDK"]["level"])) -1 40 | 41 | # define the rule for attack target 42 | if calc_attack >= 0.8: 43 | # not possible to attack user if their firewall is too strong 44 | self.ut.viewsPrint("showMsgDoesntPossibleAttack", "[{}] - Don't Attack Your SDK ({}) vs Target Firewall ({}) Match off ~({}%) on ip : '{}' :(".format(os.path.basename(__file__), int(p.getHelperApplication()["SDK"]["level"]), firewall, round(calc_attack*100), ip)) 45 | else: 46 | # attack ip if firewall enemy < your SDK 47 | result = self.AttackTarget(ip) 48 | if result == 0: 49 | break 50 | self.ut.viewsPrint("showMsgEndAttack", "[{}] - End Attack Loop Success.".format(os.path.basename(__file__))) 51 | return True 52 | 53 | def ChangeLog(self, ip): 54 | reqRemotelog = self.ut.requestString("remotelog.php", target=ip, accesstoken=self.Configuration["accessToken"], action="100", log=self.Configuration["msgLog"]) 55 | resultLog = int(reqRemotelog["result"]) 56 | 57 | if resultLog == 2: 58 | self.ut.viewsPrint("showMsgWriteLog", "[{}] - Write log '{}' to '{}'".format(os.path.basename(__file__), self.Configuration["msgLog"], ip)) 59 | 60 | 61 | def AttackTarget(self, ip): 62 | your_exploit = self.ut.exploit() 63 | if int(your_exploit) > 0: 64 | 65 | # get information in device. 66 | targetHack = self.ut.requestString("exploit.php", lang="en", target=ip, accesstoken=self.Configuration["accessToken"]) 67 | resultHack = int(targetHack["result"]) 68 | 69 | # if result is good you are able to connect 70 | if resultHack == 0: 71 | # connect to the device 72 | targetRemote = self.ut.requestString("remote.php", lang="en", target=ip, accesstoken=self.Configuration["accessToken"]) 73 | resultRemote = int(targetRemote["result"]) 74 | else: 75 | return self.ut.result(result="don't return 0 weird", code=1) 76 | 77 | # if result is good you can launch a bruteforce to steal from bank 78 | if resultRemote == 0: 79 | bankingRemote = self.ut.requestString("remotebanking.php", target=ip, accesstoken=self.Configuration["accessToken"]) 80 | resultbanking = int(bankingRemote["result"]) 81 | passwordbanking = str(bankingRemote["remotepassword"]) 82 | else: 83 | return self.ut.result(result="not returning 0 weird", code=2) 84 | 85 | # if password string was not recieved then it was not cracked ... start bruteforce 86 | if passwordbanking == "": 87 | reqBruteForce = self.ut.requestString("startbruteforce.php", target=ip, accesstoken=self.Configuration["accessToken"]) 88 | resultBruteforce = int(reqBruteForce["result"]) 89 | else: 90 | return self.ut.result(result="don't return '' weird", code=3) 91 | 92 | # verify your command target 93 | if resultBruteforce == 0: 94 | self.ut.viewsPrint("showMsgCollectMoneyUser", "[{}] - {} '{}'".format(os.path.basename(__file__), "Start Bruteforce to", ip)) 95 | self.ChangeLog(ip) 96 | 97 | # if the return result is 2, then you have no exploits 98 | # not possible for you to hack, wait to 99 | # regenerate exploits. 100 | elif resultHack == 2: 101 | pass 102 | else: 103 | self.ut.viewsPrint("showMsgErrorSdk=0", "[{}] - not possible to hack, no exploits wait.".format(os.path.basename(os.path.basename(__file__)))) 104 | return 0 105 | 106 | def RecoltMoney(self): 107 | # collect information in bruteforce list. 108 | try: 109 | collect_brute_player = [(x["username"], x["end"], x["user_ip"], x["start"], x["result"], x["now"], x["id"]) \ 110 | for x in self.targetBruted["brutes"]] 111 | except KeyError: 112 | collect_brute_player = [] 113 | 114 | for PlayerBrute in collect_brute_player: 115 | PlayerBruteUsername = PlayerBrute[0] 116 | PlayerBruteIP = PlayerBrute[2] 117 | reqBanking = self.ut.requestString("remotebanking.php", target=PlayerBruteIP, accesstoken=self.Configuration["accessToken"]) 118 | try: 119 | money = int(reqBanking["money"]) 120 | except KeyError: 121 | money = 0 122 | if money > 0: 123 | reqMoney = self.ut.requestString("remotebanking.php", target=PlayerBruteIP, accesstoken=self.Configuration["accessToken"], action="100", amount=money, lang="en") 124 | self.ut.viewsPrint("showMsgCollectMoneyUser", "[{}] - {} {} to '{}'\033[0m".format(os.path.basename(__file__), "you are collected +", money, PlayerBruteIP)) 125 | self.ChangeLog(PlayerBruteIP) 126 | else: 127 | self.ut.viewsPrint("showMsgCollectMoneyUser", "[{}] - {} {} to '{}'\033[0m".format(os.path.basename(__file__), "money = 0 no possible to get money", money, PlayerBruteIP)) 128 | self.ChangeLog(PlayerBruteIP) 129 | 130 | def createMalwareKit(self): 131 | malware = self.ut.requestString("mwk.php", accesstoken=self.Configuration["accessToken"], lang="en") 132 | if int(malware["result"]) == 0: 133 | if int(malware["tasksCount"]) != 1: 134 | malware = self.ut.requestString("mwk.php", accesstoken=self.Configuration["accessToken"], action="100", lang="en") 135 | self.ut.viewsPrint("showMsgGenerateMWK", "[{}] - Creating Malware Kit, you have ({}) Malware Kits".format(os.path.basename(__file__), malware["mwReady"])) 136 | -------------------------------------------------------------------------------- /player.py: -------------------------------------------------------------------------------- 1 | from utils import Utils 2 | import os, time 3 | 4 | class Player(): 5 | def __init__(self, ut): 6 | self.ut = ut 7 | self.Configuration = self.ut.readConfiguration() 8 | self.getStore = self.ut.requestString("store.php", 9 | accesstoken=self.Configuration["accessToken"], lang="en") 10 | 11 | def getApplication(self): 12 | Dict_request = self.getStore["apps"] 13 | ApplicationCount = [] 14 | 15 | for ApplicationUp in enumerate(Dict_request): 16 | Application = {} 17 | try: 18 | Application["baseprice"] = ApplicationUp[1]["baseprice"] 19 | Application["level"] = ApplicationUp[1]["level"] 20 | Application["price"] = ApplicationUp[1]["price"] 21 | Application["factor"] = ApplicationUp[1]["factor"] 22 | Application["maxlvl"] = ApplicationUp[1]["maxlvl"] 23 | Application["running"] = ApplicationUp[1]["running"] 24 | Application["appid"] = ApplicationUp[1]["appid"] 25 | Application["require"] = ApplicationUp[1]["require"] 26 | 27 | except KeyError as e: 28 | Application["baseprice"] = None 29 | Application["level"] = ApplicationUp[1]["level"] 30 | Application["price"] = ApplicationUp[1]["price"] 31 | Application["factor"] = None 32 | Application["maxlvl"] = ApplicationUp[1]["maxlvl"] 33 | Application["running"] = None 34 | Application["appid"] = ApplicationUp[1]["appid"] 35 | Application["require"] = ApplicationUp[1]["require"] 36 | 37 | ApplicationCount.append(Application) 38 | 39 | return ApplicationCount 40 | 41 | def getHelperApplication(self): 42 | Application = self.getApplication() 43 | FinalApplication = {} 44 | 45 | for allApplication in Application: 46 | # AntiVirus 47 | if int(allApplication["appid"]) == 1: 48 | FinalApplication["AV"] = allApplication 49 | 50 | # Firewall 51 | if int(allApplication["appid"]) == 2: 52 | FinalApplication["FW"] = allApplication 53 | 54 | # Spam 55 | if int(allApplication["appid"]) == 3: 56 | FinalApplication["SPAM"] = allApplication 57 | 58 | # Brute Force 59 | if int(allApplication["appid"]) == 4: 60 | FinalApplication["BRUTE"] = allApplication 61 | 62 | # Bank Protection 63 | if int(allApplication["appid"]) == 5: 64 | FinalApplication["BP"] = allApplication 65 | 66 | # Software developement kit 67 | if int(allApplication["appid"]) == 6: 68 | FinalApplication["SDK"] = allApplication 69 | 70 | if int(allApplication["appid"]) == 7: 71 | pass 72 | #FinalApplication[""] = allApplication 73 | 74 | if int(allApplication["appid"]) == 8: 75 | pass 76 | #FinalApplication[""] = allApplication 77 | 78 | if int(allApplication["appid"]) == 9: 79 | pass 80 | #FinalApplication[""] = allApplication 81 | 82 | if int(allApplication["appid"]) == 10: 83 | FinalApplication["IPSP"] = allApplication 84 | 85 | if int(allApplication["appid"]) == 11: 86 | pass 87 | #FinalApplication[""] = allApplication 88 | 89 | if int(allApplication["appid"]) == 12: 90 | pass 91 | #FinalApplication[""] = allApplication 92 | 93 | if int(allApplication["appid"]) == 13: 94 | pass 95 | #FinalApplication[""] = allApplication 96 | 97 | if int(allApplication["appid"]) == 14: 98 | pass 99 | #FinalApplication[""] = allApplication 100 | 101 | if int(allApplication["appid"]) == 15: 102 | pass 103 | #FinalApplication[""] = allApplication 104 | 105 | return FinalApplication 106 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.14.2 2 | ruamel.yaml==0.15.35 3 | coloredlogs==9.0 4 | terminaltables==3.1.0 5 | colorama==0.3.9 6 | -------------------------------------------------------------------------------- /update.py: -------------------------------------------------------------------------------- 1 | from utils import Utils 2 | from player import Player 3 | import os, time, random 4 | 5 | class Update(): 6 | def __init__(self, ut): 7 | self.ut = ut 8 | self.Configuration = self.ut.readConfiguration() 9 | self.startFunctionUpdate() 10 | 11 | def startFunctionUpdate(self): 12 | p = Player(self.ut) 13 | 14 | # get money info 15 | if "money" in p.getStore and "apps" in p.getStore: 16 | money = int(p.getStore["money"]) 17 | apps = p.getStore["apps"] 18 | else: 19 | apps = [] 20 | money = 0 21 | 22 | getTask = self.ut.requestString("tasks.php", accesstoken=self.Configuration["accessToken"]) 23 | 24 | if 'updateCount' in getTask.keys(): 25 | update = int(getTask['updateCount']) 26 | else: 27 | update = 0 28 | 29 | # get applications and update this 30 | for count_update, applications in enumerate(apps): 31 | # update application 32 | 33 | 34 | if (count_update+update) < 9: 35 | Appid = int(applications["appid"]) 36 | random.shuffle(self.Configuration["update"]) 37 | for list_update in self.Configuration["update"]: 38 | application_update = int(p.getHelperApplication()[list_update]["appid"]) 39 | if money >= int(applications["price"]): 40 | result = self.ut.requestString("store.php", 41 | accesstoken=self.Configuration["accessToken"], 42 | appcode=application_update, 43 | action="100") 44 | money = money - int(applications["price"]) 45 | if result['result'] == '0': 46 | update = update+1 47 | self.ut.viewsPrint("showMsgUpdate", "[{}] - Updated {} +1".format(os.path.basename(__file__), list_update)) 48 | else: 49 | self.ut.viewsPrint("showMsgUpdate", "[{}] - you have not money to upgrade {}".format(os.path.basename(__file__), list_update)) 50 | else: 51 | self.ut.viewsPrint("showMsgUpdatefull", "[{}] - full task list, please wait.".format(os.path.basename(__file__))) 52 | # install application if level required < level 53 | if int(applications["require"]) <= int(p.getStore["level"]) and int(applications["level"]) == 0: 54 | result = self.ut.requestString("store.php", 55 | accesstoken=self.Configuration["accessToken"], 56 | appcode=applications["appid"], 57 | action="200") 58 | self.ut.viewsPrint("showMsgInstalleApp", "[{}] - Installed new application.".format(os.path.basename(__file__))) 59 | break 60 | -------------------------------------------------------------------------------- /utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python2.7 2 | # -*- coding: utf-8 3 | 4 | import base64 5 | import hashlib 6 | import time 7 | import requests 8 | 9 | from requests.exceptions import ReadTimeout 10 | from requests.packages.urllib3.exceptions import InsecureRequestWarning 11 | import ssl 12 | import logging 13 | import json 14 | import ruamel.yaml as yaml 15 | from ruamel.yaml.scalarstring import SingleQuotedScalarString, DoubleQuotedScalarString 16 | import sys 17 | import os 18 | import platform 19 | import io 20 | import logging 21 | import coloredlogs 22 | import datetime 23 | import random 24 | from coloredterm import colored 25 | from time import gmtime, strftime 26 | try: 27 | import http.client as http_client 28 | except ImportError: 29 | # Python 2 30 | import httplib as http_client 31 | from terminaltables import AsciiTable, SingleTable 32 | from sys import stdout 33 | import re 34 | try: 35 | import fcntl 36 | import termios 37 | windows = False 38 | except: 39 | windows = True 40 | import time 41 | import contextlib 42 | 43 | #logger = logging.getLogger(__name__) 44 | 45 | requests.packages.urllib3.disable_warnings(InsecureRequestWarning) 46 | 47 | 48 | @contextlib.contextmanager 49 | def raw_mode(file): 50 | if windows is False: 51 | old_attrs = termios.tcgetattr(file.fileno()) 52 | new_attrs = old_attrs[:] 53 | new_attrs[3] = new_attrs[3] & ~(termios.ECHO | termios.ICANON) 54 | try: 55 | termios.tcsetattr(file.fileno(), termios.TCSADRAIN, new_attrs) 56 | yield 57 | finally: 58 | termios.tcsetattr(file.fileno(), termios.TCSADRAIN, old_attrs) 59 | 60 | 61 | def set_default(obj): 62 | if isinstance(obj, set): 63 | return list(obj) 64 | raise TypeError 65 | 66 | 67 | USER_AGENT = ['Dalvik/2.1.0 (Linux; U; Android 5.0.1; GT-I9508V Build/LRX22C)', 68 | 'Dalvik/2.1.0 (Linux; U; Android 5.0.1; MX4 Build/LRX22C)', 69 | 'Dalvik/2.1.0 (Linux; U; Android 5.0.2; D5322 Build/19.3.A.0.472)', 70 | 'Dalvik/2.1.0 (Linux; U; Android 5.0.2; D816w Build/LRX22G)', 71 | 'Dalvik/2.1.0 (Linux; U; Android 5.0.2; HTC D816v Build/LRX22G)', 72 | 'Dalvik/2.1.0 (Linux; U; Android 5.0.2; HTC E9pw Build/LRX22G)', 73 | 'Dalvik/2.1.0 (Linux; U; Android 5.0.2; HTC M8t Build/LRX22G)', 74 | 'Dalvik/2.1.0 (Linux; U; Android 5.0.2; HTC One M8s Build/LRX22G)', 75 | 'Dalvik/2.1.0 (Linux; U; Android 5.0.2; LG-F320L Build/LRX22G)', 76 | 'Dalvik/2.1.0 (Linux; U; Android 5.0.2; Letv X500 Build/DBXCNOP5500912251S)', 77 | 'Dalvik/2.1.0 (Linux; U; Android 5.0.2; Nexus 5 Build/LRX22G)', 78 | 'Dalvik/2.1.0 (Linux; U; Android 5.0.2; SM-N9005 Build/LRX22G)', 79 | 'Dalvik/2.1.0 (Linux; U; Android 5.0; ASUS_Z00ADB Build/LRX21V)', 80 | 'Dalvik/2.1.0 (Linux; U; Android 5.0; Nexus 5 Build/LPX13D)', 81 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1 Build/LYZ28N)', 82 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; 2014811 MIUI/6.1.26)', 83 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; A0001 Build/LMY47V)', 84 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; A0001 Build/LMY48Y)', 85 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; D5833 Build/23.4.A.1.232)', 86 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; GT-I9152 Build/LMY48Y)', 87 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; LG-D802 Build/LMY48W)', 88 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; MI 2 Build/LMY48B)', 89 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; MI 2SC Build/LMY47V)', 90 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; MI 3 Build/LMY48Y)', 91 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; Mi-4c MIUI/6.1.14)', 92 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; NX403A Build/LMY48Y)', 93 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; ONE A2001 Build/LMY47V)', 94 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; R7Plusm Build/LMY47V)', 95 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; Redmi Note 2 Build/LMY48Y)', 96 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; SM-J3109 Build/LMY47X)', 97 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; SM-N9200 Build/LMY47X)', 98 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; Sparkle V Build/LMY47V)', 99 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; Xperia Z2 Build/LMY48Y)', 100 | 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; titan Build/LMY48W)', 101 | 'Dalvik/2.1.0 (Linux; U; Android 5.1; HTC M9w Build/LMY47O)', 102 | 'Dalvik/2.1.0 (Linux; U; Android 5.1; HTC One M9 Build/LMY47O)', 103 | 'Dalvik/2.1.0 (Linux; U; Android 5.1; LG-H818 Build/LMY47D)', 104 | 'Dalvik/2.1.0 (Linux; U; Android 5.1; MX5 Build/LMY47I)', 105 | 'Dalvik/2.1.0 (Linux; U; Android 5.1; XT1060 Build/LPA23.12-39.7)', 106 | 'Dalvik/2.1.0 (Linux; U; Android 5.1; XT1085 Build/LPE23.32-53)', 107 | 'Dalvik/2.1.0 (Linux; U; Android 5.1; m1 note Build/LMY47D)', 108 | 'Dalvik/2.1.0 (Linux; U; Android 5.1; m2 Build/LMY47D)', 109 | 'Dalvik/2.1.0 (Linux; U; Android 5.1; m2 note Build/LMY47D)', 110 | 'Dalvik/2.1.0 (Linux; U; Android 6.0.1; 2014813 Build/MMB29U)', 111 | 'Dalvik/2.1.0 (Linux; U; Android 6.0.1; A0001 Build/MMB29M)', 112 | 'Dalvik/2.1.0 (Linux; U; Android 6.0.1; ASUS_Z00A Build/MMB29T)', 113 | 'Dalvik/2.1.0 (Linux; U; Android 6.0.1; MI 4LTE Build/MMB29M)', 114 | 'Dalvik/2.1.0 (Linux; U; Android 6.0.1; Mi-4c Build/MMB29U)', 115 | 'Dalvik/2.1.0 (Linux; U; Android 6.0.1; Moto G 2014 Build/MMB29M)', 116 | 'Dalvik/2.1.0 (Linux; U; Android 6.0.1; Moto G 2014 LTE Build/MMB29T)', 117 | 'Dalvik/2.1.0 (Linux; U; Android 6.0.1; Nexus 4 Build/MMB29M)', 118 | 'Dalvik/2.1.0 (Linux; U; Android 6.0.1; Nexus 5 Build/MMB29K)', 119 | 'Dalvik/2.1.0 (Linux; U; Android 6.0.1; Sensation Build/MMB29U)', 120 | 'Dalvik/2.1.0 (Linux; U; Android 6.0.1; Z1 Build/MMB29T)', 121 | 'Dalvik/2.1.0 (Linux; U; Android 6.0; MI 2 Build/MRA58K)', 122 | 'Dalvik/2.1.0 (Linux; U; Android 6.0; MI 2A Build/MRA58K)', 123 | 'Dalvik/2.1.0 (Linux; U; Android 6.0; Moto G 2014 Build/MDB08M)', 124 | 'Dalvik/2.1.0 (Linux; U; Android 6.0; XT1097 Build/MPE24.49-18)'] 125 | 126 | 127 | class Utils: 128 | def __init__(self): 129 | self.platform = platform.system() 130 | self.request = None 131 | self.secret = "aeffI" 132 | self.url = "https://api.vhack.cc/mobile/36/" 133 | self.Configuration = self.readConfiguration() 134 | self.numberLoop = 0 135 | self.account_info = None 136 | self.login = "0" 137 | 138 | try: 139 | self.username = str(self.Configuration["username"]).lstrip() 140 | self.password = str(self.Configuration["password"]).lstrip() 141 | self.debug = self.Configuration["debug"] 142 | self.show_info = self.Configuration["show_info"] 143 | self.sync_mobile = self.Configuration["sync_mobile"] 144 | self.attack_mode = self.Configuration["attack_mode"] 145 | self.update = self.Configuration["update"] 146 | self.msgremotelog = self.Configuration["msgLog"] 147 | self.timesleep = self.Configuration["timeSleep"] 148 | self.errorTime = self.Configuration["errorTime"] 149 | self.version = self.Configuration["version"] 150 | except KeyError as e: 151 | print("Error Configuration {}".format(e)) 152 | sys.exit() 153 | if self.username is None or self.password is None: 154 | print("please Change Username/Password to config.yml") 155 | sys.exit() 156 | self.user_agent = self.generateUA(self.username + self.password) 157 | self.all_data = [ 158 | ['Console Log vHackOS - by vBlackOut [https://github.com/vBlackOut]']] 159 | 160 | try: 161 | if self.sync_mobile: 162 | self.generateConfiguration( 163 | uID=self.Configuration["uID"], accessToken=self.Configuration["accessToken"]) 164 | else: 165 | self.generateConfiguration() 166 | except TypeError: 167 | self.generateConfiguration() 168 | 169 | try: 170 | self.accessToken = self.Configuration["accessToken"] 171 | if self.accessToken == "": 172 | self.accessToken = None 173 | except: 174 | self.accessToken = None 175 | 176 | try: 177 | self.uID = self.Configuration["uID"] 178 | if self.uID == "": 179 | self.uID = None 180 | except KeyError: 181 | self.uID = None 182 | 183 | def check_version(self): 184 | r = requests.get("https://raw.githubusercontent.com/OlympicCode/vHackOSBot-Python/master/config.yml") 185 | for line in r.iter_lines(): 186 | if "version:" in str(line): 187 | version = str(line).split(":")[1].replace("'", "") 188 | break 189 | 190 | if version.lstrip() != str(self.version.lstrip()): 191 | print("Please update your bot on github.") 192 | exit(1) 193 | 194 | def readConfiguration(self): 195 | # open configuration 196 | with open("config.yml", 'r') as stream: 197 | try: 198 | Configuration = yaml.load(stream, Loader=yaml.RoundTripLoader) 199 | except yaml.YAMLError as exc: 200 | self.viewsPrint("ErrorConfiguration", "{} [{}]".format( 201 | "Error in your config.yml please check in", exc)) 202 | sys.exit() 203 | 204 | if Configuration: 205 | return Configuration 206 | 207 | def result(self, result, code): 208 | self.viewsPrint( 209 | "showResult", "Error: {} code: {}".format(result, code)) 210 | 211 | def viewsPrint(self, condition, Msg): 212 | if condition == "ErrorRequest": 213 | self.add_error() 214 | if self.Configuration["debug"]: 215 | print(self.printConsole("\033[0;103m\033[1;30mOutputBot: {} - {}\033[0m".format( 216 | strftime("%Y-%m-%d %H:%M:%S", gmtime()), Msg))) 217 | else: 218 | return self.OutputTable("OutputBot: {} - {}".format(strftime("%Y-%m-%d %H:%M:%S", gmtime()), colored(condition, self.printConsole(Msg)).autocolored()), 2) 219 | 220 | if condition in self.Configuration["show_info"] or "All" in self.Configuration["show_info"]: 221 | if "!{}".format(condition) in self.Configuration["show_info"]: 222 | pass 223 | else: 224 | if self.Configuration["debug"]: 225 | print(self.printConsole("\033[0;103m\033[1;30mOutputBot: {} - {}\033[0m".format( 226 | strftime("%Y-%m-%d %H:%M:%S", gmtime()), Msg))) 227 | else: 228 | return self.OutputTable("OutputBot: {} - {}".format(strftime("%Y-%m-%d %H:%M:%S", gmtime()), colored(condition, self.printConsole(Msg)).autocolored()), 2) 229 | 230 | def exploit(self): 231 | try: 232 | return self.exploits 233 | except: 234 | return 0 235 | 236 | def account(self): 237 | time.sleep(random.uniform(0.2, 0.5)) 238 | try: 239 | return self.requestStringNowait("update.php", uID=self.uID, accesstoken=self.accessToken) 240 | except requests.exceptions.ReadTimeout: 241 | self.viewsPrint( 242 | "ErrorRequest", "Request Timeout... TimeOut connection") 243 | self.generateConfiguration(errorTime=int(time.time())) 244 | return None 245 | 246 | def OutputTable(self, msg, select_tables): 247 | if self.numberLoop < 6: 248 | self.numberLoop = self.numberLoop + 1 249 | else: 250 | self.numberLoop = 0 251 | 252 | if len(self.all_data) > 6: 253 | del self.all_data[-6] 254 | self.all_data.append([msg]) 255 | data = self.all_data 256 | 257 | if select_tables == 1: 258 | table = AsciiTable(data) 259 | print(table.table) 260 | 261 | elif select_tables == 2: 262 | try: 263 | self.account_info = self.requestString( 264 | "update.php", accesstoken=self.Configuration["accessToken"]) 265 | self.exploits = int(self.account_info["exploits"]) 266 | progress = round( 267 | int(self.account_info["exp"])) / round(int(self.account_info["expreq"])) 268 | 269 | self.account_info["money"] = '{:0,}'.format( 270 | int(self.account_info["money"])) 271 | self.account_info["netcoins"] = '{:0,}'.format( 272 | int(self.account_info["netcoins"])) 273 | 274 | account_information = [["your account information", "update information"], 275 | ["{0}: {1}\n{2}: {3}\n{4}: {5}\n{6}: {7}\n{8}: {9}\n{10}: {11}".format("Your exploits ", self.exploits, 276 | "Your spam ", self.account_info[ 277 | "spam"], 278 | "Your network speed ", self.account_info[ 279 | "inet"], 280 | "Your money ", self.account_info[ 281 | "money"], 282 | "Your IP ", self.account_info[ 283 | "ipaddress"], 284 | "Your netcoins ", self.account_info["netcoins"]), 285 | 286 | "{}: {}\n{}: {}\n{}: {}\n{}: {}\n{}: {}, XP({}%)".format("Your SDK ", self.account_info["sdk"], 287 | "Your Firewall ", self.account_info[ 288 | "fw"], 289 | "Your Antivirus ", self.account_info[ 290 | "av"], 291 | "Your BruteForce ", self.account_info[ 292 | "brute"], 293 | "Your level ", self.account_info["level"], round(progress * 100, 1))]] 294 | except (KeyError, requests.exceptions.ReadTimeout): 295 | account_information = [ 296 | ["your account information", "update information"], ["Error", "Error"]] 297 | 298 | table1 = SingleTable(data) 299 | table2 = SingleTable(account_information) 300 | time.sleep(random.uniform(0.1, 0.3)) 301 | if self.platform == "Linux": 302 | print("\033[H\033[J") 303 | else: 304 | os.system('cls') 305 | 306 | req_version = (3, 0) 307 | cur_version = sys.version_info 308 | # for windows Try to print tables else pass python 2 309 | try: 310 | print(table1.table) 311 | print(table2.table) 312 | if windows is False: 313 | sys.stdout.write("""\nCMD: [m] Get Miner info 314 | [a] Get All applications 315 | [q] Quit Program 316 | 317 | Waiting for user input : """) 318 | with raw_mode(sys.stdin): 319 | try: 320 | if cur_version <= req_version: 321 | while True: 322 | ch = sys.stdin.read(1) 323 | if ch == "a": 324 | p = Player(self) 325 | getTask = self.requestString( 326 | "tasks.php", accesstoken=self.Configuration["accessToken"]) 327 | sdk = p.getHelperApplication()[ 328 | "SDK"]["level"] 329 | ipsp = p.getHelperApplication()[ 330 | "IPSP"]["level"] 331 | bp = p.getHelperApplication()[ 332 | "BP"]["level"] 333 | brute = p.getHelperApplication()[ 334 | "BRUTE"]["level"] 335 | spam = p.getHelperApplication()[ 336 | "SPAM"]["level"] 337 | fw = p.getHelperApplication()[ 338 | "FW"]["level"] 339 | av = p.getHelperApplication()[ 340 | "AV"]["level"] 341 | sys.stdout.write("\n \ 342 | SDK: {} \ 343 | IPSP: {}\n \ 344 | Bank Protect: {} \ 345 | BruteForce: {}\n \ 346 | SPAM: {} \ 347 | Firewall: {}\n \ 348 | Antivirus: {}".format(sdk, ipsp, bp, brute, spam, fw, av)) 349 | 350 | time.sleep(0.5) 351 | if ch == "m": 352 | self.minefinish = int( 353 | self.account_info['minerLeft']) 354 | sys.stdout.write( 355 | "\nminerLeft {} in secondes".format(self.minefinish)) 356 | sys.stdout.write("\nwaiting until {} --- {}".format(self.tuntin( 357 | self.minefinish), datetime.timedelta(seconds=(self.minefinish)))) 358 | time.sleep(1) 359 | if ch == "q": 360 | sys.stdout.write( 361 | "\nok ok, good bye ;)\n") 362 | sys.exit() 363 | else: 364 | while True: 365 | ch = sys.stdin.read(1) 366 | if ch == "a": 367 | p = Player(self) 368 | getTask = self.requestString( 369 | "tasks.php", accesstoken=self.Configuration["accessToken"]) 370 | sdk = p.getHelperApplication()[ 371 | "SDK"]["level"] 372 | ipsp = p.getHelperApplication()[ 373 | "IPSP"]["level"] 374 | bp = p.getHelperApplication()[ 375 | "BP"]["level"] 376 | brute = p.getHelperApplication()[ 377 | "BRUTE"]["level"] 378 | spam = p.getHelperApplication()[ 379 | "SPAM"]["level"] 380 | fw = p.getHelperApplication()[ 381 | "FW"]["level"] 382 | av = p.getHelperApplication()[ 383 | "AV"]["level"] 384 | sys.stdout.write("\n \ 385 | SDK: {} \ 386 | IPSP: {}\n \ 387 | Bank Protect: {} \ 388 | BruteForce: {}\n \ 389 | SPAM: {} \ 390 | Firewall: {}\n \ 391 | Antivirus: {}".format(sdk, ipsp, bp, brute, spam, fw, av)) 392 | 393 | time.sleep(0.5) 394 | if str(ch) == "m": 395 | self.minefinish = int( 396 | self.account_info['minerLeft']) 397 | sys.stdout.write( 398 | "\nminerLeft {} in secondes".format(self.minefinish)) 399 | sys.stdout.write("\nwaiting until {} --- {}".format(self.tuntin( 400 | self.minefinish), datetime.timedelta(seconds=(self.minefinish)))) 401 | time.sleep(1) 402 | if ch == "q": 403 | sys.stdout.write( 404 | "\nok ok, good bye ;)\n") 405 | sys.exit() 406 | break 407 | except (KeyboardInterrupt, EOFError): 408 | pass 409 | except IOError as e: 410 | pass 411 | 412 | def tuntin(self, secs): 413 | st = (datetime.datetime.now() + datetime.timedelta(seconds=300)) 414 | return st.strftime('%H:%M:%S') 415 | 416 | def getPlatform(self): 417 | return self.platform 418 | 419 | def printConsole(self, txt): 420 | if self.platform == "Linux": 421 | return txt 422 | else: 423 | ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]') 424 | return ansi_escape.sub('', txt) 425 | 426 | def generateConfiguration(self, uID=False, accessToken=False, errorTime=False): 427 | # append uID/accessToken and other param in new configuration file. 428 | self.Configuration['username'] = self.username 429 | self.Configuration['password'] = self.password 430 | self.Configuration['debug'] = self.debug 431 | self.Configuration['show_info'] = self.show_info 432 | self.Configuration['sync_mobile'] = self.sync_mobile 433 | self.Configuration['attack_mode'] = self.attack_mode 434 | self.Configuration['update'] = self.update 435 | self.Configuration["msgLog"] = self.msgremotelog 436 | self.Configuration["timeSleep"] = self.timesleep 437 | self.Configuration["version"] = self.version 438 | 439 | if errorTime is not False: 440 | self.Configuration["errorTime"] = errorTime 441 | else: 442 | self.Configuration["errorTime"] = None 443 | 444 | # delete old file 445 | # os.remove("config.yml") 446 | 447 | try: 448 | self.Configuration['uID'] = uID 449 | except KeyError: 450 | self.Configuration['uID'] = self.uID 451 | 452 | try: 453 | self.Configuration['accessToken'] = accessToken 454 | except KeyError: 455 | self.Configuration['accessToken'] = self.accessToken 456 | 457 | if not self.Configuration['accessToken'] and not self.Configuration['uID']: 458 | self.request = requests.Session() 459 | self.request.headers.update({'User-agent': self.user_agent}) 460 | url = 'login.php' 461 | url_login = self.Login(url, self.username, self.password) 462 | 463 | try: 464 | result = self.request.get(url_login, timeout=5, verify=False) 465 | except requests.exceptions.ConnectTimeout: 466 | self.viewsPrint( 467 | "ErrorRequest", "Request Timeout... TimeOut connection '{}'".format(url)) 468 | sys.exit() 469 | 470 | except requests.exceptions.ReadTimeout: 471 | self.viewsPrint( 472 | "ErrorRequest", "Request Timeout... TimeOut connection {}".format(php)) 473 | sys.exit() 474 | 475 | except requests.exceptions.ConnectionError: 476 | self.viewsPrint( 477 | "ErrorRequest", "Request Timeout... Connection Error '{}'".format(url)) 478 | sys.exit() 479 | 480 | result.encoding = 'UTF-8' 481 | parseJson = result.json() 482 | 483 | check_return_server = self.CheckServerError(parseJson) 484 | if check_return_server: 485 | print("Server Error: [{}] {}".format( 486 | check_return_server[0], check_return_server[1])) 487 | return False 488 | 489 | self.accessToken = str(parseJson["accesstoken"]) 490 | self.uID = int(parseJson["uid"].encode("UTF-8")) 491 | 492 | self.Configuration.yaml_add_eol_comment( 493 | "# < Your Username Account", 'username', column=5) 494 | self.Configuration.yaml_add_eol_comment( 495 | "# < Your Password Account\n\n", 'password', column=5) 496 | self.Configuration.yaml_add_eol_comment( 497 | "# < debug mode\n\n", 'debug', column=5) 498 | self.Configuration.yaml_add_eol_comment( 499 | "# < show the return bot print information\n\n", 'show_info', column=5) 500 | self.Configuration.yaml_add_eol_comment( 501 | "# < If your are uID and accessToken and your phone bot use configuration for login please replace your uid and accesstoken sync to phone. (Recommended OFF)\n\n", 'sync_mobile', column=5) 502 | self.Configuration.yaml_add_eol_comment( 503 | "# < Automatically added uID for your account don't change /!\\", 'uID', column=5) 504 | self.Configuration.yaml_add_eol_comment( 505 | "# < Automatically added accessToken for your account don't change /!\\", 'accessToken', column=5) 506 | 507 | try: 508 | # for python 3 509 | with io.open('config.yml', 'w+') as outfile: 510 | yaml.dump(self.Configuration, stream=outfile, default_flow_style=False, 511 | Dumper=yaml.RoundTripDumper, indent=4, block_seq_indent=1) 512 | except: 513 | # for python 2 514 | with io.open('config.yml', 'wb') as outfile: 515 | yaml.dump(self.Configuration, stream=outfile, default_flow_style=False, 516 | Dumper=yaml.RoundTripDumper, indent=4, block_seq_indent=1) 517 | 518 | self.request = None 519 | 520 | else: 521 | 522 | self.Configuration.yaml_add_eol_comment( 523 | "# < Your Username Account", 'username', column=5) 524 | self.Configuration.yaml_add_eol_comment( 525 | "# < Tour Password Account\n\n", 'password', column=5) 526 | self.Configuration.yaml_add_eol_comment( 527 | "# < debug mode dev online\n\n", 'debug', column=5) 528 | self.Configuration.yaml_add_eol_comment( 529 | "# < show the return bot print information\n\n", 'show_info', column=5) 530 | self.Configuration.yaml_add_eol_comment( 531 | "# < If your are uID and accessToken and your phone bot use configuration for login please replace your uid and accesstoken sync to phone. (Recommended OFF)\n\n", 'sync_mobile', column=5) 532 | self.Configuration.yaml_add_eol_comment( 533 | "# < Automatically added uID for your account don't change /!\\", 'uID', column=5) 534 | self.Configuration.yaml_add_eol_comment( 535 | "# < Automatically added accessToken for your account don't change /!\\", 'accessToken', column=5) 536 | 537 | try: 538 | # for python 3 539 | with io.open('config.yml', 'w+') as outfile: 540 | yaml.dump(self.Configuration, stream=outfile, default_flow_style=False, 541 | Dumper=yaml.RoundTripDumper, indent=4, block_seq_indent=1) 542 | except: 543 | # for python 2 544 | with io.open('config.yml', 'wb') as outfile: 545 | yaml.dump(self.Configuration, stream=outfile, default_flow_style=False, 546 | Dumper=yaml.RoundTripDumper, indent=4, block_seq_indent=1) 547 | 548 | def add_error(self): 549 | self.remove_error() 550 | with open("config.yml", "a") as file: 551 | file.write("errorTime: {}".format(int(time.time()) + 600)) 552 | 553 | def remove_error(self): 554 | with open('config.yml', 'r+') as f: 555 | f.seek(0, os.SEEK_END) 556 | while f.tell() and f.read(1) != '\n': 557 | f.seek(-2, os.SEEK_CUR) 558 | f.truncate() 559 | 560 | def generateUA(self, identifier): 561 | pick = int(self.md5hash(identifier), 16) 562 | user_agents = tuple(USER_AGENT) 563 | return user_agents[pick % len(user_agents)] 564 | 565 | def getTime(self): 566 | return int(round(time.time())) 567 | 568 | def md5hash(self, txt): 569 | m = hashlib.md5() 570 | m.update(txt.encode('utf-8')) 571 | return m.hexdigest() 572 | 573 | def generateUser(self, bArr): 574 | b64 = base64.urlsafe_b64encode(bArr.encode('UTF-8')).decode('ascii') 575 | return b64.replace("=", "") 576 | 577 | def Login(self, php, username, password): 578 | 579 | passmd5 = self.md5hash(password) 580 | jsonString = {'username': username, 'password': passmd5} 581 | jsonString = json.dumps(jsonString, separators=(',', ':')) 582 | 583 | str8 = self.md5hash("{}{}{}".format(jsonString, jsonString, 584 | self.md5hash(jsonString))) 585 | 586 | return "{}{}?user={}&pass={}".format(self.url, php, 587 | self.generateUser(jsonString), str8) 588 | 589 | def generateURL(self, uid, php, **kwargs): 590 | jsonString = kwargs 591 | jsonString.update( 592 | {'uid': str(self.uID), 'accesstoken': str(self.accessToken)}) 593 | jsonString.pop("debug", None) 594 | jsonString = json.dumps(jsonString, default=set_default) 595 | str8 = self.md5hash("{}{}{}".format(jsonString, jsonString, 596 | self.md5hash(jsonString))) 597 | 598 | return "{}{}?user={}&pass={}".format(self.url, php, self.generateUser(jsonString), str8) 599 | 600 | def CheckServerError(self, code_return): 601 | try: 602 | code_return = code_return["result"] 603 | except (TypeError, IndexError): 604 | code_return = "0" 605 | 606 | t = None 607 | if code_return == u"5": 608 | t = (5, "Check your Internet Connection.") 609 | elif code_return == u"2": 610 | t = (8, "User/Password wrong!") 611 | elif code_return == u"10": 612 | t = (10, "API is updated.") 613 | elif code_return == u"15": 614 | t = (10, "You are banned sorry :(") 615 | elif code_return == u"99": 616 | t = (99, "Server is down for Maintenance, please be patient.") 617 | return t 618 | 619 | def requestString(self, php, **kwargs): 620 | # print("Request: {}, {}".format(php, self.uID)) 621 | self.user_agent = self.generateUA( 622 | "test{}test".format(random.randint(1, 9999))) 623 | try: 624 | if kwargs["debug"] is True: 625 | time.sleep(self.timesleep) 626 | http_client.HTTPConnection.debuglevel = 0 627 | # You must initialize logging, otherwise you'll not see debug output. 628 | logging.basicConfig() 629 | logger = logging.getLogger().setLevel(logging.DEBUG) 630 | requests_log = logging.getLogger("requests.packages.urllib3") 631 | requests_log.setLevel(logging.DEBUG) 632 | requests_log.propagate = True 633 | coloredlogs.install(level='DEBUG') 634 | coloredlogs.install(level='DEBUG', logger=requests_log) 635 | 636 | except KeyError: 637 | kwargs["debug"] = self.debug 638 | if kwargs["debug"] is True: 639 | time.sleep(self.timesleep) 640 | http_client.HTTPConnection.debuglevel = 0 641 | # You must initialize logging, otherwise you'll not see debug output. 642 | logging.basicConfig() 643 | logger = logging.getLogger().setLevel(logging.DEBUG) 644 | requests_log = logging.getLogger("requests.packages.urllib3") 645 | requests_log.setLevel(logging.DEBUG) 646 | requests_log.propagate = True 647 | coloredlogs.install(level='DEBUG') 648 | coloredlogs.install(level='DEBUG', logger=requests_log) 649 | 650 | time.sleep(random.uniform(0.5, 1)) 651 | i = 0 652 | while True: 653 | if i > 10: 654 | self.viewsPrint( 655 | "ErrorRequest", "Request Timeout... TimeOut connection {}".format(php)) 656 | sys.exit() 657 | 658 | try: 659 | self.uID 660 | self.accessToken 661 | self.request 662 | self.sync_mobile 663 | except AttributeError: 664 | print("\nError - Your account blocked. please wait") 665 | try: 666 | error_time = self.errorTime - int(time.time()) 667 | except: 668 | error_time = 600 669 | 670 | if error_time > 0: 671 | for remaining in range(error_time, 0, -1): 672 | sys.stdout.write("\r") 673 | sys.stdout.write( 674 | "{:2d} seconds remaining. number retry ({})".format(remaining, i)) 675 | sys.stdout.flush() 676 | time.sleep(1) 677 | self.add_error() 678 | self.remove_error() 679 | 680 | i = i + 1 681 | python = sys.executable 682 | os.execl(python, python, * sys.argv) 683 | return False 684 | 685 | if self.uID is None or self.accessToken is None or self.request is None and self.sync_mobile is False: 686 | # connect login. 687 | self.request = requests.Session() 688 | self.request.headers.update({'User-agent': self.user_agent}) 689 | url_login = self.Login( 690 | 'login.php', self.username, self.password) 691 | try: 692 | time.sleep(self.timesleep) 693 | result = self.request.get( 694 | url_login, timeout=5, verify=False) 695 | 696 | except requests.exceptions.ConnectTimeout: 697 | self.viewsPrint( 698 | "ErrorRequest", "Request Timeout... TimeOut connection {}".format(php)) 699 | 700 | except requests.exceptions.ReadTimeout: 701 | self.viewsPrint( 702 | "ErrorRequest", "Request Timeout... TimeOut connection {}".format(php)) 703 | 704 | except requests.exceptions.ConnectionError: 705 | self.viewsPrint("ErrorRequest", "Request Timeout... Connection Error '{}' with code: [{}]".format( 706 | 'login.php', url_login.status_code)) 707 | 708 | result.encoding = 'UTF-8' 709 | parseJson = result.json() 710 | 711 | check_return_server = self.CheckServerError(parseJson) 712 | 713 | if check_return_server: 714 | print("Server Error: [{}] {}".format( 715 | check_return_server[0], check_return_server[1])) 716 | return False 717 | 718 | self.accessToken = str(parseJson["accesstoken"]) 719 | self.uID = int(parseJson["uid"].encode("UTF-8")) 720 | global login 721 | self.login = "1" 722 | 723 | self.generateConfiguration(self.uID, self.accessToken) 724 | 725 | # Create First request. 726 | try: 727 | result = self.request.get(self.generateURL( 728 | self.uID, php, **kwargs), timeout=5) 729 | except requests.exceptions.ConnectTimeout: 730 | self.viewsPrint( 731 | "ErrorRequest", "Request Timeout... TimeOut connection {}".format(php)) 732 | 733 | except requests.exceptions.ReadTimeout: 734 | self.viewsPrint( 735 | "ErrorRequest", "Request Timeout... TimeOut connection {}".format(php)) 736 | 737 | except requests.exceptions.ConnectionError: 738 | self.viewsPrint("ErrorRequest", "Request Timeout... Connection Error '{}' with code: [{}]".format( 739 | php, url_login.status_code)) 740 | 741 | if kwargs["debug"] is True: 742 | logging.info(result.json()) 743 | 744 | elif self.uID is not None or self.accessToken is not None: 745 | #request = requests.Session() 746 | if not self.request: 747 | self.request = requests.Session() 748 | 749 | self.request.headers.update({'User-agent': self.user_agent}) 750 | 751 | if self.sync_mobile is True: 752 | if self.login is "0": 753 | self.login = "1" 754 | self.request.get(self.generateURL( 755 | self.uID, 'update.php', accesstoken=self.accessToken, lang="fr", lastread="0"), timeout=3) 756 | 757 | # return just request don't login before. 758 | try: 759 | result = self.request.get(self.generateURL( 760 | self.uID, php, **kwargs), timeout=5) 761 | except requests.exceptions.ConnectTimeout: 762 | self.viewsPrint( 763 | "BadRequest", "Request Timeout... TimeOut connection {}".format(php)) 764 | 765 | except requests.exceptions.ReadTimeout: 766 | self.viewsPrint( 767 | "ErrorRequest", "Request Timeout... TimeOut connection {}".format(php)) 768 | 769 | except requests.exceptions.ConnectionError: 770 | self.viewsPrint( 771 | "BadRequest", "Request Timeout... Connection Error '{}'".format(php)) 772 | 773 | result.encoding = 'UTF-8' 774 | try: 775 | parseJson = result.json() 776 | result = True 777 | except ValueError: 778 | self.viewsPrint( 779 | "ErrorJson", "Closing bot upon bad request...") 780 | time.sleep(5) 781 | 782 | try: 783 | self.accessToken = str(parseJson["accesstoken"]) 784 | except (KeyError, UnboundLocalError): 785 | pass 786 | 787 | i = i + 1 788 | if kwargs["debug"] is True: 789 | logging.info(parseJson) 790 | 791 | if result: 792 | break 793 | 794 | if parseJson["result"] is not None or len(parseJson) > 1: 795 | return parseJson 796 | else: 797 | self.viewsPrint( 798 | "BadRequest", "/!\ Block Script your credential as changed") 799 | exit(1) 800 | 801 | def requestStringNowait(self, php, **kwargs): 802 | # print("Request: {}, {}".format(php, self.uID)) 803 | self.user_agent = self.generateUA("testtest") 804 | try: 805 | if kwargs["debug"] is True: 806 | http_client.HTTPConnection.debuglevel = 0 807 | # You must initialize logging, otherwise you'll not see debug output. 808 | logging.basicConfig() 809 | logger = logging.getLogger().setLevel(logging.DEBUG) 810 | requests_log = logging.getLogger("requests.packages.urllib3") 811 | requests_log.setLevel(logging.DEBUG) 812 | requests_log.propagate = True 813 | coloredlogs.install(level='DEBUG') 814 | coloredlogs.install(level='DEBUG', logger=requests_log) 815 | 816 | except KeyError: 817 | kwargs["debug"] = self.debug 818 | if kwargs["debug"] is True: 819 | http_client.HTTPConnection.debuglevel = 0 820 | # You must initialize logging, otherwise you'll not see debug output. 821 | logging.basicConfig() 822 | logger = logging.getLogger().setLevel(logging.DEBUG) 823 | requests_log = logging.getLogger("requests.packages.urllib3") 824 | requests_log.setLevel(logging.DEBUG) 825 | requests_log.propagate = True 826 | coloredlogs.install(level='DEBUG') 827 | coloredlogs.install(level='DEBUG', logger=requests_log) 828 | 829 | i = 0 830 | while True: 831 | if i > 10: 832 | break 833 | if self.uID is None or self.accessToken is None or self.request is None and self.sync_mobile is False: 834 | # connect login. 835 | self.request = requests.Session() 836 | self.request.headers.update({'User-agent': self.user_agent}) 837 | url_login = self.Login( 838 | 'login.php', self.username, self.password) 839 | try: 840 | result = self.request.get( 841 | url_login, timeout=3, verify=False) 842 | except requests.exceptions.ConnectTimeout: 843 | self.viewsPrint( 844 | "ErrorRequest", "Request Timeout... TimeOut connection {}".format(php)) 845 | 846 | except requests.exceptions.ReadTimeout: 847 | self.viewsPrint( 848 | "ErrorRequest", "Request Timeout... TimeOut connection {}".format(php)) 849 | 850 | except requests.exceptions.ConnectionError: 851 | self.viewsPrint("ErrorRequest", "Request Timeout... Connection Error '{}' with code: [{}]".format( 852 | 'login.php', url_login.status_code)) 853 | 854 | result.encoding = 'UTF-8' 855 | parseJson = result.json() 856 | 857 | check_return_server = self.CheckServerError(parseJson) 858 | if check_return_server: 859 | print("Server Error: [{}] {}".format( 860 | check_return_server[0], check_return_server[1])) 861 | return False 862 | 863 | self.accessToken = str(parseJson["accesstoken"]) 864 | self.uID = int(parseJson["uid"].encode("UTF-8")) 865 | global login 866 | self.login = "1" 867 | 868 | self.generateConfiguration(self.uID, self.accessToken) 869 | 870 | # Create First request. 871 | try: 872 | result = self.request.get(self.generateURL( 873 | self.uID, php, **kwargs), timeout=5) 874 | except requests.exceptions.ConnectTimeout: 875 | self.viewsPrint( 876 | "ErrorRequest", "Request Timeout... TimeOut connection {}".format(php)) 877 | 878 | except requests.exceptions.ReadTimeout: 879 | self.viewsPrint( 880 | "ErrorRequest", "Request Timeout... TimeOut connection {}".format(php)) 881 | 882 | except requests.exceptions.ConnectionError: 883 | self.viewsPrint("ErrorRequest", "Request Timeout... Connection Error '{}' with code: [{}]".format( 884 | php, url_login.status_code)) 885 | 886 | if kwargs["debug"] is True: 887 | logging.info(result.json()) 888 | 889 | elif self.uID is not None or self.accessToken is not None: 890 | #request = requests.Session() 891 | if not self.request: 892 | self.request = requests.Session() 893 | 894 | self.request.headers.update({'User-agent': self.user_agent}) 895 | 896 | if self.sync_mobile is True: 897 | if self.login is "0": 898 | self.login = "1" 899 | self.request.get(self.generateURL( 900 | self.uID, 'update.php', accesstoken=self.accessToken, lang="fr", lastread="0"), timeout=3) 901 | 902 | # return just request don't login before. 903 | try: 904 | result = self.request.get(self.generateURL( 905 | self.uID, php, **kwargs), timeout=5) 906 | 907 | except requests.exceptions.ConnectTimeout: 908 | self.viewsPrint( 909 | "ErrorRequest", "Request Timeout... TimeOut connection {}".format(php)) 910 | 911 | except requests.exceptions.ReadTimeout: 912 | self.viewsPrint( 913 | "ErrorRequest", "Request Timeout... TimeOut connection {}".format(php)) 914 | 915 | except requests.exceptions.ConnectionError: 916 | self.viewsPrint("ErrorRequest", "Request Timeout... Connection Error '{}' with code: [{}]".format( 917 | php, url_login.status_code)) 918 | 919 | result.encoding = 'UTF-8' 920 | try: 921 | parseJson = result.json() 922 | except: 923 | time.sleep(random.uniform(0.5, 1.5)) 924 | result = self.request.get(self.generateURL( 925 | self.uID, php, **kwargs), timeout=5) 926 | result.encoding = 'UTF-8' 927 | parseJson = result.json() 928 | 929 | try: 930 | self.accessToken = str(parseJson["accesstoken"]) 931 | except (KeyError, UnboundLocalError): 932 | pass 933 | 934 | i = i + 1 935 | if kwargs["debug"] is True: 936 | logging.info(result.json()) 937 | return parseJson 938 | 939 | 940 | class Player(): 941 | def __init__(self, ut): 942 | self.ut = ut 943 | self.Configuration = self.ut.readConfiguration() 944 | self.getStore = self.ut.requestString("store.php", 945 | accesstoken=self.Configuration["accessToken"], lang="en") 946 | 947 | def getApplication(self): 948 | Dict_request = self.getStore["apps"] 949 | ApplicationCount = [] 950 | 951 | for ApplicationUp in enumerate(Dict_request): 952 | Application = {} 953 | try: 954 | Application["baseprice"] = ApplicationUp[1]["baseprice"] 955 | Application["level"] = ApplicationUp[1]["level"] 956 | Application["price"] = ApplicationUp[1]["price"] 957 | Application["factor"] = ApplicationUp[1]["factor"] 958 | Application["maxlvl"] = ApplicationUp[1]["maxlvl"] 959 | Application["running"] = ApplicationUp[1]["running"] 960 | Application["appid"] = ApplicationUp[1]["appid"] 961 | Application["require"] = ApplicationUp[1]["require"] 962 | 963 | except KeyError as e: 964 | Application["baseprice"] = None 965 | Application["level"] = ApplicationUp[1]["level"] 966 | Application["price"] = ApplicationUp[1]["price"] 967 | Application["factor"] = None 968 | Application["maxlvl"] = ApplicationUp[1]["maxlvl"] 969 | Application["running"] = None 970 | Application["appid"] = ApplicationUp[1]["appid"] 971 | Application["require"] = ApplicationUp[1]["require"] 972 | 973 | ApplicationCount.append(Application) 974 | 975 | return ApplicationCount 976 | 977 | def getHelperApplication(self): 978 | Application = self.getApplication() 979 | FinalApplication = {} 980 | 981 | for allApplication in Application: 982 | # antivirus 983 | if int(allApplication["appid"]) == 1: 984 | FinalApplication["AV"] = allApplication 985 | 986 | # firewall 987 | if int(allApplication["appid"]) == 2: 988 | FinalApplication["FW"] = allApplication 989 | 990 | # spam 991 | if int(allApplication["appid"]) == 3: 992 | FinalApplication["SPAM"] = allApplication 993 | 994 | # brute force 995 | if int(allApplication["appid"]) == 4: 996 | FinalApplication["BRUTE"] = allApplication 997 | 998 | # banque protecte 999 | if int(allApplication["appid"]) == 5: 1000 | FinalApplication["BP"] = allApplication 1001 | 1002 | # Software developement kit 1003 | if int(allApplication["appid"]) == 6: 1004 | FinalApplication["SDK"] = allApplication 1005 | 1006 | if int(allApplication["appid"]) == 7: 1007 | pass 1008 | #FinalApplication[""] = allApplication 1009 | 1010 | if int(allApplication["appid"]) == 8: 1011 | pass 1012 | #FinalApplication[""] = allApplication 1013 | 1014 | if int(allApplication["appid"]) == 9: 1015 | pass 1016 | #FinalApplication[""] = allApplication 1017 | 1018 | if int(allApplication["appid"]) == 10: 1019 | FinalApplication["IPSP"] = allApplication 1020 | 1021 | if int(allApplication["appid"]) == 11: 1022 | pass 1023 | #FinalApplication[""] = allApplication 1024 | 1025 | if int(allApplication["appid"]) == 12: 1026 | pass 1027 | #FinalApplication[""] = allApplication 1028 | 1029 | if int(allApplication["appid"]) == 13: 1030 | pass 1031 | #FinalApplication[""] = allApplication 1032 | 1033 | if int(allApplication["appid"]) == 14: 1034 | pass 1035 | #FinalApplication[""] = allApplication 1036 | 1037 | if int(allApplication["appid"]) == 15: 1038 | pass 1039 | #FinalApplication[""] = allApplication 1040 | 1041 | return FinalApplication 1042 | --------------------------------------------------------------------------------