Esempio n. 1
0
 def intern():
     self.techniqueStr = self.techniqueDialog.payloadSelectInput.text()
     error = False
     if self.techniqueStr.strip().lower() == "a":
         self.selection = list(range(1, len(rce.items()) + 1))
         self.techniqueDialog.close()
     else:
         try:
             for i in self.techniqueStr.split(","):
                 technique = int(i.strip())
                 if technique not in range(1, len(rce.items()) + 1):
                     error = True
                 elif technique not in self.selection:
                     self.selection.append(technique)
             if error:
                 self.show_error("Invalid Selection string.")
                 self.selection = []
             else:
                 self.techniqueDialog.close()
         except Exception:
             self.show_error("Invalid Selection string.")
Esempio n. 2
0
def select_techniques():
    """
    select techniques to use in RCE module
    @return:
        selected techniques, as a list
    """
    techniques = []
    invalid = True
    print_techniques()
    while invalid:
        selected = input(
            "{0}[?]{1}{3}{4}{1}{0}|{1}{5}{0} {7}{1} {2}{6}{1} :> ".format(
                color.RD,
                color.END,
                color.CURSIVE,
                color.O,
                " Techniques",
                "Select indices\n",
                "comma-separated",
                lines.SW,
            ))
        try:
            error = False
            if selected.strip().lower() == "a":
                return list(range(1, len(rce.items()) + 1))
            for i in selected.split(","):
                technique = int(i.strip())
                if technique not in range(1, len(rce.items()) + 1):
                    error = True
                elif technique not in techniques:
                    techniques.append(technique)
            if techniques and not error:
                invalid = False
            else:
                techniques = []
        except Exception:
            pass

    return techniques