Example #1
0
 def do_get(self, args):
     '''Get variable value: get proto'''
     variable = args.split(" ")[0].lower()
     if variable.lower() in self.all_values:
         print(variable + ": " + str(self.all_values[variable]))
     else:
         print_error(variable + " is not valid")
Example #2
0
 def print_procs(self, ws):
     last = ""
     ws = sorted(ws, key=lambda x: x.get_proto())
     for w in ws:
         if type(w) is int:
             print_error("An INT was found as a WARRIOR, TAKE A LOOK!")
             continue
         if last != w.get_proto():
             print()
             print(colored(w.get_proto(), 'blue', attrs=['reverse',
                                                         'bold']))
         last = w.get_proto()
         procs, ch = w.get_procs_info()
         procs = sorted(procs, key=lambda x: x["name"])
         for p in procs:
             if p["proc"].is_alive():
                 print(
                     colored(p["name"] + ": ",
                             'yellow',
                             attrs=['blink', 'bold']) + p["cmd"])
             else:
                 print(
                     colored(p["name"] + ": ", 'green', attrs=['bold']) +
                     p["cmd"])
         if ch:
             print(
                 colored(
                     "Command require sequencial object, waiting for execute next commnad...",
                     'red',
                     attrs=['bold']))
Example #3
0
 def do_unset(self, args):
     '''Set variable to null'''
     if len(args.split(" ")) < 1:
         print_error("unset <variable>")
     else:
         variable = args.split(" ")[0].lower()
         if variable.lower() in self.all_values:
             self.all_values[variable] = ""
             print(colored(variable.capitalize(), "blue", attrs=['bold']) + ": " + colored("Null", "magenta", attrs=['bold']))
         else:
             print_error(variable + " is not valid")
Example #4
0
    def do_run(self, _):
        '''Execute the confiured protocol attack'''
        self.priv_values["protohelp"] = False
        self.update_executed()
        warrior = self.initW()

        if warrior != -1:  # If -1, then something went wrong creating the warrior
            self.ws.append(warrior)
            thread = Thread(target=warrior.run)
            thread.start()
        else:
            print_error("Something went wrong, nothing is going to be executed")
Example #5
0
    def do_exec(self, args):
        '''Execute the indicated cmd'''
        if len(args.split(" ")) < 1:
            print_error("exec <CMDname>")
        cmd = args.split(" ")[0].lower()
        self.priv_values["exec"] = cmd
        warrior = self.initW()
        self.priv_values["exec"] = ""

        if warrior != -1:  # If -1, then something went wrong creating the warrior
            self.ws.append(warrior)
            thread = Thread(target=warrior.run)
            thread.start()
        else:
            print_error(
                "Something went wrong, nothing is going to be executed")
Example #6
0
 def do_set(self, args):
     '''Set variable value: set proto http'''
     if len(args.split(" ")) < 2:
         print_error("set <variable> <value>")
     else:
         variable = args.split(" ")[0].lower()
         value = args.split(" ")[1].strip()
         if variable == "proto" and value.lower() not in valid_protos:
             print_error("Not valid protocol: "+value)
         elif variable in ["port", "intensity"] and not value.isdigit():
             print_error("Please set a number: "+value)
         elif variable in ["reexec", "verbose"] and not value.lower() in ["true", "false"]:
             print_error("Please set a boolean(true or false): "+value)
         elif variable.lower() in self.all_values:
             value = value if not value.lower() in ["true", "false"] else (True if value.lower() == "true" else False)
             self.all_values[variable] = value
             print(colored(variable.capitalize(), "blue", attrs=['bold']) + ": " + colored(str(value), "yellow", attrs=['bold']))
         else:
             print_error(variable + " is not valid")
Example #7
0
 def do_set(self, args):
     '''Set variable value: set proto http'''
     if len(args.split(" ")) < 2:
         print_error("set <variable> <value>")
     else:
         variable = args.split(" ")[0].lower()
         value = args.split(" ")[1]
         if variable == "proto" and value.lower() not in valid_protos:
             print_error("Not valid protocol: "+value)
         elif variable.lower() in self.all_values:
             value = value if not value.lower() in ["true", "false"] else (True if value.lower() == "true" else False)
             self.all_values[variable] = value
             print(colored(variable.capitalize(), "blue", attrs=['bold']) + ": " + colored(str(value), "yellow", attrs=['bold']))
         else:
             print_error(variable + " is not valid")