示例#1
0
def command_run(text=False):
    # Options format : {"name":[ (0,1,2),description,value]}
    # Required     --> 1 # Means that it must have value
    # Not required --> 0 # Means that it could have value or not
    for key in global_options.keys():
        if global_options[key][0] == 1 and not str(
                global_options[key]
            [2]).strip():  # A required option but has empty value
            error("Error! the following option have not been set (" + key +
                  ")")
            return
    module = importlib.import_module(
        utils.pythonize("core.modules." + Settings.running_module))
    if Settings.development: module = utils.reload(module)
    exec_info = getattr(module, "execution")
    if not Settings.headless_browser:
        Settings.headless_browser = browser.headless_browsers()
        current_browser = {"Status": "LOL"}
        Settings.headless_browser.new_session(exec_info.name, exec_info.url,
                                              global_options["useragent"][2])
    else:
        current_browser = Settings.headless_browser.new_session(
            exec_info.name, exec_info.url, global_options["useragent"][2])

    if current_browser["Status"] == "Duplicate":
        error("Module already running!")
    elif current_browser["Status"] == "NoBrowser":
        error("Couldn't find Firefox file path!")
    elif current_browser["Status"] == "Failed":
        error(
            "Couldn't open Firefox! Check the installation instructions again!"
        )
    elif current_browser["Status"] == "Invalid useragent":
        error(
            "Can't use this useragent! See the possible useragent values in the wiki!"
        )
    else:
        # RUN https://youtu.be/PTZ4L6cNNC4
        #current_browser = current_browser["Controller"]
        if exec_info.module_type == types.grabber:
            if Settings.development:
                status("Grabber module detected!")
            Settings.headless_browser.website_qr(
                exec_info.name, exec_info.image_xpath
            )  # Keeps QR image always updated and it runs in a thread too
            Settings.headless_browser.create_listener(
                exec_info.name, exec_info.change_identifier,
                exec_info.session_type)
            if exec_info.img_reload_button:
                Settings.headless_browser.check_img(
                    exec_info.name, exec_info.img_reload_button
                )  # This line will run in a thread too
            Settings.headless_browser.serve_module(
                exec_info.name, global_options["host"][2],
                int(global_options["port"][2]))

        # TODO
        elif exec_info.module_type == types.post:
            if Settings.development:
                status("Post module detected!")
示例#2
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))
示例#3
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)
示例#4
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))
	if Settings.development:
		mod            = utils.reload(mod)
	global_options = getattr(mod, 'execution').module_type.options
	if os.name !="nt":
		utils.Input_completer(module_keywords+modules)
	Settings.add_module(Settings.running_module)
示例#5
0
def command_run(text=False):
	# Options format : {"name":[ (0,1,2),description,value]}
	# Required     --> 1 # Means that it must have value
	# Not required --> 0 # Means that it could have value or not
	for key in global_options.keys():
		if global_options[key][0]==1 and not global_options[key][2].strip(): # A required option but has empty value
			error("Error! the following option have not been set ("+ key + ")" )
			return
	module = importlib.import_module(utils.pythonize("core.modules."+Settings.running_module))
	if Settings.development: module = utils.reload(module)
	exec_info  = getattr(module, "execution")
	if not Settings.headless_browser:
		Settings.headless_browser = browser.headless_browsers()
		current_browser = {"Status":"LOL"}
		Settings.headless_browser.new_session(exec_info.name, exec_info.url, global_options["useragent"][2])
	else:
		current_browser = Settings.headless_browser.new_session(exec_info.name, exec_info.url, global_options["useragent"][2])

	if current_browser["Status"]=="Duplicate":
		error("Module already running!")
	elif current_browser["Status"]=="Failed":
		error("Couldn't open Firefox! Check the installation instructions again!")
	elif current_browser["Status"]=="Invalid useragent":
		error("Can't use this useragent! See the possible useragent values in the wiki!")
	else:
		# RUN https://youtu.be/PTZ4L6cNNC4
		#current_browser = current_browser["Controller"]
		if exec_info.module_type == types.grabber:
			if Settings.development:
				status("Grabber module detected!")
			Settings.headless_browser.website_qr(exec_info.name, exec_info.image_xpath) # Keeps QR image always updated and it runs in a thread too
			Settings.headless_browser.create_listener(exec_info.name, exec_info.change_identifier, exec_info.session_type)
			if exec_info.img_reload_button:
				Settings.headless_browser.check_img(exec_info.name, exec_info.img_reload_button) # This line will run in a thread too
			Settings.headless_browser.serve_module(exec_info.name, global_options["host"][2], int(global_options["port"][2]))

		# TODO
		elif exec_info.module_type == types.post:
			if Settings.development:
				status("Post module detected!")