diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a8f703..5bd475b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file. - added new command dhcpmode - added option for settings dhcp mode pydhcpserver or dhcpd_server - added new support to run isc_dhcp_server for dns/ dhcp +- added support kali linux iptables nf_tables set iptables_legacy as default #140 ### Changed diff --git a/README.md b/README.md index b08a13d..ce01acc 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ - Credentials harvesting - Transparent Proxies - LLMNR, NBT-NS and MDNS poisoner ([Responder3](https://github.com/skelsec/Responder3)) -- RestFulAPI +- RestFulAPI (disabled) - and **more**! ### Donation diff --git a/config/app/config.ini b/config/app/config.ini index e32685f..49603e2 100644 --- a/config/app/config.ini +++ b/config/app/config.ini @@ -103,7 +103,7 @@ router=10.0.0.1 subnet=10.0.0.0 [iptables] -path_binary=/sbin/iptables +path_binary="" iptables_0_masq=-w -P FORWARD ACCEPT iptables_A_masq=-w -t nat -A POSTROUTING --out-interface $inet -j MASQUERADE iptables_B_forward="-w -A FORWARD -i $inet --out-interface $wlan -j ACCEPT -m state --state RELATED,ESTABLISHED" diff --git a/exceptions/iptables_path_not_found.txt b/exceptions/iptables_path_not_found.txt new file mode 100644 index 0000000..7c92406 --- /dev/null +++ b/exceptions/iptables_path_not_found.txt @@ -0,0 +1,6 @@ +The wp3 require iptables for share and configure internet conneciton +and build somes attack of redirect traffic for plugins work fine. + +Please install the iptables v1.6, or install current version of +iptables with version legacy installed. The wp3 not support nftables +by default. \ No newline at end of file diff --git a/wifipumpkin3/core/common/platforms.py b/wifipumpkin3/core/common/platforms.py index cf17e78..e7c616e 100644 --- a/wifipumpkin3/core/common/platforms.py +++ b/wifipumpkin3/core/common/platforms.py @@ -192,6 +192,18 @@ class Linux(QtCore.QObject): my_id = str(uuid1()) return my_id + @staticmethod + def getBinaryPath(command: str): + binary_path = popen("which {}".format(command)).read() + if not binary_path: + return "" + return binary_path.split("\n")[0] + + @staticmethod + def checkIfIptablesVersion(): + if "nf_tables" in Linux.getBinaryPath("iptables"): + return Linux.getBinaryPath("iptables-legacy") + return Linux.getBinaryPath("iptables") def is_hexadecimal(text): try: diff --git a/wifipumpkin3/core/controllers/proxycontroller.py b/wifipumpkin3/core/controllers/proxycontroller.py index 4a0bef5..93aff59 100644 --- a/wifipumpkin3/core/controllers/proxycontroller.py +++ b/wifipumpkin3/core/controllers/proxycontroller.py @@ -3,6 +3,7 @@ from wifipumpkin3.core.common.uimodel import * from wifipumpkin3.core.servers.proxy import * from wifipumpkin3.core.utility.component import ControllerBlueprint import copy +from wifipumpkin3.exceptions.errors.iptablesException import IptablesPathError # This file is part of the wifipumpkin3 Open Source Project. # wifipumpkin3 is licensed under the Apache 2.0. @@ -68,6 +69,14 @@ class ProxyModeController(PluginsUI, ControllerBlueprint): if hasattr(p, "ID"): setattr(self, p.ID, p) + self.resolverIPtablesVersion() + + def resolverIPtablesVersion(self): + iptables_path = Refactor.checkIfIptablesVersion() + if not iptables_path: + raise IptablesPathError("[Error] iptables tool not found") + self.conf.set("iptables", "path_binary", iptables_path) + def isChecked(self): return self.conf.get("plugins", self.ID, format=bool) diff --git a/wifipumpkin3/exceptions/errors/iptablesException.py b/wifipumpkin3/exceptions/errors/iptablesException.py new file mode 100644 index 0000000..3dd1a6c --- /dev/null +++ b/wifipumpkin3/exceptions/errors/iptablesException.py @@ -0,0 +1,22 @@ +from wifipumpkin3.exceptions.base import ExceptionTemplate + +# This file is part of the wifipumpkin3 Open Source Project. +# wifipumpkin3 is licensed under the Apache 2.0. + +# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f) + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +class IptablesPathError(ExceptionTemplate): + filename = "iptables_path_not_found" \ No newline at end of file