From 9bcac0b76aa82b272a575d41155f18dc493f5369 Mon Sep 17 00:00:00 2001 From: mh4x0f Date: Mon, 27 Jun 2022 21:25:28 -0300 Subject: [PATCH] removed: responder3 depedencies now responder need to installed by default for use added: binary exec mode plugin options, moved: captiveflask and pumpkinproxy to console script on setup.py installation --- config/app/config.ini | 5 +-- requirements-dev.txt | 24 ------------ requirements.txt | 6 +-- setup.py | 14 +++++-- wifipumpkin3/core/servers/mitm/mitmmode.py | 5 +++ .../mitm/{responder3.py => responder.py} | 38 ++++++++++--------- .../modules/misc/extra_captiveflask.py | 18 +++++---- wifipumpkin3/plugins/bin/__init__.py | 0 .../plugins/bin/captiveflask.py | 18 +++++---- .../plugins/bin/sslstrip3.py | 7 ++-- 10 files changed, 65 insertions(+), 70 deletions(-) rename wifipumpkin3/core/servers/mitm/{responder3.py => responder.py} (79%) create mode 100644 wifipumpkin3/plugins/bin/__init__.py rename bin/captiveflask => wifipumpkin3/plugins/bin/captiveflask.py (90%) rename bin/sslstrip3 => wifipumpkin3/plugins/bin/sslstrip3.py (98%) diff --git a/config/app/config.ini b/config/app/config.ini index df3dddd..bbaf40a 100644 --- a/config/app/config.ini +++ b/config/app/config.ini @@ -84,7 +84,7 @@ skip_inactivity_poll=1 generic=light-white, #000000 pumpkinproxy=light-red, #000000 pydns_server=light-blue, #000000 -responder3=light-green, #000000 +responder=light-green, #000000 sniffkin3=light-yellow, #000000 captiveflask=light-cyan, #000000 pydhcp_server=light-magenta, #000000 @@ -119,8 +119,7 @@ iptables_D_accept=-w -A OUTPUT --out-interface $inet -j ACCEPT iptables_E_accpet=-w -A INPUT --in-interface $wlan -j ACCEPT [mitm_modules] -responder3=false -responder3_config=/.config/wifipumpkin3/config/plugins/responder3/examples/config.py +responder=false sniffkin3=true [proxy_plugins] diff --git a/requirements-dev.txt b/requirements-dev.txt index 4f6b69c..41657da 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,26 +1,2 @@ -netifaces==0.10.9 -netaddr==0.7.19 -dhcplib==0.1.1 -scapy_http==1.8.2 -tabulate==0.8.5 -urwid==1.1.2 -termcolor==1.1.0 -twisted==19.7.0 -PyQt5>=5.14 -PyQt5-sip -pyOpenSSL==19.0.0 -Responder3==0.0.1 -dnslib==0.9.17 -loguru>=0.4.0 -scapy==2.4.3 -isc_dhcp_leases==0.9.1 -dnspython==1.16.0 -Flask==1.1.4 -requests>=2.18.4 -beautifulsoup4>=4.9.1 black coverage==5.1 -PyJWT==2.1.0 -flask-restx>=0.5.1 -markupsafe==2.0.1 -Werkzeug<2.0,>=0.15 diff --git a/requirements.txt b/requirements.txt index aa476fb..be8618d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,20 +4,18 @@ dhcplib==0.1.1 tabulate>=0.8.5 urwid==2.1.2 termcolor>=1.1.0 -twisted==19.7.0 +twisted>=19.7.0 PyQt5>=5.14 PyQt5-sip pyOpenSSL==19.0.0 -Responder3>=0.0.1 dnslib==0.9.17 loguru>=0.4.0 scapy>=2.4.4 isc_dhcp_leases>=0.9.1 dnspython==1.16.0 -Flask==1.1.4 +Flask>=1.1.1 requests>=2.18.4 beautifulsoup4>=4.9.1 -asn1crypto>=1.0.0 PyJWT==2.1.0 flask-restx>=0.5.1 markupsafe==2.0.1 diff --git a/setup.py b/setup.py index 5217d18..062e9fe 100644 --- a/setup.py +++ b/setup.py @@ -36,6 +36,8 @@ with open("requirements.txt") as fp: folders = ["config", "logs", "helps", "scripts", "exceptions"] config_dir = "/usr/share/wifipumpkin3" + + def create_user_dir_config(): user_config_dir = config_dir if not os.path.isdir(user_config_dir): @@ -61,17 +63,23 @@ setup( license="apache 2.0", long_description=open("README.md").read(), install_requires=required, - scripts=["bin/sslstrip3", "bin/captiveflask"], include_package_data=True, packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), python_requires=">=3.7", classifiers=[ - "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3", "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: POSIX :: Linux", "Environment :: Console", ], - entry_points={"console_scripts": ["wifipumpkin3=wifipumpkin3.__main__:main",],}, + entry_points={ + "console_scripts": [ + "wifipumpkin3=wifipumpkin3.__main__:main", + "wp3=wifipumpkin3.__main__:main", + "captiveflask=wifipumpkin3.plugins.bin.captiveflask:main", + "sslstrip3=wifipumpkin3.plugins.bin.sslstrip3:main", + ], + }, ) diff --git a/wifipumpkin3/core/servers/mitm/mitmmode.py b/wifipumpkin3/core/servers/mitm/mitmmode.py index 0a34382..e761f30 100644 --- a/wifipumpkin3/core/servers/mitm/mitmmode.py +++ b/wifipumpkin3/core/servers/mitm/mitmmode.py @@ -59,6 +59,7 @@ class MitmMode(Widget): sendSingal_disable = QtCore.pyqtSignal(object) config = None TypeButton = 1 # 0 for Switch, 1 for Radio + Binary_exec = None # binary name of execuble command def __init__(self, parent=None): super(MitmMode, self).__init__(parent) @@ -114,6 +115,10 @@ class MitmMode(Widget): ) ) + @property + def getBinaryExecPath(self): + return Linux.getBinaryPath(self.Binary_exec) + @property def getPlugins(self): return None diff --git a/wifipumpkin3/core/servers/mitm/responder3.py b/wifipumpkin3/core/servers/mitm/responder.py similarity index 79% rename from wifipumpkin3/core/servers/mitm/responder3.py rename to wifipumpkin3/core/servers/mitm/responder.py index d186719..e7a647d 100644 --- a/wifipumpkin3/core/servers/mitm/responder3.py +++ b/wifipumpkin3/core/servers/mitm/responder.py @@ -24,15 +24,15 @@ import wifipumpkin3.core.utility.constants as C class NetCredential(DockableWidget): - id = "Responder3" - title = "Responder3" + id = "Responder" + title = "Responder" def __init__(self, parent=None, title="", info={}): super(NetCredential, self).__init__(parent, title, info) self.setObjectName(self.title) def writeModeData(self, data): - """ get data output and add on QtableWidgets """ + """get data output and add on QtableWidgets""" print(data) # self.THeaders['Username'].append(data['POSTCreds']['User']) # self.THeaders['Password'].append(data['POSTCreds']['Pass']) @@ -43,12 +43,12 @@ class NetCredential(DockableWidget): pass -class Responder3(MitmMode): - Name = "Responder 3" - ID = "responder3" +class Responder(MitmMode): + Name = "Responder" + ID = "responder" Author = "PumpkinDev" Description = "LLMNR, NBT-NS and MDNS poisoner, with built-in HTTP/SMB/MSSQL/FTP/LDAP rogue authentication server " - LogFile = C.LOG_RESPONDER3 + LogFile = C.LOG_RESPONDER Hidden = False ConfigMitmPath = None _cmd_array = [] @@ -56,9 +56,10 @@ class Responder3(MitmMode): ModType = "server" # proxy or server config = None TypeButton = 0 # 0 for Switch, 1 for Radio + Binary_exec = "responder" def __init__(self, parent, FSettingsUI=None, main_method=None, **kwargs): - super(Responder3, self).__init__(parent) + super(Responder, self).__init__(parent) self.setID(self.ID) self.setModType(self.ModType) self.dockwidget = NetCredential(None, title=self.Name) @@ -66,19 +67,22 @@ class Responder3(MitmMode): @property def CMD_ARRAY(self): iface = self.conf.get("accesspoint", "interface") - config_responder3_path = C.user_config_dir + self.conf.get( - "mitm_modules", "responder3_config" - ) - self._cmd_array = ["-I", iface, "-4", "-p", config_responder3_path] + self._cmd_array = ["-I", iface, "-wd"] return self._cmd_array def boot(self): - if self.CMD_ARRAY: - self.reactor = ProcessThread({"responder3": self.CMD_ARRAY}) + binary_path = self.getBinaryExecPath + if binary_path: + self.reactor = ProcessThread({binary_path: self.CMD_ARRAY}) self.reactor._ProcssOutput.connect(self.LogOutput) - self.reactor.setObjectName(self.ID) + return self.reactor.setObjectName(self.ID) + print( + display_messages( + "command not found: {}".format(self.Binary_exec), error=True + ) + ) - def parser_set_responder3(self, status, plugin_name): + def parser_set_responder(self, status, plugin_name): try: # plugin_name = pumpkinproxy.no-cache name_plugin, key_plugin = ( @@ -89,7 +93,7 @@ class Responder3(MitmMode): self.config.set("plugins", key_plugin, status) print( display_messages( - "responder3: {} status: {}".format(key_plugin, status), + "responder: {} status: {}".format(key_plugin, status), sucess=True, ) ) diff --git a/wifipumpkin3/modules/misc/extra_captiveflask.py b/wifipumpkin3/modules/misc/extra_captiveflask.py index 55a00c2..3fb31b8 100644 --- a/wifipumpkin3/modules/misc/extra_captiveflask.py +++ b/wifipumpkin3/modules/misc/extra_captiveflask.py @@ -33,14 +33,14 @@ from shutil import copyfile class ModPump(ModuleUI): - """ Extra customs captiveflask templates """ + """Extra customs captiveflask templates""" name = "extra_captiveflask" save_path = tempfile.gettempdir() + "/master.zip" extracted_filepath = tempfile.gettempdir() + "/extra-captiveflask-master" config_file_ini = tempfile.gettempdir() + "/extra-captiveflask-master/config.ini" - captiveflask_path = C.wp3_setup_packager_path + "/plugins/captiveflask" + captiveflask_path = C.wp3_setup_packager_path + "/plugins/captiveflask" config_default = SettingsINI(C.CONFIG_CP_INI_ROOT) @@ -54,7 +54,7 @@ class ModPump(ModuleUI): super(ModPump, self).__init__(parse_args=self.parse_args, root=self.root) def do_list(self, args): - """ show all avaliable templates from github """ + """show all avaliable templates from github""" if not path.isfile(self.save_path): print( display_messages( @@ -100,7 +100,7 @@ class ModPump(ModuleUI): display_tabulate(self.table_headers, self.table_output) def do_download(self, args): - """ download all avaliable templates""" + """download all avaliable templates""" url = C.URL_EXTRA_CAPTIVEFLASK chunk_size = 128 print( @@ -148,11 +148,13 @@ class ModPump(ModuleUI): print(display_messages("copy content file to {}".format(dest), info=True)) folder_plugin = "{}/templates/{}".format(self.extracted_filepath, plugin_name) - copy_tree(folder_plugin, C.config_dir + "/config/templates/{}".format(plugin_name)) + copy_tree( + folder_plugin, C.config_dir + "/config/templates/{}".format(plugin_name) + ) print( display_messages( "copy content directory to {}".format( - "{}/config/templates/{}".format( C.config_dir,plugin_name) + "{}/config/templates/{}".format(C.config_dir, plugin_name) ), info=True, ) @@ -173,7 +175,7 @@ class ModPump(ModuleUI): ) def do_install(self, args): - """ install custom captiveflask portals """ + """install custom captiveflask portals""" if not path.isdir(self.captiveflask_path): print( display_messages( @@ -204,7 +206,7 @@ class ModPump(ModuleUI): return self.show_help_command("help_extra_captiveflask") def do_info(self, args): - """ get info custom captiveflask portals """ + """get info custom captiveflask portals""" if args: plugin_name = args.split()[0] if not plugin_name in self.plugins_remote: diff --git a/wifipumpkin3/plugins/bin/__init__.py b/wifipumpkin3/plugins/bin/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bin/captiveflask b/wifipumpkin3/plugins/bin/captiveflask.py similarity index 90% rename from bin/captiveflask rename to wifipumpkin3/plugins/bin/captiveflask.py index b226533..bfd3496 100644 --- a/bin/captiveflask +++ b/wifipumpkin3/plugins/bin/captiveflask.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 from flask import Flask, request, redirect, render_template from urllib.parse import urlencode, unquote import os, sys @@ -9,6 +8,8 @@ import argparse # static_folder='templates/flask/static', # template_folder='templates/flask') app = Flask(__name__) +REDIRECT = None +FORCE_REDIRECT = None def login_user(ip): @@ -65,20 +66,23 @@ def catch_all(path): ) -#https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse +# https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse def str2bool(v): if isinstance(v, bool): - return v - if v.lower() in ('yes', 'true', 't', 'y', '1'): + return v + if v.lower() in ("yes", "true", "t", "y", "1"): return True - elif v.lower() in ('no', 'false', 'f', 'n', '0'): + elif v.lower() in ("no", "false", "f", "n", "0"): return False else: - raise argparse.ArgumentTypeError('Boolean value expected.') + raise argparse.ArgumentTypeError("Boolean value expected.") + _version = "1.0.2" -if __name__ == "__main__": + +def main(): + global REDIRECT, FORCE_REDIRECT print("[*] CaptiveFlask v{} - subtool from wifipumpkin3".format(_version)) parser = argparse.ArgumentParser( description="CaptiveFlask - \ diff --git a/bin/sslstrip3 b/wifipumpkin3/plugins/bin/sslstrip3.py similarity index 98% rename from bin/sslstrip3 rename to wifipumpkin3/plugins/bin/sslstrip3.py index c4f5d80..92c625c 100644 --- a/bin/sslstrip3 +++ b/wifipumpkin3/plugins/bin/sslstrip3.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 """sslstrip is a MITM tool that implements Moxie Marlinspike's SSL stripping attacks.""" __author__ = "Moxie Marlinspike" @@ -134,7 +133,7 @@ def parseOptions(argv): sys.exit(2) -def main(argv): +def init(argv): ( logFile, logLevel, @@ -167,5 +166,5 @@ def main(argv): reactor.run() -if __name__ == "__main__": - main(sys.argv[1:]) +def main(): + init(sys.argv[1:])