예제 #1
0
def parser_args_func(parse_args, config):
    if parse_args.nocolors:
        set_nocolors()

    if parse_args.wireless_mode:
        if parse_args.wireless_mode in config.get_all_childname("ap_mode"):
            config.set_one("ap_mode", parse_args.wireless_mode, True)
            print(
                display_messages(
                    "Wireless Mode: {}".format(
                        setcolor(parse_args.wireless_mode, color="ciano")),
                    info=True,
                ))
    if parse_args.restmode:
        if not (parse_args.password):
            print(
                display_messages(
                    "{} \n rest mode require a valid password.".format(
                        setcolor("password invalid", color="red")),
                    info=True,
                ))
            exit(0)

        set_nocolors()
        config.set_one("ap_mode", "restapi", True)
        config.set("rest_api_settings", "PASSWORD", parse_args.password)
        config.set("rest_api_settings", "USERNAME", parse_args.username)
        config.set("rest_api_settings", "port", parse_args.restport)
        server_restapi = RestControllerAPI("wp3API", config)
        thead = threading.Thread(target=server_restapi.run)
        thead.setDaemon(True)
        thead.start()
예제 #2
0
 def do_run(self, args):
     """ execute deauth module attack """
     client_mac = self.options.get("client")[0]
     target_mac = self.options.get("target")[0]
     interface = self.options.get("interface")[0]
     print(display_messages("Options", info=True, sublime=True))
     print(
         display_messages("client:| {} |".format(
             setcolor(client_mac, color="blue")),
                          info=True))
     print(
         display_messages("target:| {} |".format(
             setcolor(target_mac, color="red")),
                          info=True))
     if "00:00:00:00:00:00" in self.options.get("target")[0]:
         print(
             display_messages("please, select a target to deauth attack ",
                              error=True))
         return
     print(
         display_messages(
             "enable interface: {} to monitor mode".format(interface),
             info=True))
     self.set_monitor_mode("monitor")
     self.thread_deauth = ThreadDeauth(target_mac, client_mac, interface)
     self.thread_deauth.setObjectName("wifideauth")
     self.thread_deauth.start()
예제 #3
0
 def do_info(self, args):
     """ get info custom captiveflask portals """
     if args:
         plugin_name = args.split()[0]
         if not plugin_name in self.plugins_remote:
             print(
                 display_messages(
                     "plugin: {} not found ".format(plugin_name), error=True
                 )
             )
             return
         print(display_messages("Information", info=True, sublime=True))
         list_keys = [
             "Name",
             "Author",
             "Version",
             "Installed",
             "Preview",
             "Description",
         ]
         for item in list_keys:
             print(
                 " {} : {}".format(
                     setcolor(item, color="blue"),
                     setcolor(
                         self.plugins_remote[plugin_name][item.lower()],
                         color="yellow",
                     ),
                 )
             )
         print("\n")
예제 #4
0
def wp3_header():
    _author = "{}".format(setcolor(__author__, color="yellow"))
    _version = setcolor(__version__, color="yellow")
    _codename = setcolor(__codename__, color="ciano")
    _branch = setcolor(__branch__, color="purple")

    banner(_codename)
    print("by: {} - P0cL4bs Team | version: {} {}".format(_author, _version, _branch))
예제 #5
0
 def do_banner(self, args):
     """core: display an awesome wp3 banner """
     _author = "{}".format(setcolor(__author__, color="yellow"))
     _version = setcolor(__version__, color="yellow")
     _codename = setcolor(__codename__, color="ciano")
     banner(_codename)
     print("by: {} - P0cL4bs Team | version: {} ".format(_author, _version))
     print(
         display_messages(
             "Session id: {} ".format(
                 setcolor(self.root.currentSessionID, color="red", underline=True)
             ),
             info=True,
         )
     )
예제 #6
0
 def do_run(self, args):
     """ execute module """
     print(
         display_messages(
             "setting interface: {} monitor momde".format(
                 setcolor(self.options.get("interface")[0], color="green")
             ),
             info=True,
         )
     )
     self.set_monitor_mode("monitor")
     print(display_messages("starting Channel Hopping ", info=True))
     self.p = Process(
         target=self.channel_hopper, args=(self.options.get("interface")[0],)
     )
     self.p.daemon = True
     self.p.start()
     print(display_messages("sniffing... ", info=True))
     sniff(
         iface=self.options.get("interface")[0],
         prn=self.sniffAp,
         timeout=None
         if int(self.options.get("timeout")[0]) == 0
         else int(self.options.get("timeout")[0]),
     )
     self.p.terminate()
     self.set_monitor_mode()
     print(display_messages("thread sniffing successfully stopped", info=True))
예제 #7
0
    def do_plugins(self, args=str):
        """network: show all available plugins """
        headers_table, output_table = ["Name", "Active", "Description"], []
        headers_plugins, output_plugins = ["Name", "Active"], []
        all_plugins, config_instance = None, None
        for plugin_name, plugin_info in self.root.mitm_controller.getInfo().items():
            status_plugin = self.root.conf.get("mitm_modules", plugin_name, format=bool)
            output_table.append(
                [
                    plugin_name,
                    setcolor("True", color="green")
                    if status_plugin
                    else setcolor("False", color="red"),
                    plugin_info["Description"][:50] + "..."
                    if len(plugin_info["Description"]) > 50
                    else plugin_info["Description"],
                ]
            )
            if (
                self.root.mitm_controller.getInfo()[plugin_name]["Config"] != None
                and status_plugin
            ):
                config_instance = self.root.mitm_controller.getInfo()[plugin_name][
                    "Config"
                ]
                all_plugins = self.root.mitm_controller.getInfo()[plugin_name][
                    "Config"
                ].get_all_childname("plugins")

        print(display_messages("Available Plugins:", info=True, sublime=True))
        display_tabulate(headers_table, output_table)

        if not all_plugins:
            return

        for plugin_name in all_plugins:
            status_plugin = config_instance.get("plugins", plugin_name, format=bool)
            output_plugins.append(
                [
                    plugin_name,
                    setcolor("True", color="green")
                    if status_plugin
                    else setcolor("False", color="red"),
                ]
            )
        print(display_messages("Sniffkin3 plugins:", info=True, sublime=True))
        return display_tabulate(headers_plugins, output_plugins)
예제 #8
0
 def get_Hostapd_Response(self, data):
     if self.conf.get("accesspoint", "status_ap", format=bool):
         print(
             display_messages(
                 "{} client has left AP ".format(setcolor(data, color="red")),
                 info=True,
             )
         )
예제 #9
0
    def do_list(self, args):
        """ show all avaliable templates from github """
        if not path.isfile(self.save_path):
            print(
                display_messages(
                    "can't find downloaded file: {}".format(self.save_path), error=True
                )
            )
            return

        config = SettingsINI(self.config_file_ini)

        plugins_installed = self.config_default.get_all_childname("plugins")

        self.plugins_remote = {}
        for plugin in config.get_all_childname("plugins"):
            self.plugins_remote[plugin] = {}
            for info in config.get_all_childname("info_{}".format(plugin)):
                self.plugins_remote[plugin][info] = config.get(
                    "info_{}".format(plugin), info
                )

            self.plugins_remote[plugin]["installed"] = (
                setcolor("True", color="green")
                if plugin in plugins_installed
                else setcolor("False", color="red")
            )

        self.table_output = []
        for plugin in self.plugins_remote:
            self.table_output.append(
                [
                    self.plugins_remote[plugin]["name"],
                    self.plugins_remote[plugin]["author"],
                    self.plugins_remote[plugin]["installed"],
                    self.plugins_remote[plugin]["preview"],
                ]
            )
        if len(self.table_output) > 0:
            print(
                display_messages(
                    "Available Customs CaptiveFlask:", info=True, sublime=True
                )
            )
            display_tabulate(self.table_headers, self.table_output)
예제 #10
0
 def get_DHCPoutPut(self, data):
     self._connected[data["MAC"]] = data
     if self.conf.get("accesspoint", "status_ap", format=bool):
         print(
             display_messages(
                 "{} client join the AP ".format(
                     setcolor(data["MAC"], color="green")),
                 info=True,
             ))
예제 #11
0
 def showResultData(self, data):
     try:
         rdata = self.getDataFromOutput(data)
     except IndexError:
         print(
             display_messages("cannot tracked: client not found.",
                              error=True))
         return
     mac_addr = list(rdata.keys())[0]
     print(
         display_messages("peer: [{}]".format(
             setcolor(mac_addr, color="green")),
                          info=True))
     for item in rdata:
         for key, value in rdata[item].items():
             print("     {} : {}".format(setcolor(key, color="blue"),
                                         setcolor(value, color="yellow")))
     if rdata:
         print("\n")
예제 #12
0
    def do_update(self, args):
        """core: pulling updates from remote git repository """
        if not self.check_deps_pip():
            print(display_messages("pip3: command not found", error=True))
            print(
                display_messages(
                    "Pip3 is not installed, check that you’ve installed all the necessary prerequisite packages, which include python3-dev, libffi-dev, and libssl-dev.",
                    info=True,
                ))
            return

        branch = None
        if args:
            branch = args.split()[0]
            if not branch in self.options.get("branches"):
                print(
                    display_messages(
                        "branch: {} not found! ".format(
                            setcolor(branch, color="red")),
                        info=True,
                    ))
                return

        if not branch:
            branch = self.options.get("default_branch")[0]

        print(
            display_messages("pulling updates from remote git repository",
                             info=True))
        print(
            display_messages(
                "from branch: {}".format(setcolor(branch, color="green")),
                info=True,
            ))

        anwer_question = input(
            "So, do you want to continue to update ? (Y/N): ")
        if anwer_question.lower() != "y":
            return

        os.system(self.options.get("urlparser").format(branch))
        self.root.do_exit([])
예제 #13
0
    def installPluginByName(self, plugin_name):
        print(
            display_messages(
                "Install plugin:: {}".format(
                    setcolor(plugin_name, color="yellow")),
                info=True,
                sublime=True,
            ))
        source = "{}/plugins/{}.py".format(self.extracted_filepath,
                                           plugin_name)
        destination = "{}/{}.py".format(self.captiveflask_path, plugin_name)
        dest = copyfile(source, destination)
        print(
            display_messages("copy content file to {}".format(dest),
                             info=True))

        folder_plugin = "{}/templates/{}".format(self.extracted_filepath,
                                                 plugin_name)
        copy_tree(folder_plugin, "config/templates/{}".format(plugin_name))
        print(
            display_messages(
                "copy content directory to {}".format(
                    "config/templates/{}".format(plugin_name)),
                info=True,
            ))

        self.config_default.set("plugins", plugin_name, False)
        config = SettingsINI(self.config_file_ini)
        if config.get_all_childname("set_{}".format(plugin_name)) != []:
            for language in config.get_all_childname(
                    "set_{}".format(plugin_name)):
                self.config_default.set("set_{}".format(plugin_name), language,
                                        False)
            self.config_default.set("set_{}".format(plugin_name), "Default",
                                    True)

        print(
            display_messages(
                "plugin install {}".format(setcolor("sucessful",
                                                    color="green")),
                info=True,
            ))
예제 #14
0
def parser_args_func(parse_args):
    if parse_args.nocolors:
        set_nocolors()

    if parse_args.wireless_mode:
        if parse_args.wireless_mode in conf.get_all_childname("ap_mode"):
            conf.set_one("ap_mode", parse_args.wireless_mode, True)
            print(
                display_messages(
                    "Wireless Mode: {}".format(
                        setcolor(parse_args.wireless_mode, color="ciano")),
                    info=True,
                ))
예제 #15
0
파일: ap.py 프로젝트: hachtech/wifipumpkin3
    def do_ap(self, args):
        """ap: show all variable and status from AP """
        headers_table, output_table = (
            ["BSSID", "SSID", "Channel", "Interface", "Status", "Security"],
            [],
        )
        print(
            display_messages("Settings AccessPoint:", info=True, sublime=True))
        status_ap = self.root.conf.get("accesspoint", "status_ap", format=bool)
        output_table.append([
            self.root.conf.get("accesspoint", self.root.commands["bssid"]),
            self.root.conf.get("accesspoint", self.root.commands["ssid"]),
            self.root.conf.get("accesspoint", self.root.commands["channel"]),
            self.root.conf.get("accesspoint", self.root.commands["interface"]),
            setcolor("is Running", color="green")
            if status_ap else setcolor("not Running", color="red"),
            self.root.conf.get("accesspoint", self.root.commands["security"]),
        ])
        display_tabulate(headers_table, output_table)
        enable_security = self.root.conf.get("accesspoint",
                                             self.root.commands["security"],
                                             format=bool)

        if enable_security:
            headers_sec, output_sec = (
                ["wpa_algorithms", "wpa_sharedkey", "wpa_type"],
                [],
            )
            output_sec.append([
                self.root.conf.get("accesspoint", "wpa_algorithms"),
                self.root.conf.get("accesspoint", "wpa_sharedkey"),
                self.root.conf.get("accesspoint", "wpa_type"),
            ])
            print(
                display_messages("Settings Security:", info=True,
                                 sublime=True))
            display_tabulate(headers_sec, output_sec)
            self.show_help_command("help_security_command")
예제 #16
0
    def do_start(self, args):
        """ start update dns zones file """
        if self._background_mode:
            print(
                display_messages("there are a dnsspoof module in brackground.",
                                 error=True))
            return

        redirectTo = self.options.get("redirectTo")[0]

        if not self.options.get("domains")[0]:
            print(
                display_messages("please, select a domains to perform attack ",
                                 error=True))
            return

        print(display_messages("DnsSpoof attack", info=True, sublime=True))
        print(
            display_messages(
                "Redirect to: {} ".format(setcolor(redirectTo, color="blue")),
                info=True,
            ))
        print(display_messages("Targets:", info=True, sublime=True))
        for target in self.options.get("domains")[0].split(","):
            print(
                display_messages(
                    "-> [{}] ".format(setcolor(target, color="red")),
                    info=True,
                ))

        self.handler_dnshosts = open(self.filepath_dns_hosts, "a")
        for target in self.options.get("domains")[0].split(","):
            self.handler_dnshosts.write(
                self.rules_model.format(dns=target, redirect=redirectTo))
        self.handler_dnshosts.close()

        self.set_background_mode(True)
예제 #17
0
 def do_kill(self, args):
     """core: terminate a module in background by id"""
     if len(self.root.threads["Modules"]) > 0:
         try:
             module_name = args.split()[0]
         except Exception:
             return
         module_instance = None
         if module_name in list(self.root.threads.get("Modules").keys()):
             module_instance = self.root.threads["Modules"].get(module_name)
         if not module_instance:
             print(
                 display_messages(
                     "the module {} was not found.".format(
                         setcolor(module_name, color="orange")),
                     error=True,
                 ))
             return
         return module_instance.do_stop([])
     print(
         display_messages("there are no module running in the background",
                          error=True))
예제 #18
0
 def run(self):
     print(
         display_messages(
             "starting thread {}".format(
                 setcolor(self.objectName(), color="green")),
             info=True,
         ))
     self.status = True
     conf.iface = self.interface
     pkt1 = (RadioTap() / Dot11(
         type=0,
         subtype=12,
         addr1=self.client,
         addr2=self.bssid,
         addr3=self.bssid,
     ) / Dot11Deauth(reason=7))
     pkt2 = (Dot11(addr1=self.bssid, addr2=self.client, addr3=self.client) /
             Dot11Deauth())
     self.pkts.append(pkt1), self.pkts.append(pkt2)
     while self.status:
         for packet in self.pkts:
             sendp(packet, verbose=False, count=1, iface=self.interface)
예제 #19
0
    def do_proxies(self, args):
        """network: show all available proxies"""
        headers_table, output_table = ["Proxy", "Active", "Port", "Description"], []
        plugin_info_activated = None
        config_instance = None
        headers_plugins, output_plugins = ["Name", "Active"], []

        for plugin_name, plugin_info in self.root.proxy_controller.getInfo().items():
            status_plugin = self.root.conf.get(
                "proxy_plugins", plugin_name, format=bool
            )
            # save plugin activated infor
            if plugin_info["Config"] != None:
                if (
                    self.root.conf.get_name_activated_plugin("proxy_plugins")
                    == plugin_name
                ):
                    plugin_info_activated = plugin_info
                    config_instance = plugin_info_activated["Config"]

            output_table.append(
                [
                    plugin_name,
                    setcolor("True", color="green")
                    if status_plugin
                    else setcolor("False", color="red"),
                    plugin_info["Port"],
                    plugin_info["Description"][:50] + "..."
                    if len(plugin_info["Description"]) > 50
                    else plugin_info["Description"],
                ]
            )

        print(display_messages("Available proxies:", info=True, sublime=True))
        display_tabulate(headers_table, output_table)
        # check plugin none
        if not plugin_info_activated:
            return
        # check if plugin selected is iquals the plugin config
        if plugin_info_activated["ID"] != self.root.conf.get_name_activated_plugin(
            "proxy_plugins"
        ):
            return
        all_plugins = plugin_info_activated["Config"].get_all_childname("plugins")
        for plugin_name in all_plugins:
            status_plugin = config_instance.get("plugins", plugin_name, format=bool)
            output_plugins.append(
                [
                    plugin_name,
                    setcolor("True", color="green")
                    if status_plugin
                    else setcolor("False", color="red"),
                ]
            )
        print(
            display_messages(
                "{} plugins:".format(plugin_info_activated["Name"]),
                info=True,
                sublime=True,
            )
        )
        return display_tabulate(headers_plugins, output_plugins)
예제 #20
0
    def do_info(self, args):
        """core: get information about proxy/plugin settings"""
        try:
            command = args.split()[0]
            plugins = self.root.mitm_controller.getInfo().get(command)
            proxies = self.root.proxy_controller.getInfo().get(command)
            if plugins or proxies:
                print(
                    display_messages("Information {}: ".format(command),
                                     info=True,
                                     sublime=True))
            if plugins:
                for name, info in plugins.items():
                    if name != "Config":
                        print(" {} : {}".format(
                            setcolor(name, color="blue"),
                            setcolor(info, color="yellow"),
                        ))
            if proxies:
                for name, info in proxies.items():
                    if name != "Config":
                        print(" {} : {}".format(
                            setcolor(name, color="blue"),
                            setcolor(info, color="yellow"),
                        ))
                try:
                    commands = proxies["Config"].get_all_childname("plugins")
                    list_commands = []
                    headers_table, output_table = ["Plugin", "Value"], []
                    # search plugin of proxy has string "set_"

                    for command in commands:
                        for sub_plugin in proxies["Config"].get_all_childname(
                                "set_{}".format(command)):
                            output_table.append([
                                setcolor(
                                    "{}.{}".format(command, sub_plugin),
                                    color="blue",
                                ),
                                proxies["Config"].get("set_{}".format(command),
                                                      sub_plugin),
                            ])
                    if output_table != []:
                        print(
                            display_messages("Plugins:",
                                             info=True,
                                             sublime=True))
                        display_tabulate(headers_table, output_table)

                    settings = proxies["Config"].get_all_childname("settings")
                    if not settings:
                        return
                    headers_settings, output_settings = ["Setting",
                                                         "Value"], []
                    # search extra settings plugin

                    for command in settings:
                        output_settings.append([
                            setcolor(
                                "{}".format(command),
                                color="blue",
                            ),
                            proxies["Config"].get("settings", command),
                        ])
                    if output_settings != []:
                        print(
                            display_messages("Settings:",
                                             info=True,
                                             sublime=True))
                        return display_tabulate(headers_settings,
                                                output_settings)

                except AttributeError:
                    pass

            if plugins or proxies:
                print("\n")
                return
        except IndexError:
            pass
        print(
            display_messages(
                "the parameter {} was not found.".format(
                    setcolor(args, color="orange")),
                error=True,
            ))
예제 #21
0
    def do_start(self, args):
        """ execute deauth module attack """
        if self._background_mode:
            print(
                display_messages(
                    "there are a deauth attack in brackground.", error=True
                )
            )
            return

        client_mac = self.options.get("client")[0]
        target_mac = self.options.get("target")[0]
        interface = self.options.get("interface")[0]
        if "00:00:00:00:00:00" in self.options.get("target")[0]:
            print(
                display_messages(
                    "please, select a target to deauth attack ", error=True
                )
            )
            return
        print(
            display_messages(
                "enable interface: {} to monitor mode".format(interface), info=True
            )
        )
        print(
            display_messages("Wi-Fi deauthentication attack", info=True, sublime=True)
        )
        print(
            display_messages(
                "the MAC address: {} of the client to be deauthenticated".format(
                    setcolor(client_mac, color="blue")
                ),
                info=True,
            )
        )
        info_target = self.aps.get(target_mac)
        if info_target:
            channel = info_target.get("channel")
            print(
                display_messages(
                    "waiting for beacon frame (BSSID: {}) on channel {} ".format(
                        setcolor(target_mac, color="orange"), channel
                    ),
                    info=True,
                )
            )

        print(
            display_messages(
                "Sending DeAuth to station -- STMAC: [{}] ".format(
                    setcolor(target_mac, color="red")
                ),
                info=True,
            )
        )
        self.set_monitor_mode("monitor")
        self.thread_deauth = ThreadDeauth(target_mac, client_mac, interface)
        self.thread_deauth.setObjectName("wifideauth")
        self.thread_deauth.start()
        self.set_background_mode(True)
예제 #22
0
def main():

    app = QtCore.QCoreApplication(sys.argv)
    conf = SettingsINI.getInstance()

    # settings default values that change on
    conf.set("accesspoint", "status_ap", False)

    parser = argparse.ArgumentParser(
        description="WiFi-Pumpkin - pure line-oriented command"
    )
    parser.add_argument(
        "-i", dest="interface", help="set interface for create AP", default=""
    )
    parser.add_argument(
        "-s", dest="session", help="set session for continue attack", default=None
    )
    parser.add_argument(
        "-p",
        "--pulp",
        dest="pulp",
        help="interactive sessions can be scripted with .pulp file",
        default="",
    )
    parser.add_argument(
        "-x",
        "--xpulp",
        dest="xpulp",
        help='interactive sessions can be string with ";" as the separator',
        default="",
    )
    parser.add_argument(
        "-m",
        "--wireless-mode",
        dest="wireless_mode",
        help="set wireless mode settings",
        default=None,
    )
    parser.add_argument(
        "--no-colors",
        dest="nocolors",
        help="disable terminal colors and effects.",
        action="store_true",
        default=False,
    )
    parser.add_argument(
        "-v",
        "--version",
        action="version",
        dest="version",
        version="%(prog)s v{}".format(__version__),
    )

    parse_args = parser.parse_args()
    parser_args_func(parse_args)

    # check is rootuser
    if not getuid() == 0:
        sys.exit("[!] Wp3 must be run as root.")

    _author = "{}".format(setcolor(__author__, color="yellow"))
    _version = setcolor(__version__, color="yellow")
    _codename = setcolor(__codename__, color="ciano")

    banner(_codename)
    print("by: {} - P0cL4bs Team | version: {} ".format(_author, _version))
    prompt = PumpkinShell(parse_args)
    prompt.cmdloop("Starting prompt...")
    sys.exit(app.exec_())