def do_GET(self): force_download = False if self.path.split('/')[1] == 'api': server_api = ServerApi(self.config, self) self.output = server_api.process() self.return_json() return path = self.path.split('/')[-1] payload_path = self.path.split('/') filename = Utils.gen_str(12) if payload_path[1] == self.config.get('http-download-path'): filename = Utils.gen_str(12) force_download = True Log.log_event('Download Stager', 'Stager was fetched from %s (%s)' % (self.client_address[0], self.address_string())) payload = Payload(self.config) payload.set_callback("__default__") if len(payload_path) > 3: payload.set_type(payload_path[2]) if len(payload_path) > 4: payload.set_delay(payload_path[3]) payload.set_callback(payload_path[4]) self.output = payload.get_output() elif path in Utils.get_download_folder_content(): force_download = True self.output = Utils.load_file('download/%s' % path) Log.log_event('Download File', '%s was downloaded from %s (%s)' % (path, self.client_address[0], self.address_string())) else: self.output = Utils.load_file('html/%s' % self.config.get('http-default-404')) Log.log_error('Invalid request got a GET request', self.path) self.return_data(force_download, filename)
def do_GET(self): force_download = False if self.path.split("/")[1] == "api": server_api = ServerApi(self.config, self) self.output = server_api.process() self.return_json() return path = self.path.split("/")[-1] payload_path = self.path.split("/") filename = Utils.gen_str(12) if payload_path[1] == self.config.get("http-download-path"): force_download = True extension = "ps1" payload = Payload(self.config) payload.set_callback("__default__") profile = self.config.get("profile") if profile.get("domain-fronting") == "on": payload.set_fronting(profile.get("domain-fronting-host")) if len(payload_path) > 3: payload.set_type(payload_path[2]) extension = payload_path[2] if extension == "exe-old": extension = "exe" if len(payload_path) > 4: payload.set_delay(payload_path[3]) payload.set_callback(payload_path[4]) filename = "%s.%s" % (Utils.gen_str(12), extension) Log.log_event( "Download Stager", "Stager was fetched from %s (%s). Stager type is %s" % (self.client_address[0], self.address_string(), extension)) self.output = payload.get_output() elif path in Utils.get_download_folder_content(): force_download = True self.output = Utils.load_file("download/%s" % path) Log.log_event( "Download File", "%s was downloaded from %s (%s)" % (path, self.client_address[0], self.address_string())) else: self.output = Utils.load_file( "html/%s" % self.config.get("http-default-404")) Log.log_error("Invalid request got a GET request", self.path) self.return_data(force_download, filename)