Example #1
0
class DNSBase(QtCore.QObject, ComponentBlueprint):
    Name = "DNSBaseClass"
    ID = "DNSBase"
    Author = "Dev"
    ConfigRoot = "DNSServer"
    ExecutableFile = ""
    LogFile = ""
    hasPreference = False
    arguments = [
        ["label", "switch", "type", "defaultvalue", "enabled", "required"],
    ]

    addDock = QtCore.pyqtSignal(object)

    def __init__(self, parent, **kwargs):
        super(DNSBase, self).__init__(parent)
        self.parent = parent
        self.conf = SuperSettings.getInstance()

        self.reactor = None
        self.loggermanager = LoggerManager.getInstance()
        self.configure_logger()

    def configure_logger(self):
        config_extra = self.loggermanager.getExtraConfig(self.ID)
        config_extra["extra"]["session"] = self.parent.currentSessionID

        self.logger = StandardLog(
            self.ID,
            colorize=self.conf.get("settings", "log_colorize", format=bool),
            serialize=self.conf.get("settings", "log_serialize", format=bool),
            config=config_extra,
        )
        self.logger.filename = self.LogFile
        self.loggermanager.add(self.ID, self.logger)

    def isChecked(self):
        return self.conf.get("accesspoint", self.ID, format=bool)

    @property
    def commandargs(self):
        pass

    @property
    def command(self):
        cmdpath = os.popen("which {}".format(
            self.ExecutableFile)).read().split("\n")[0]
        if cmdpath:
            return cmdpath
        else:
            return None

    def boot(self):
        self.reactor = ProcessThread({self.command: self.commandargs})
        self.reactor._ProcssOutput.connect(self.LogOutput)
        self.reactor.setObjectName(self.ID)

    def LogOutput(self, data):
        if self.conf.get("accesspoint", "status_ap", format=bool):
            self.logger.info(data)
Example #2
0
class Responder3(MitmMode):
    Name = "Responder 3"
    ID = "responder3"
    Author = "PumpkinDev"
    Description = "LLMNR, NBT-NS and MDNS poisoner, with built-in HTTP/SMB/MSSQL/FTP/LDAP rogue authentication server "
    LogFile = C.LOG_RESPONDER3
    Hidden = False
    ConfigMitmPath = None
    _cmd_array = []
    ModSettings = True
    ModType = "server"  # proxy or server
    config = None
    TypeButton = 0  # 0 for Switch, 1 for Radio

    def __init__(self, parent, FSettingsUI=None, main_method=None, **kwargs):
        super(Responder3, self).__init__(parent)
        self.setID(self.ID)
        self.setModType(self.ModType)
        self.dockwidget = NetCredential(None, title=self.Name)

    @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]
        return self._cmd_array

    def boot(self):
        if self.CMD_ARRAY:
            self.reactor = ProcessThread({"responder3": self.CMD_ARRAY})
            self.reactor._ProcssOutput.connect(self.LogOutput)
            self.reactor.setObjectName(self.ID)

    def parser_set_responder3(self, status, plugin_name):
        try:
            # plugin_name = pumpkinproxy.no-cache
            name_plugin, key_plugin = (
                plugin_name.split(".")[0],
                plugin_name.split(".")[1],
            )
            if key_plugin in self.config.get_all_childname("plugins"):
                self.config.set("plugins", key_plugin, status)
                print(
                    display_messages(
                        "responder3: {} status: {}".format(key_plugin, status),
                        sucess=True,
                    ))
            else:
                print(
                    display_messages("unknown plugin: {}".format(key_plugin),
                                     error=True))
        except IndexError:
            print(display_messages("unknown sintax command", error=True))
Example #3
0
 def boot(self):
     print(self.command, self.commandargs)
     self.reactor = ProcessThread({self.command: self.commandargs})
     self.reactor._ProcssOutput.connect(self.LogOutput)
     self.reactor.setObjectName(self.Name)
Example #4
0
class DHCPServers(QtCore.QObject, ComponentBlueprint):
    Name = "Generic"
    ID = "Generic"
    haspref = False
    ExecutableFile = ""

    def __init__(self, parent=0):
        super(DHCPServers, self).__init__()
        self.parent = parent
        self.conf = SuperSettings.getInstance()

        self.loggermanager = LoggerManager.getInstance()
        self.configure_logger()

    @property
    def DHCPConf(self):
        return self.Settings.updateconf()

    def configure_logger(self):
        config_extra = self.loggermanager.getExtraConfig(self.ID)
        config_extra["extra"]["session"] = self.parent.currentSessionID

        self.logger = StandardLog(
            self.ID,
            colorize=self.conf.get("settings", "log_colorize", format=bool),
            serialize=self.conf.get("settings", "log_serialize", format=bool),
            config=config_extra,
        )
        self.logger.filename = self.LogFile
        self.loggermanager.add(self.ID, self.logger)

    def prereq(self):
        dh, gateway = self.DHCPConf["router"], Linux.get_interfaces()["gateway"]
        if gateway != None:
            if (
                dh[: len(dh) - len(dh.split(".").pop())]
                == gateway[: len(gateway) - len(gateway.split(".").pop())]
            ):
                raise DHCPServerSettingsError(
                    "DHCPServer", "dhcp same ip range address "
                )

    def LogOutput(self, data):
        if self.conf.get("accesspoint", "status_ap", format=bool):
            self.logger.info(data)

    def isChecked(self):
        return self.conf.get("accesspoint", self.ID, format=bool)

    def Stop(self):
        self.shutdown()
        self.reactor.stop()

    def Start(self):
        self.prereq()
        self.Initialize()
        self.boot()

    @property
    def Settings(self):
        return DHCPSettings.instances[0]

    @property
    def commandargs(self):
        pass

    def boot(self):
        print(self.command, self.commandargs)
        self.reactor = ProcessThread({self.command: self.commandargs})
        self.reactor._ProcssOutput.connect(self.LogOutput)
        self.reactor.setObjectName(self.Name)

    @property
    def command(self):
        cmdpath = os.popen("which {}".format(self.ExecutableFile)).read().split("\n")[0]
        if cmdpath:
            return cmdpath
        else:
            return None

    def get_mac_vendor(self, mac):
        """ discovery mac vendor by mac address """
        try:
            d_vendor = EUI(mac)
            d_vendor = d_vendor.oui.registration().org
        except:
            d_vendor = "unknown mac"
        return d_vendor
Example #5
0
 def boot(self):
     if self.CMD_ARRAY:
         self.reactor = ProcessThread({"responder3": self.CMD_ARRAY})
         self.reactor._ProcssOutput.connect(self.LogOutput)
         self.reactor.setObjectName(self.ID)
Example #6
0
class ProxyMode(Widget, ComponentBlueprint):
    Name = "Generic"
    Author = "Wahyudin Aziz"
    ID = "generic"
    Description = "Generic Placeholder for Attack Scenario"
    LogFile = C.LOG_ALL
    CONFIGINI_PATH = ""
    ModSettings = False
    ModType = "proxy"  # proxy or server
    EXEC_PATH = ""
    _cmd_array = []
    Hidden = True
    plugins = []
    sendError = QtCore.pyqtSignal(str)
    sendSingal_disable = QtCore.pyqtSignal(object)
    addDock = QtCore.pyqtSignal(object)
    TypePlugin = 1
    RunningPort = 80
    config = None

    def __init__(self, parent):
        super(ProxyMode, self).__init__()
        self.parent = parent
        self.conf = SuperSettings.getInstance()

        self.handler = None
        self.reactor = None
        self.subreactor = None
        self.defaults_rules = {}
        self.defaults_rules[self.ID] = []
        # set config path plugin
        if self.getConfigINIPath != "":
            self.config = SettingsINI(self.getConfigINIPath)

        self.loggermanager = LoggerManager.getInstance()
        self.configure_logger()

    def configure_logger(self):
        if not self.Hidden:
            config_extra = self.loggermanager.getExtraConfig(self.ID)
            config_extra["extra"]["session"] = self.parent.currentSessionID

            self.logger = StandardLog(
                self.ID,
                colorize=self.conf.get("settings", "log_colorize",
                                       format=bool),
                serialize=self.conf.get("settings",
                                        "log_serialize",
                                        format=bool),
                config=config_extra,
            )
            self.logger.filename = self.LogFile
            self.loggermanager.add(self.ID, self.logger)

    def parser_set_proxy(self, proxy_name, *args):
        # default parser proxy commands complete
        if not self.conf.get("accesspoint", "status_ap", format=bool):
            plugins_selected = [
                plugin
                for plugin in self.conf.get_all_childname("proxy_plugins")
                if plugin == proxy_name
            ]
            if plugins_selected != []:
                self.conf.set("proxy_plugins", plugins_selected[0], True)
                for proxy in self.conf.get_all_childname("proxy_plugins"):
                    if proxy != plugins_selected[0] and not "_config" in proxy:
                        self.conf.set("proxy_plugins", proxy, False)
                return
            return print(
                display_messages("unknown command: {} ".format(proxy_name),
                                 error=True))
        print(
            display_messages("Error: 0x01 - the AP(access point) is running",
                             error=True))

    def runDefaultRules(self):
        for rules in self.defaults_rules[self.ID]:
            os.system(rules)

    @property
    def getPlugins(self):
        return None

    @property
    def getConfigINIPath(self):
        return self.CONFIGINI_PATH

    @property
    def getConfig(self):
        return self.config

    def add_default_rules(self, rule: str):
        self.defaults_rules[self.ID].append(rule)

    def setRunningPort(self, value):
        self.RunningPort = value

    def getRunningPort(self):
        return self.RunningPort

    def getTypePlugin(self):
        return self.TypePlugin

    def setTypePlugin(self, type_plugin):
        self.TypePlugin = type_plugin

    def setID(self, id):
        self.ID = id

    def isChecked(self):
        return self.conf.get("proxy_plugins", self.ID, format=bool)

    @property
    def getIptablesPath(self):
        return self.conf.get("iptables", "path_binary")

    @property
    def iptablesrules(self):
        pass

    @property
    def Wireless(self):
        return AccessPointSettings.instances[0]

    def onProxyEnabled(self):
        pass

    def onProxyDisabled(self):
        pass

    @property
    def hasSettings(self):
        return self.ModSettings

    @property
    def CMD_ARRAY(self):
        # self._cmd_array.extend(self.parent.currentSessionID)
        return self._cmd_array

    def boot(self):
        self.reactor = ProcessThread({"python3": self.CMD_ARRAY})
        self.reactor._ProcssOutput.connect(self.LogOutput)
        self.reactor.setObjectName(self.ID)

    def shutdown(self):
        pass

    @property
    def isEnabled(self):
        pass

    def Initialize(self):
        pass

    def optionsRules(self, type):
        """ add rules iptable by type plugins"""
        return self.search[type]

    def ClearRules(self):
        for rules in self.search.keys():
            self.unset_Rules(rules)

    def LogOutput(self, data):
        if self.conf.get("accesspoint", "status_ap", format=bool):
            print(data)

    def Configure(self):
        self.ConfigWindow.show()

    def SaveLog(self):
        pass

    def Serve(self, on=True):
        pass
Example #7
0
 def boot(self):
     self.reactor = ProcessThread({"python3": self.CMD_ARRAY})
     self.reactor._ProcssOutput.connect(self.LogOutput)
     self.reactor.setObjectName(self.ID)
Example #8
0
class MitmMode(Widget):
    Name = "Generic"
    ID = "Generic"
    Author = "Wahyudin Aziz"
    Description = "Generic Placeholder for Attack Scenario"
    LogFile = C.LOG_ALL
    CONFIGINI_PATH = ""
    ModSettings = False
    ModType = "proxy"  # proxy or server
    ConfigMitm = None
    Hidden = True
    _cmd_array = []
    plugins = []
    sendError = QtCore.pyqtSignal(str)
    sendSingal_disable = QtCore.pyqtSignal(object)
    config = None
    TypeButton = 1 # 0 for Switch, 1 for Radio

    def __init__(self, parent=None):
        super(MitmMode, self).__init__(parent)
        self.parent = parent
        self.conf = SuperSettings.getInstance()
        self.reactor = None
        self.server = None

        if self.getConfigINIPath != "":
            self.config = SettingsINI(self.getConfigINIPath)

        self.loggermanager = LoggerManager.getInstance()
        self.configure_logger()

    def configure_logger(self):
        if not self.Hidden:
            config_extra = self.loggermanager.getExtraConfig(self.ID)
            config_extra["extra"]["session"] = self.parent.currentSessionID

            self.logger = StandardLog(
                self.ID,
                colorize=self.conf.get("settings", "log_colorize", format=bool),
                serialize=self.conf.get("settings", "log_serialize", format=bool),
                config=config_extra,
            )
            self.logger.filename = self.LogFile
            self.loggermanager.add(self.ID, self.logger)

    def parser_set_plugin(self, proxy_name, args):
        # default parser plugin commands complete
        try:
            plugin_name, plugin_status = list(args.split())[1], list(args.split())[2]
            if plugin_status not in ["true", "false", "True", "False"]:
                return print(
                    display_messages(
                        "wifipumpkin3: error: unrecognized arguments {}".format(
                            plugin_status
                        ),
                        error=True,
                    )
                )
            if plugin_name in self.conf.get_all_childname("mitm_modules"):
                return self.conf.set("mitm_modules", plugin_name, plugin_status)
            return print(
                display_messages("plugin {} not found".format(plugin_name), error=True)
            )
        except IndexError as e:
            pass

        print(
            display_messages(
                "unknown sintax command: {}\n".format(proxy_name), error=True
            )
        )

    @property
    def getPlugins(self):
        return None

    @property
    def getConfigINIPath(self):
        return self.CONFIGINI_PATH

    @property
    def getConfig(self):
        return self.config

    def getModType(self):
        return self.ModType

    def setModType(self, type_plugin):
        self.ModType = type_plugin

    def setID(self, id):
        self.ID = id

    def isChecked(self):
        return self.conf.get("mitm_modules", self.ID, format=bool)

    @property
    def CMD_ARRAY(self):
        return self._cmd_array

    @property
    def Wireless(self):
        return AccessPointSettings.instances[0]

    @property
    def hasSettings(self):
        return self.ModSettings

    def Initialize(self):
        self.SetRules()

    def SetRules(self):
        pass

    def ClearRules(self):
        pass

    def Configure(self):
        self.ConfigWindow.show()

    def boot(self):
        if self.CMD_ARRAY:
            self.reactor = ProcessThread({"python": self.CMD_ARRAY})
            self.reactor._ProcssOutput.connect(self.LogOutput)
            self.reactor.setObjectName(self.ID)

    def shutdown(self):
        if self.reactor is not None:
            self.reactor.stop()
            if hasattr(self.reactor, "wait"):
                if not self.reactor.wait(msecs=500):
                    self.reactor.terminate()

    def LogOutput(self, data):
        if self.conf.get("accesspoint", "status_ap", format=bool):
            self.logger.info(data)