def use_device(self, line): if not action_manager.filter_supported_modules( action_manager.device_map[line.split()[1]], {self.active_module: self.modules[self.active_module]} ): various.print_warning("device not supporting selected module") return self.active_device = line.split()[1] # clear settables for x in self.current_parameters["device"]: self.settable.pop(x) self.current_parameters["device"] = [] for name, p in six.iteritems(action_manager.device_map[self.active_device].parameters): if "value" not in p: p["value"] = p["default"] setattr(self, name, p["value"]) self.current_parameters["device"].append(name) self.settable[name] = "" self.prompt = Cmd().colorize("HID [", "green") + \ Cmd().colorize(self.active_module, "red") + \ ("(" + Cmd().colorize(self.active_payload, "blue") + ")" if self.active_payload != None else "") + \ " @ " + \ Cmd().colorize(self.active_device, "red") + \ Cmd().colorize("] > ", "green")
def do_list_devices(self, line): """List all loaded devices with short description and modules able to use them. Usage: Just type list_devices without arguments to see what was loaded. """ print "Loaded devices: " for d in action_manager.get_all_devices_str(): print " - %s: %s [%s] " % (self.colorize(d,"blue"), action_manager.device_map[d].short_description, ",".join([ str(x) for x in action_manager.filter_supported_modules(action_manager.device_map[d], self.modules)]) )
def do_list_payloads(self, line): """List all loaded payloads with short description and modules able to use them. Usage: Just type list_payloads without arguments to see what was loaded. """ print "Loaded payloads: " for p in self.payloads: print " - %s: %s [%s] " % (self.colorize(p,"blue"), self.payloads[p].short_description, ",".join([ str(x) for x in action_manager.filter_supported_modules(self.payloads[p], self.modules)]) )
def use_payload(self,line): if not action_manager.filter_supported_modules( self.payloads[line.split()[1]], { self.active_module:self.modules[self.active_module] } ): various.print_warning("payload not supporting selected module") return self.active_payload = line.split()[1] # clear settables for x in self.current_parameters["payload"]: Cmd.settable.pop(x) self.current_parameters["payload"] = [] for name,p in self.payloads[self.active_payload].parameters.iteritems(): if "value" not in p: p["value"]=p["default"] setattr(self,name,p["value"]) self.current_parameters["payload"].append(name) Cmd.settable.append(name) self.modules[self.active_module].loaded_payload=line.split()[1] self.prompt = Cmd().colorize("HID [","green")+ \ Cmd().colorize(self.active_module,"red")+ \ "("+Cmd().colorize(self.active_payload,"blue")+")"+ \ (" @ "+Cmd().colorize(self.active_device,"red") if self.active_device!=None else "")+ \ Cmd().colorize("] > ","green") self.modules[self.active_module].payload_custom = False