Example #1
0
    def do_set(self, line):
        """Sets a settable parameter.

                Accepts abbreviated parameter names so long as there is no ambiguity.
                Call without arguments for a list of settable parameters with their values.
                Command can be used to set parameter of active module, payload, device or 
                global options.
                
                To set custom payload see help payload: 
        """
        out = Cmd.do_set(self, line)
        if len(line.split()) >= 2:
            pname = line.split()[0]
            pvalue = line.split()[1]
            if pname == "payload":
                self.modules[self.active_module].payload = self.payload
                self.modules[self.active_module].payload_custom = True
                self.prompt = Cmd().colorize("HID [", "green") + \
                              Cmd().colorize(self.active_module, "red") + \
                              "(" + \
                              (Cmd().colorize("custom", "blue") if self.modules[
                                  self.active_module].payload_custom else Cmd().colorize(self.active_payload, "blue")) + \
                              ")" + \
                              (" @ " + Cmd().colorize(self.active_device,
                                                      "red") if self.active_device != None else "") + \
                              Cmd().colorize("] > ", "green")

            elif pname in self.current_parameters["module"]:
                self.modules[self.active_module].parameters[pname]["value"] = getattr(self, pname)
            elif pname in self.current_parameters["device"]:
                action_manager.device_map[self.active_device].parameters[pname]["value"] = getattr(self, pname)
            elif pname in self.current_parameters["payload"]:
                self.payloads[self.active_payload].parameters[pname]["value"] = getattr(self, pname)
        return out
Example #2
0
 def do_set(self, argString):
     args = argString.split()
     if len(args) != 2:
         print("*** Invalid number of arguments")
         self.help_set()
     else:
         if args[0] == "debug":
             Cmd.do_set(self, argString)
         elif args[0] == "host_mac":
             attrValue = self.strToHex(args[1])
         else:
             attrValue = args[1]
         if self.FENRIR.setAttribute(args[0], attrValue) == False:
             print("*** Invalid argument")
             self.help_set()
         else:
             print(args[0] + " ===> " + args[1])