Ejemplo n.º 1
0
def command_reload(text=False):
    global modules
    modules = db.index_modules()
    status("Database updated! ( {} module(s) loaded now )".format(
        len(modules)))
    utils.Input_completer(
        all_keywords +
        utils.my_map(lambda x: utils.pythonize(x).split(".")[-1], modules))
Ejemplo n.º 2
0
def Exec(all_keywords):
    global global_options, module_keywords, cli_keywords
    module_keywords += all_keywords
    cli_keywords = all_keywords
    mod = importlib.import_module(
        utils.pythonize("core.modules." + Settings.running_module))
    global_options = getattr(mod, 'execution').module_type.options
    if os.name != "nt":
        utils.Input_completer(module_keywords + modules)
    Settings.add_module(Settings.running_module)
Ejemplo n.º 3
0
def start(rc=False):

    myinput = input
    utils.Input_completer(all_keywords + modules)

    while True:
        if sys.stdin.closed or sys.stdout.closed:
            exit(0)
        try:
            name = Settings.name
            if rc:
                cmd_to_run = rc
                print("\n" + name + G + " > " + end + cmd_to_run)
            else:
                cmd_to_run = myinput("\n" + name + G + " > " + end)

            cmd_to_run = cmd_to_run.strip()

            for c in cmd_to_run.split(";"):
                for char in chars_filter:
                    c = c.replace(chars_filter[char], char)  # Yeah reversing
                if len(cmd_to_run.split(";")) > 1:
                    print(G + " > " + end + c)
                if Settings.running_module:
                    module.handle(c)
                    continue

                head = c.lower().split()[0]
                args = " ".join(c.split()[1:])

                if head == 'exit':
                    if Settings.headless_browser:
                        Settings.headless_browser.close_all()
                        Settings.headless_browser = None
                    exit(0)

                command_handler(c)

        except KeyboardInterrupt:
            print()
            error("KeyboardInterrupt use exit command!")
            continue
        finally:
            if rc:
                time.sleep(0.3)
                break
Ejemplo n.º 4
0
def command_back(text=False):
    Settings.update_previous()
    Settings.running_module = False
    Settings.reset_name()
    if os.name != "nt":
        utils.Input_completer(cli_keywords + modules)
Ejemplo n.º 5
0
def start(rc=False):
    myinput = utils.getinput()
    utils.Input_completer(all_keywords + modules)
    while True:
        if sys.stdin.closed or sys.stdout.closed:
            exit(0)
        try:
            name = Settings.name
            if rc:
                cmd = rc
                print("\n" + name + G + " > " + end + cmd)
            else:
                cmd = myinput("\n" + name + G + " > " + end)

            cmd = cmd.strip()
            special_char = False
            for q in ["'", '"']:
                if cmd.count(q) >= 2:
                    special_char = q

            if special_char:
                # Welcome to the new age of the quick shitty special characters filters..
                quoted = cmd.split(special_char)[
                    1]  # Get the first thing between quotes
                for char in chars_filter:
                    quoted = quoted.replace(char, chars_filter[char])
                cmd = cmd.replace(
                    cmd.split(special_char)[1].join([special_char] * 2),
                    quoted)
                # Not the filter this framework deserves but, the filter it needed..lol

            for c in cmd.split(";"):
                for char in chars_filter:
                    c = c.replace(chars_filter[char], char)  # Yeah reversing
                if len(cmd.split(";")) > 1:
                    print(G + " > " + end + c)
                if Settings.running_module:
                    module.handle(c)
                    continue

                head = c.lower().split()[0]
                args = " ".join(c.split()[1:])

                if not general_commands(head, args=args):
                    command_handler(c)
        except KeyboardInterrupt:
            print()
            error("KeyboardInterrupt use exit command!")
            continue
        except Exception as e:
            if Settings.debug:
                print("\nInput function error:")
                print("  Exception -> " + str(e))
                print("    Input -> " + str(cmd))
                print("  Trackback -> ")
                traceback.print_exc()
                break
        finally:
            if rc:
                time.sleep(0.3)
                break