mirror of
https://github.com/Cronocide/wifipumpkin3.git
synced 2025-01-22 11:18:55 +00:00
Merge branch 'P0cL4bs:dev' into dev
This commit is contained in:
commit
2535fd0ff6
9
.gitignore
vendored
9
.gitignore
vendored
@ -6,6 +6,15 @@ __pycache__/
|
||||
*.so
|
||||
#*.log
|
||||
|
||||
venv/
|
||||
|
||||
|
||||
# debian package
|
||||
debian/wifipumpkin3/
|
||||
debian/wifipumpkin3.prerm.debhelper
|
||||
debian/wifipumpkin3.postinst.debhelper
|
||||
debian/wifipumpkin3.debhelper.log
|
||||
debian/.debhelper/
|
||||
#exclude vscode
|
||||
.vscode/
|
||||
.ideia/
|
||||
|
29
CHANGELOG.md
29
CHANGELOG.md
@ -1,6 +1,35 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.1.3]
|
||||
|
||||
### Added
|
||||
- improve: module extra_captiveflask to install without reinstall the tool
|
||||
- added: binary exec mode plugin options
|
||||
- added: debian package for build .deb
|
||||
- added: ignore venv from .gitignore
|
||||
- update: screenshot for version 1.1.3
|
||||
- update: readme information about version
|
||||
|
||||
### Changed
|
||||
- changed: control user login and logout with python object
|
||||
- moved: captiveflask and pumpkinproxy to console script on setup.py installation
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
- removed: responder3 depedencies now responder need to installed by default for use
|
||||
- removed: extensions for update from CLI ui
|
||||
|
||||
### Fixed
|
||||
- fixed: set python3 version on binary sslstrip3 and captiveflask
|
||||
- fixed: set path default config files to /usr/share/wifipumpkin3
|
||||
- fixed: improves code with black format
|
||||
- fixed: Werkzeug depedency flask 2.0
|
||||
|
||||
## [Released]
|
||||
|
||||
## [1.1.2]
|
||||
|
@ -6,7 +6,7 @@
|
||||
[![build status](https://github.com/mh4x0f/wifipumpkin3/workflows/Build/badge.svg)](https://github.com/mh4x0f/wifipumpkin3/actions)
|
||||
[![license](https://img.shields.io/badge/license-apache%202-orange)](https://github.com/mh4x0f/wifipumpkin3/blob/dev/LICENSE.md)
|
||||
[![changelog](https://img.shields.io/badge/change-log-yellow)](https://github.com/mh4x0f/wifipumpkin3/blob/dev/CHANGELOG.md)
|
||||
[![changelog](https://img.shields.io/badge/version-1.0.9-blue)](https://github.com/mh4x0f/wifipumpkin3/)
|
||||
[![changelog](https://img.shields.io/badge/version-1.1.3-blue)](https://github.com/mh4x0f/wifipumpkin3/)
|
||||
[![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
|
||||
|
||||
![AKUANDUBA](/docs/screenshot.png)
|
||||
@ -27,7 +27,6 @@
|
||||
- **DNS** monitoring service
|
||||
- Credentials harvesting
|
||||
- Transparent Proxies
|
||||
- LLMNR, NBT-NS and MDNS poisoner ([Responder3](https://github.com/skelsec/Responder3))
|
||||
- RestFulAPI (new)
|
||||
- and **more**!
|
||||
|
||||
|
@ -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]
|
||||
|
@ -1,50 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr-FR">
|
||||
<head>
|
||||
<title>Authentification</title>
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/util.css') }}">
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/main.css') }}">
|
||||
</head>
|
||||
<style>
|
||||
.content {
|
||||
max-width: 500px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.align {
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<body class="align">
|
||||
|
||||
|
||||
<div class="container">
|
||||
<!-- Page content -->
|
||||
<form method="POST" >
|
||||
Login:<br>
|
||||
<input type="text" name="login">
|
||||
<br>
|
||||
Password:<br>
|
||||
<input type="text" name="password">
|
||||
<br><br>
|
||||
<input type="submit" value="Envoyer">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,12 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr-FR">
|
||||
<head>
|
||||
<title>Authentification</title>
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/util.css') }}">
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/main.css') }}">
|
||||
</head>
|
||||
|
||||
<h1>Login successful</h1>
|
||||
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
3
debian/README.debian
vendored
Normal file
3
debian/README.debian
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
More information about usage here:
|
||||
|
||||
https://wifipumpkin3.github.io/docs/getting-started#usage
|
5
debian/changelog
vendored
Normal file
5
debian/changelog
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
wifipumpkin3 (1.1.2-1) unstable; urgency=low
|
||||
|
||||
* source package automatically created by stdeb 0.10.0
|
||||
|
||||
-- Marcos Bomfim (mh4x0f) - P0cL4bs Team <mh4root@gmail.com> Fri, 24 Jun 2022 11:31:30 -0300
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@ -0,0 +1 @@
|
||||
9
|
38
debian/control
vendored
Normal file
38
debian/control
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
Source: wifipumpkin3
|
||||
Maintainer: Marcos Bomfim (mh4x0f) - P0cL4bs Team <mh4root@gmail.com>
|
||||
Section: network
|
||||
Priority: optional
|
||||
Build-Depends: python3-setuptools, debhelper (>= 9),
|
||||
dh-python,
|
||||
python3 (>=3.7), python3-venv,
|
||||
python3-dnslib,
|
||||
python3-flask,
|
||||
python3-isc-dhcp-leases,
|
||||
python3-jwt,
|
||||
python3-netaddr,
|
||||
python3-netifaces,
|
||||
python3-pyqt5,
|
||||
python3-requests,
|
||||
python3-scapy,
|
||||
python3-tabulate,
|
||||
python3-urwid
|
||||
Standards-Version: 3.9.1
|
||||
Homepage: https://github.com/P0cL4bs/wifipumpkin3
|
||||
|
||||
Package: wifipumpkin3
|
||||
Architecture: all
|
||||
Depends: hostapd,
|
||||
iptables,
|
||||
iw,
|
||||
libssl-dev,
|
||||
libffi-dev,
|
||||
build-essential,
|
||||
net-tools,
|
||||
wireless-tools,
|
||||
${misc:Depends},
|
||||
${python3:Depends}
|
||||
Description: Powerful framework for rogue access point attack
|
||||
This package contains a powerful framework for rogue access point attack,
|
||||
written in Python, that allow and offer to security researchers, red teamers
|
||||
and reverse engineers to mount a wireless network to conduct a
|
||||
man-in-the-middle attack.
|
2
debian/files
vendored
Normal file
2
debian/files
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
wifipumpkin3_1.1.2-1_all.deb network optional
|
||||
wifipumpkin3_1.1.2-1_amd64.buildinfo network optional
|
26
debian/rules
vendored
Executable file
26
debian/rules
vendored
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
# This file was automatically generated by stdeb 0.10.0 at
|
||||
# Fri, 24 Jun 2022 11:31:30 -0300
|
||||
|
||||
%:
|
||||
dh $@ --with python3 --buildsystem=python_distutils
|
||||
|
||||
override_dh_auto_clean:
|
||||
python3 setup.py clean -a
|
||||
find . -name \*.pyc -exec rm {} \;
|
||||
|
||||
override_dh_auto_build:
|
||||
python3 setup.py build --force
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_install config/ /usr/share/wifipumpkin3
|
||||
dh_install logs/ /usr/share/wifipumpkin3
|
||||
dh_install helps/ /usr/share/wifipumpkin3
|
||||
dh_install scripts/ /usr/share/wifipumpkin3
|
||||
dh_install exceptions/ /usr/share/wifipumpkin3
|
||||
python3 setup.py install --force --root=debian/wifipumpkin3 --no-compile -O0 --install-layout=deb
|
||||
|
||||
override_dh_python2:
|
||||
dh_python2 --no-guessing-versions
|
||||
|
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@ -0,0 +1 @@
|
||||
3.0 (native)
|
1
debian/source/options
vendored
Normal file
1
debian/source/options
vendored
Normal file
@ -0,0 +1 @@
|
||||
extend-diff-ignore="\.egg-info$"
|
1
debian/wifipumpkin3.install
vendored
Normal file
1
debian/wifipumpkin3.install
vendored
Normal file
@ -0,0 +1 @@
|
||||
config logs helps scripts exceptions usr/share/wifipumpkin3/
|
3
debian/wifipumpkin3.substvars
vendored
Normal file
3
debian/wifipumpkin3.substvars
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
python3:Depends=python3-bs4, python3-dnslib, python3-dnspython, python3-flask (>= 1.1.1), python3-isc-dhcp-leases, python3-jwt, python3-markupsafe, python3-netaddr, python3-netifaces, python3-openssl, python3-requests, python3-scapy, python3-tabulate, python3-termcolor, python3-twisted, python3-urwid, python3-werkzeug, python3:any
|
||||
misc:Depends=
|
||||
misc:Pre-Depends=
|
Binary file not shown.
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 958 KiB |
@ -1,17 +1,6 @@
|
||||
|
||||
How to apply plugins configuration
|
||||
==================================
|
||||
Plugins Installation
|
||||
====================
|
||||
|
||||
Now, you need to reinstall the tool,
|
||||
you have to reinstall on version the python installed,
|
||||
let's go:
|
||||
# for python3.7
|
||||
$ sudo python3.7 setup.py install
|
||||
# for python3.8
|
||||
$ sudo python3.8 setup.py install
|
||||
|
||||
if you running on Kali linux, only need to:
|
||||
|
||||
$ sudo python3 setup.py install
|
||||
|
||||
have fun! Hack the Planet
|
||||
You will need to restart the wp3
|
||||
to complete the installation.
|
||||
|
13
helps/help_install_customcaptiveflask.txt
Normal file
13
helps/help_install_customcaptiveflask.txt
Normal file
@ -0,0 +1,13 @@
|
||||
install new template on captiveflask:
|
||||
|
||||
Usage: install plugin_name file_complete_path.zip
|
||||
param plugin_name: the plugin_name name is the same [plugin_name].py
|
||||
file_complete_path.zip: complete file path with .zip
|
||||
|
||||
Description:
|
||||
Install a custom captiveflask templates from command line
|
||||
require restart the wifipumpkin3 for load all plugins
|
||||
|
||||
|
||||
Referencies:
|
||||
https://wifipumpkin3.github.io/docs/getting-started#creating-captive-portal-template
|
@ -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
|
||||
|
@ -4,21 +4,19 @@ 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
|
||||
Werkzeug<2.0,>=0.15
|
||||
Werkzeug
|
16
setup.py
16
setup.py
@ -35,9 +35,11 @@ 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 = os.path.expanduser("~") + "/.config/wifipumpkin3"
|
||||
user_config_dir = config_dir
|
||||
if not os.path.isdir(user_config_dir):
|
||||
os.makedirs(user_config_dir, exist_ok=True)
|
||||
# force copy all files `config` to 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",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
@ -1,3 +1,3 @@
|
||||
__version__ = "1.1.2"
|
||||
__version__ = "1.1.3"
|
||||
__codename__ = "Yorixiriamori"
|
||||
__branch__ = "dev"
|
||||
|
@ -40,7 +40,7 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
|
||||
@property
|
||||
def getDefault(self):
|
||||
""" return DefaultWidget instance for load controllers """
|
||||
"""return DefaultWidget instance for load controllers"""
|
||||
return DefaultController.getInstance()
|
||||
|
||||
def __init__(self, parse_args):
|
||||
@ -62,7 +62,7 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
super(PumpkinShell, self).__init__(parse_args=self.parse_args)
|
||||
|
||||
def initialize_core(self):
|
||||
""" this method is called in __init__ """
|
||||
"""this method is called in __init__"""
|
||||
# set current session unique id
|
||||
self.conf.set("accesspoint", "current_session", self.currentSessionID)
|
||||
if self.parse_args.interface:
|
||||
@ -163,7 +163,7 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
return display_tabulate(headers_table, output_table)
|
||||
|
||||
def do_mode(self, args):
|
||||
"""ap: all wireless mode available """
|
||||
"""ap: all wireless mode available"""
|
||||
headers_table, output_table = ["ID", "Activate", "Description"], []
|
||||
print(display_messages("Available Wireless Mode:", info=True, sublime=True))
|
||||
for id_mode, info in self.wireless_controller.getInfo().items():
|
||||
@ -297,21 +297,21 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
self.threads["RogueAP"] = []
|
||||
|
||||
def do_ignore(self, args):
|
||||
"""core: the message logger will be ignored """
|
||||
"""core: the message logger will be ignored"""
|
||||
logger = self.logger_manager.get(args)
|
||||
if logger != None:
|
||||
return logger.setIgnore(True)
|
||||
print(display_messages("Logger class not found.", error=True))
|
||||
|
||||
def do_restore(self, args):
|
||||
"""core: the message logger will be restored """
|
||||
"""core: the message logger will be restored"""
|
||||
logger = self.logger_manager.get(args)
|
||||
if logger != None:
|
||||
return logger.setIgnore(False)
|
||||
print(display_messages("Logger class not found.", error=True))
|
||||
|
||||
def do_clients(self, args):
|
||||
"""ap: show all connected clients on AP """
|
||||
"""ap: show all connected clients on AP"""
|
||||
self.uiwid_controller.ui_table_mod.start()
|
||||
|
||||
def do_stop(self, args):
|
||||
@ -319,7 +319,7 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
self.killThreads()
|
||||
|
||||
def do_jobs(self, args):
|
||||
"""ap: show all threads/processes in background """
|
||||
"""ap: show all threads/processes in background"""
|
||||
if len(self.threads["RogueAP"]) > 0:
|
||||
process_background = {}
|
||||
headers_table, output_table = ["ID", "PID"], []
|
||||
@ -352,7 +352,7 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
)
|
||||
|
||||
def do_set(self, args):
|
||||
"""core: set variable proxy,plugin and access point """
|
||||
"""core: set variable proxy,plugin and access point"""
|
||||
try:
|
||||
command, value = args.split()[0], args.split()[1]
|
||||
if "bssid" in command:
|
||||
@ -372,7 +372,7 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
for func in self.parser_list_func:
|
||||
if command in func or command.split(".")[0] in func:
|
||||
return getattr(self.parser_list_func[func], func)(value, args)
|
||||
|
||||
|
||||
# hook function configure plugin
|
||||
for plugin in self.parser_autcomplete_func:
|
||||
if command in self.parser_autcomplete_func[plugin]:
|
||||
@ -383,11 +383,16 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
def do_unset(self, args):
|
||||
"""core: unset variable commnd hostapd_config"""
|
||||
try:
|
||||
group_name, key = args.split()[0].split('.')[0], args.split()[0].split('.')[1]
|
||||
group_name, key = (
|
||||
args.split()[0].split(".")[0],
|
||||
args.split()[0].split(".")[1],
|
||||
)
|
||||
if key in self.conf.get_all_childname(group_name):
|
||||
return self.conf.unset(group_name, key)
|
||||
print(
|
||||
display_messages("unknown key : {} for hostapd_config".format(key), error=True)
|
||||
display_messages(
|
||||
"unknown key : {} for hostapd_config".format(key), error=True
|
||||
)
|
||||
)
|
||||
except IndexError:
|
||||
return print(
|
||||
@ -454,7 +459,7 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
|
||||
def help_set(self):
|
||||
self.show_help_command("help_set_command")
|
||||
|
||||
|
||||
def help_unset(self):
|
||||
self.show_help_command("help_unset_command")
|
||||
|
||||
|
@ -33,7 +33,7 @@ from shutil import which
|
||||
class Linux(QtCore.QObject):
|
||||
@staticmethod
|
||||
def set_ip_forward(value):
|
||||
"""set forward to redirect packets """
|
||||
"""set forward to redirect packets"""
|
||||
with open(C.IPFORWARD, "w") as file:
|
||||
file.write(str(value))
|
||||
file.close()
|
||||
@ -44,20 +44,20 @@ class Linux(QtCore.QObject):
|
||||
|
||||
@staticmethod
|
||||
def getHwAddr(ifname):
|
||||
""" another functions for get mac adreess """
|
||||
"""another functions for get mac adreess"""
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
info = ioctl(s.fileno(), 0x8927, pack("256s", ifname[:15]))
|
||||
return ":".join(["%02x" % ord(char) for char in info[18:24]])
|
||||
|
||||
@staticmethod
|
||||
def kill_procInterfaceBusy():
|
||||
""" kill network processes are keeping the interface busy """
|
||||
"""kill network processes are keeping the interface busy"""
|
||||
willkill = ("wpa_supplicant", "dhclient") # for ethernet conntion
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def get_interfaces():
|
||||
""" get interfaces and check status connection """
|
||||
"""get interfaces and check status connection"""
|
||||
interfaces = {
|
||||
"activated": [None, None],
|
||||
"all": [],
|
||||
@ -91,14 +91,14 @@ class Linux(QtCore.QObject):
|
||||
|
||||
@staticmethod
|
||||
def get_Ipaddr(card):
|
||||
""" get ipadress by interface name"""
|
||||
"""get ipadress by interface name"""
|
||||
if card == None:
|
||||
return get_if_addr("{}".format(Linux.get_interfaces()["activated"][0]))
|
||||
return get_if_addr("{}".format(card))
|
||||
|
||||
@staticmethod
|
||||
def get_mac(host):
|
||||
""" return mac by ipadress local network """
|
||||
"""return mac by ipadress local network"""
|
||||
fields = popen('grep "%s " /proc/net/arp' % host).read().split()
|
||||
if len(fields) == 6 and fields[3] != "00:00:00:00:00:00":
|
||||
return fields[3]
|
||||
@ -107,7 +107,7 @@ class Linux(QtCore.QObject):
|
||||
|
||||
@staticmethod
|
||||
def get_interface_mac(device):
|
||||
""" get mac from interface local system """
|
||||
"""get mac from interface local system"""
|
||||
result = check_output(
|
||||
["ifconfig", device], stderr=STDOUT, universal_newlines=True
|
||||
)
|
||||
@ -121,14 +121,14 @@ class Linux(QtCore.QObject):
|
||||
|
||||
@staticmethod
|
||||
def randomMacAddress(prefix):
|
||||
"""generate random mac for prefix """
|
||||
"""generate random mac for prefix"""
|
||||
for ount in range(6 - len(prefix)):
|
||||
prefix.append(randint(0x00, 0x7F))
|
||||
return ":".join(map(lambda x: "%02x" % x, prefix))
|
||||
|
||||
@staticmethod
|
||||
def check_is_mac(value):
|
||||
"""check if mac is mac type """
|
||||
"""check if mac is mac type"""
|
||||
checked = compile(
|
||||
r"""(
|
||||
^([0-9A-F]{2}[-]){5}([0-9A-F]{2})$
|
||||
@ -143,14 +143,14 @@ class Linux(QtCore.QObject):
|
||||
|
||||
@staticmethod
|
||||
def find(name, paths):
|
||||
""" find all files in directory """
|
||||
"""find all files in directory"""
|
||||
for root, dirs, files in walk(paths):
|
||||
if name in files:
|
||||
return path.join(root, name)
|
||||
|
||||
@staticmethod
|
||||
def getSize(filename):
|
||||
""" return files size by pathnme """
|
||||
"""return files size by pathnme"""
|
||||
st = stat(filename)
|
||||
return st.st_size
|
||||
|
||||
@ -170,7 +170,7 @@ class Linux(QtCore.QObject):
|
||||
|
||||
@staticmethod
|
||||
def readFileHelp(filename, mode="r"):
|
||||
""" return content the help files """
|
||||
"""return content the help files"""
|
||||
content = ""
|
||||
with open("{}{}.txt".format(C.HELPFILESPATH, filename), mode) as f:
|
||||
content = f.read()
|
||||
@ -179,7 +179,7 @@ class Linux(QtCore.QObject):
|
||||
|
||||
@staticmethod
|
||||
def readFileExceptions(filename, mode="r"):
|
||||
""" return content the any files .txt"""
|
||||
"""return content the any files .txt"""
|
||||
content = ""
|
||||
with open("{}{}.txt".format(C.EXCEPTFILESPATH, filename), mode) as f:
|
||||
content = f.read()
|
||||
@ -188,13 +188,13 @@ class Linux(QtCore.QObject):
|
||||
|
||||
@staticmethod
|
||||
def generate_session_id():
|
||||
""" return str session id """
|
||||
"""return str session id"""
|
||||
my_id = str(uuid1())
|
||||
return my_id
|
||||
|
||||
@staticmethod
|
||||
def getCommandOutput(command: str):
|
||||
""" get the first line of command executed on bash"""
|
||||
"""get the first line of command executed on bash"""
|
||||
binary_path = popen("{}".format(command)).read()
|
||||
if not binary_path:
|
||||
return ""
|
||||
@ -202,7 +202,7 @@ class Linux(QtCore.QObject):
|
||||
|
||||
@staticmethod
|
||||
def getBinaryPath(binary_name: str):
|
||||
""" get the path of binary linux"""
|
||||
"""get the path of binary linux"""
|
||||
binary_path = popen("which {}".format(binary_name)).read()
|
||||
if not binary_path:
|
||||
return ""
|
||||
@ -210,7 +210,7 @@ class Linux(QtCore.QObject):
|
||||
|
||||
@staticmethod
|
||||
def checkIfIptablesVersion():
|
||||
""" check if iptables version is nf_tables """
|
||||
"""check if iptables version is nf_tables"""
|
||||
if "nf_tables" in Linux.getCommandOutput("iptables --version"):
|
||||
return Linux.getBinaryPath("iptables-legacy")
|
||||
return Linux.getBinaryPath("iptables")
|
||||
@ -235,12 +235,12 @@ def is_ascii(text):
|
||||
|
||||
|
||||
def exec_bash(command):
|
||||
""" run command on background hide output"""
|
||||
"""run command on background hide output"""
|
||||
popen(command + " > /dev/null")
|
||||
|
||||
|
||||
def del_item_folder(directorys):
|
||||
""" delete all items in folder """
|
||||
"""delete all items in folder"""
|
||||
for folder in directorys:
|
||||
files = glob(folder)
|
||||
for file in files:
|
||||
@ -249,7 +249,7 @@ def del_item_folder(directorys):
|
||||
|
||||
|
||||
def is_tool(name):
|
||||
""" check if tool is installed on S.O"""
|
||||
"""check if tool is installed on S.O"""
|
||||
return which(name) is not None
|
||||
|
||||
|
||||
@ -288,13 +288,13 @@ class decoded(object):
|
||||
|
||||
def hexdump(src, length=16, sep="."):
|
||||
"""
|
||||
https://gist.github.com/ImmortalPC/c340564823f283fe530b
|
||||
@brief Return {src} in hex dump.
|
||||
@param[in] length {Int} Nb Bytes by row.
|
||||
@param[in] sep {Char} For the text part, {sep} will be used for non ASCII char.
|
||||
@return {Str} The hexdump
|
||||
@note Full support for python2 and python3 !
|
||||
"""
|
||||
https://gist.github.com/ImmortalPC/c340564823f283fe530b
|
||||
@brief Return {src} in hex dump.
|
||||
@param[in] length {Int} Nb Bytes by row.
|
||||
@param[in] sep {Char} For the text part, {sep} will be used for non ASCII char.
|
||||
@return {Str} The hexdump
|
||||
@note Full support for python2 and python3 !
|
||||
"""
|
||||
result = []
|
||||
|
||||
# Python3 support
|
||||
|
@ -25,17 +25,18 @@ import weakref
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
class ConsoleUIBase(Cmd):
|
||||
""" shell console UI base model """
|
||||
|
||||
"""shell console UI base model"""
|
||||
|
||||
def setOptions(self):
|
||||
if self.parse_args.pulp:
|
||||
self.loadPulpFiles(self.parse_args.pulp)
|
||||
elif self.parse_args.xpulp:
|
||||
self.onecmd(self.parse_args.xpulp, ";")
|
||||
|
||||
|
||||
def default(self, args: str):
|
||||
""" run commands system allow by tool """
|
||||
"""run commands system allow by tool"""
|
||||
for goodArgs in C.SYSTEMCOMMAND:
|
||||
if args.startswith(goodArgs):
|
||||
output = popen(args).read()
|
||||
@ -51,9 +52,10 @@ class ConsoleUIBase(Cmd):
|
||||
print(
|
||||
display_messages(
|
||||
"wp3: command not found: {}".format(setcolor(args, "red", False)),
|
||||
error=True
|
||||
))
|
||||
|
||||
error=True,
|
||||
)
|
||||
)
|
||||
|
||||
@property
|
||||
def getCommmandsNames(self):
|
||||
names = self.get_names()
|
||||
@ -66,7 +68,7 @@ class ConsoleUIBase(Cmd):
|
||||
return tuple(cmds_do)
|
||||
|
||||
def emptyline(self):
|
||||
""" Do nothing on empty input line"""
|
||||
"""Do nothing on empty input line"""
|
||||
pass
|
||||
|
||||
def precmd(self, line):
|
||||
@ -78,34 +80,34 @@ class ConsoleUIBase(Cmd):
|
||||
|
||||
def postcmd(self, stop, line):
|
||||
return stop
|
||||
|
||||
|
||||
def onecmd(self, commands, separator=";"):
|
||||
""" load command separate for ; file or string"""
|
||||
"""load command separate for ; file or string"""
|
||||
for command in commands.split(separator):
|
||||
Cmd.onecmd(self, command)
|
||||
|
||||
|
||||
def show_help_command(self, filename):
|
||||
"""read content file help command """
|
||||
"""read content file help command"""
|
||||
print(Linux.readFileHelp(filename))
|
||||
|
||||
|
||||
def loadPulpFiles(self, file, data=None):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
def set_prompt(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
def do_help(self, args):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class ConsoleUI(ConsoleUIBase):
|
||||
""" shell console UI """
|
||||
"""shell console UI"""
|
||||
|
||||
def __init__(self, parse_args=None):
|
||||
self.parse_args = parse_args
|
||||
Cmd.__init__(self)
|
||||
self.conf = SettingsINI.getInstance()
|
||||
self.set_prompt()
|
||||
self.set_prompt()
|
||||
self.initialize_core()
|
||||
self.setOptions()
|
||||
|
||||
@ -124,7 +126,7 @@ class ConsoleUI(ConsoleUIBase):
|
||||
raise NotImplementedError()
|
||||
|
||||
def loadPulpFiles(self, file, data=None):
|
||||
""" load and execute all commands in file pulp separate for \n """
|
||||
"""load and execute all commands in file pulp separate for \n"""
|
||||
print(
|
||||
"\n"
|
||||
+ display_messages(
|
||||
@ -161,7 +163,7 @@ class ConsoleUI(ConsoleUIBase):
|
||||
## Override methods in Cmd object ##
|
||||
def preloop(self):
|
||||
"""Initialization before prompting user for commands.
|
||||
Despite the claims in the Cmd documentaion, Cmd.preloop() is not a stub.
|
||||
Despite the claims in the Cmd documentaion, Cmd.preloop() is not a stub.
|
||||
"""
|
||||
Cmd.preloop(self) ## sets up command completion
|
||||
self._hist = [] ## No history yet
|
||||
@ -169,7 +171,7 @@ class ConsoleUI(ConsoleUIBase):
|
||||
self._globals = {}
|
||||
|
||||
def do_help(self, args):
|
||||
"""core: show this help """
|
||||
"""core: show this help"""
|
||||
if args:
|
||||
try:
|
||||
func = getattr(self, "help_" + args)
|
||||
@ -221,13 +223,13 @@ class ConsoleUI(ConsoleUIBase):
|
||||
print("\n")
|
||||
|
||||
def do_exit(self, args):
|
||||
""" exit the program."""
|
||||
"""exit the program."""
|
||||
print("Quitting.")
|
||||
raise SystemExit
|
||||
|
||||
|
||||
class ModuleUI(ConsoleUIBase):
|
||||
""" shell console UI """
|
||||
"""shell console UI"""
|
||||
|
||||
_name_module = None
|
||||
completions = None
|
||||
@ -291,7 +293,7 @@ class ModuleUI(ConsoleUIBase):
|
||||
self._name_module = name
|
||||
|
||||
def do_back(self, args):
|
||||
""" go back one level"""
|
||||
"""go back one level"""
|
||||
try:
|
||||
self.check_is_background_mode()
|
||||
if self._background_mode:
|
||||
@ -303,7 +305,7 @@ class ModuleUI(ConsoleUIBase):
|
||||
sys.exit(0)
|
||||
|
||||
def do_set(self, args):
|
||||
""" set options for module """
|
||||
"""set options for module"""
|
||||
try:
|
||||
command, value = args.split()[0], args.split()[1]
|
||||
if command in self.options.keys():
|
||||
@ -317,7 +319,7 @@ class ModuleUI(ConsoleUIBase):
|
||||
pass
|
||||
|
||||
def do_options(self, line):
|
||||
""" show options of current module"""
|
||||
"""show options of current module"""
|
||||
headers_table, output_table = ["Option", "Value", "Description"], []
|
||||
for option, value in self.options.items():
|
||||
output_table.append([option, value[0], value[1]])
|
||||
@ -325,7 +327,7 @@ class ModuleUI(ConsoleUIBase):
|
||||
return display_tabulate(headers_table, output_table)
|
||||
|
||||
def do_help(self, args):
|
||||
""" show this help """
|
||||
"""show this help"""
|
||||
if args:
|
||||
try:
|
||||
func = getattr(self, "help_" + args)
|
||||
@ -362,7 +364,7 @@ class ModuleUI(ConsoleUIBase):
|
||||
print("\n")
|
||||
|
||||
def loadPulpFiles(self, file, data=None):
|
||||
""" load and execute all commands in file pulp separate for \n """
|
||||
"""load and execute all commands in file pulp separate for \n"""
|
||||
if path.isfile(file):
|
||||
with open(file, "r") as f:
|
||||
data = f.read()
|
||||
@ -377,7 +379,7 @@ class ModuleUI(ConsoleUIBase):
|
||||
return [s[offs:] for s in self.completions if s.startswith(mline)]
|
||||
|
||||
def onecmd(self, commands, separator=";"):
|
||||
""" load command separate for ; file or string"""
|
||||
"""load command separate for ; file or string"""
|
||||
for command in commands.split(separator):
|
||||
if not str(command).startswith("use"):
|
||||
Cmd.onecmd(self, command)
|
||||
@ -387,7 +389,7 @@ class ModuleUI(ConsoleUIBase):
|
||||
|
||||
|
||||
class ExtensionUI(ConsoleUIBase):
|
||||
""" native extension console UI """
|
||||
"""native extension console UI"""
|
||||
|
||||
_name_module = None
|
||||
completions = None
|
||||
@ -408,5 +410,5 @@ class ExtensionUI(ConsoleUIBase):
|
||||
self._name_module = name
|
||||
|
||||
def register_command(self, name_func, func):
|
||||
"""register a command on super class Pumpkinshell """
|
||||
"""register a command on super class Pumpkinshell"""
|
||||
setattr(self.root.__class__, name_func, staticmethod(func))
|
||||
|
@ -48,11 +48,11 @@ class DHCPServerProcess(QThread):
|
||||
self._ProcssOutput.emit(self.queue.get())
|
||||
|
||||
def getpid(self):
|
||||
""" return the pid of current process in background"""
|
||||
"""return the pid of current process in background"""
|
||||
return self.procDHCP.pid
|
||||
|
||||
def getID(self):
|
||||
""" return the name of process in background"""
|
||||
"""return the name of process in background"""
|
||||
return self.objectName()
|
||||
|
||||
def stop(self):
|
||||
@ -82,11 +82,11 @@ class ProcessThread(QThread):
|
||||
pass
|
||||
|
||||
def getpid(self):
|
||||
""" return the pid of current process in background"""
|
||||
"""return the pid of current process in background"""
|
||||
return self.procThread.pid()
|
||||
|
||||
def getID(self):
|
||||
""" return the name of process in background"""
|
||||
"""return the name of process in background"""
|
||||
return self.objectName()
|
||||
|
||||
def start(self):
|
||||
@ -171,26 +171,19 @@ class ProcessHostapd(QObject):
|
||||
self.started = False
|
||||
|
||||
def getpid(self):
|
||||
""" return the pid of current process in background"""
|
||||
"""return the pid of current process in background"""
|
||||
return self.procHostapd.pid()
|
||||
|
||||
def getID(self):
|
||||
""" return the name of process in background"""
|
||||
"""return the name of process in background"""
|
||||
return self.objectName()
|
||||
|
||||
def removeInactivityClient(self, client_mac):
|
||||
all_clients = Refactor.readFileDataToJson(C.CLIENTS_CONNECTED)
|
||||
if client_mac in all_clients.keys():
|
||||
del all_clients[client_mac]
|
||||
Refactor.writeFileDataToJson(C.CLIENTS_CONNECTED, all_clients)
|
||||
|
||||
def read_OutputCommand(self):
|
||||
self.data = str(self.procHostapd.readAllStandardOutput(), encoding="ascii")
|
||||
if (
|
||||
"AP-STA-DISCONNECTED" in self.data.rstrip()
|
||||
or "inactivity (timer DEAUTH/REMOVE)" in self.data.rstrip()
|
||||
):
|
||||
self.removeInactivityClient(self.data.split()[2])
|
||||
self.statusAP_connected.emit(self.data.split()[2])
|
||||
# check error hostapd log
|
||||
for error in self.errorAPDriver:
|
||||
|
@ -39,7 +39,7 @@ class CoreSettings(Linux):
|
||||
self.conf = SettingsINI(C.CONFIG_INI)
|
||||
|
||||
def deleteObject(self, obj):
|
||||
""" reclaim memory """
|
||||
"""reclaim memory"""
|
||||
del obj
|
||||
|
||||
def apply_dhcp_config_leases_config(self, settingsAP):
|
||||
|
@ -36,7 +36,7 @@ from wifipumpkin3.core.widgets.default.logger_manager import StandardLog, Logger
|
||||
|
||||
|
||||
def deleteObject(obj):
|
||||
""" reclaim memory """
|
||||
"""reclaim memory"""
|
||||
del obj
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ def ProgramPath(executablename):
|
||||
|
||||
|
||||
def get_mac_vendor(mac):
|
||||
""" discovery mac vendor by mac address """
|
||||
"""discovery mac vendor by mac address"""
|
||||
try:
|
||||
d_vendor = EUI(mac)
|
||||
d_vendor = d_vendor.oui.registration().org
|
||||
@ -60,7 +60,7 @@ def get_mac_vendor(mac):
|
||||
|
||||
|
||||
def exec_bash(command):
|
||||
""" run command on background hide output"""
|
||||
"""run command on background hide output"""
|
||||
os.popen(command)
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ class DefaultController(Qt.QObject):
|
||||
self.intialize_controllers(self.parent)
|
||||
|
||||
def intialize_controllers(self, parent):
|
||||
""" initialize all controllers"""
|
||||
"""initialize all controllers"""
|
||||
WirelessModeController(parent)
|
||||
DHCPController(parent)
|
||||
DNSController(parent)
|
||||
@ -66,11 +66,11 @@ class DefaultController(Qt.QObject):
|
||||
return cls.instances[0]
|
||||
|
||||
def addController(self, instance):
|
||||
""" add controller instance app """
|
||||
"""add controller instance app"""
|
||||
self._controllers[instance.getID()] = instance
|
||||
|
||||
def getController(self, name):
|
||||
""" get controller instance app """
|
||||
"""get controller instance app"""
|
||||
if name:
|
||||
return self._controllers.get(name)
|
||||
return self._controllers
|
||||
|
@ -110,7 +110,7 @@ class ProxyModeController(PluginsUI, ControllerBlueprint):
|
||||
|
||||
@property
|
||||
def ActiveLoad(self):
|
||||
""" load all proxies type checkbox UI in tab plugins """
|
||||
"""load all proxies type checkbox UI in tab plugins"""
|
||||
proxies = []
|
||||
for act in self.proxies.values():
|
||||
if act.isChecked():
|
||||
|
@ -65,7 +65,7 @@ class WirelessModeController(ControllerBlueprint):
|
||||
return AccessPointSettings.instances[0]
|
||||
|
||||
def Start(self):
|
||||
""" start Access Point and settings plugins """
|
||||
"""start Access Point and settings plugins"""
|
||||
# if not type(self.Activated.get_soft_dependencies()) is bool: return
|
||||
|
||||
self.Activated.Start()
|
||||
@ -97,7 +97,7 @@ class AccessPointSettings(CoreSettings):
|
||||
|
||||
@property
|
||||
def getActiveMode(self):
|
||||
""" get mode activated from settings file """
|
||||
"""get mode activated from settings file"""
|
||||
for mode in self.__modelist:
|
||||
if mode.isChecked():
|
||||
return mode
|
||||
@ -138,7 +138,7 @@ class AccessPointSettings(CoreSettings):
|
||||
for command in commands:
|
||||
list_commands.append("security" + "." + command)
|
||||
return list_commands
|
||||
|
||||
|
||||
@property
|
||||
def getCommandsHostapd(self):
|
||||
commands_host = self.conf.get_all_childname("hostapd_config")
|
||||
@ -164,7 +164,7 @@ class AccessPointSettings(CoreSettings):
|
||||
print(display_messages("unknown flag: {}".format(key), error=True))
|
||||
except IndexError:
|
||||
print(display_messages("unknown sintax command", error=True))
|
||||
|
||||
|
||||
def parser_set_dhcpconf(self, value, settings):
|
||||
try:
|
||||
# settings = settings.netmask 255.0.0.0
|
||||
@ -177,14 +177,14 @@ class AccessPointSettings(CoreSettings):
|
||||
|
||||
def parser_set_hostapd_config(self, value, settings):
|
||||
try:
|
||||
# settings = hostapd_extra.logger_syslog 1
|
||||
# settings = hostapd_extra.logger_syslog 1
|
||||
name, key = settings.split(".")[0], settings.split(".")[1].split()[0]
|
||||
return self.conf.set("hostapd_config", key, value)
|
||||
except IndexError:
|
||||
print(display_messages("unknown sintax command", error=True))
|
||||
|
||||
def configure_network_AP(self):
|
||||
""" configure interface and dhcpd for mount Access Point """
|
||||
"""configure interface and dhcpd for mount Access Point"""
|
||||
self.DHCP = self.Settings.DHCP.conf
|
||||
self.SettingsEnable["PortRedirect"] = self.settings.get_setting(
|
||||
"settings", "redirect_port"
|
||||
|
@ -25,7 +25,7 @@ from wifipumpkin3.core.utility.printer import display_messages
|
||||
|
||||
|
||||
class IpAddressClass(object):
|
||||
""" class for generator ipaddress """
|
||||
"""class for generator ipaddress"""
|
||||
|
||||
def __init__(self, range):
|
||||
self.range = range
|
||||
@ -197,11 +197,11 @@ class DHCPThread(QThread):
|
||||
print(display_messages("socket error: {}".format(e), error=True))
|
||||
|
||||
def getpid(self):
|
||||
""" return the pid of current process in background"""
|
||||
"""return the pid of current process in background"""
|
||||
return "thread"
|
||||
|
||||
def getID(self):
|
||||
""" return the name of process in background"""
|
||||
"""return the name of process in background"""
|
||||
return self.objectName()
|
||||
|
||||
def stop(self):
|
||||
|
@ -73,7 +73,10 @@ class Record:
|
||||
ttl = 300
|
||||
|
||||
self.rr = RR(
|
||||
rname=self._rname, rtype=self._rtype, rdata=rd_cls(*args), ttl=ttl,
|
||||
rname=self._rname,
|
||||
rtype=self._rtype,
|
||||
rdata=rd_cls(*args),
|
||||
ttl=ttl,
|
||||
)
|
||||
|
||||
def match(self, q):
|
||||
@ -167,19 +170,19 @@ class Resolver(ProxyResolver):
|
||||
class LocalDNSLogger(object):
|
||||
|
||||
"""
|
||||
The class provides a default set of logging functions for the various
|
||||
stages of the request handled by a DNSServer instance which are
|
||||
enabled/disabled by flags in the 'log' class variable.
|
||||
To customise logging create an object which implements the LocalDNSLogger
|
||||
interface and pass instance to DNSServer.
|
||||
The methods which the logger instance must implement are:
|
||||
log_recv - Raw packet received
|
||||
log_send - Raw packet sent
|
||||
log_request - DNS Request
|
||||
log_reply - DNS Response
|
||||
log_truncated - Truncated
|
||||
log_error - Decoding error
|
||||
log_data - Dump full request/response
|
||||
The class provides a default set of logging functions for the various
|
||||
stages of the request handled by a DNSServer instance which are
|
||||
enabled/disabled by flags in the 'log' class variable.
|
||||
To customise logging create an object which implements the LocalDNSLogger
|
||||
interface and pass instance to DNSServer.
|
||||
The methods which the logger instance must implement are:
|
||||
log_recv - Raw packet received
|
||||
log_send - Raw packet sent
|
||||
log_request - DNS Request
|
||||
log_reply - DNS Response
|
||||
log_truncated - Truncated
|
||||
log_error - Decoding error
|
||||
log_data - Dump full request/response
|
||||
"""
|
||||
|
||||
def __init__(self, logger):
|
||||
@ -248,7 +251,7 @@ class LocalDNSLogger(object):
|
||||
|
||||
|
||||
class DNSServerThread(QThread):
|
||||
""" Simple DNS server UDP resolver """
|
||||
"""Simple DNS server UDP resolver"""
|
||||
|
||||
sendRequests = pyqtSignal(object) # I'll use this object in future feature
|
||||
|
||||
@ -281,11 +284,11 @@ class DNSServerThread(QThread):
|
||||
pass
|
||||
|
||||
def getpid(self):
|
||||
""" return the pid of current process in background"""
|
||||
"""return the pid of current process in background"""
|
||||
return "thread"
|
||||
|
||||
def getID(self):
|
||||
""" return the name of process in background"""
|
||||
"""return the name of process in background"""
|
||||
return self.objectName()
|
||||
|
||||
def stop(self):
|
||||
|
@ -26,7 +26,7 @@ from netfilterqueue import NetfilterQueue
|
||||
|
||||
class DnsSpoofNetFilter(object):
|
||||
def __init__(self):
|
||||
""" implementation Dnsspoof with Netfilterqueue modules"""
|
||||
"""implementation Dnsspoof with Netfilterqueue modules"""
|
||||
description = "Module DNS spoofing v0.1"
|
||||
usage = "Usage: use --help for futher information"
|
||||
parser = argparse.ArgumentParser(description=description, usage=usage)
|
||||
|
@ -41,10 +41,7 @@ class ThreadDeauth(QThread):
|
||||
)
|
||||
/ Dot11Deauth(reason=7)
|
||||
)
|
||||
pkt2 = (
|
||||
Dot11(addr1=bssid, addr2=client, addr3=client)
|
||||
/ Dot11Deauth()
|
||||
)
|
||||
pkt2 = Dot11(addr1=bssid, addr2=client, addr3=client) / Dot11Deauth()
|
||||
self.pkts.append(pkt1)
|
||||
self.pkts.append(pkt2)
|
||||
|
||||
@ -59,7 +56,7 @@ class ThreadDeauth(QThread):
|
||||
conf.iface = self.interface
|
||||
for target in self._mac_blacklist:
|
||||
self.build_packetRadioTap(target, self.client)
|
||||
|
||||
|
||||
while self.status:
|
||||
for packet in self.pkts:
|
||||
sendp(packet, verbose=False, count=1, iface=self.interface)
|
||||
|
@ -39,7 +39,7 @@ class DHCPServers(QtCore.QObject, ComponentBlueprint):
|
||||
super(DHCPServers, self).__init__()
|
||||
self.parent = parent
|
||||
self.conf = SuperSettings.getInstance()
|
||||
|
||||
self._connected = {}
|
||||
self.loggermanager = LoggerManager.getInstance()
|
||||
self.configure_logger()
|
||||
|
||||
@ -81,7 +81,7 @@ class DHCPServers(QtCore.QObject, ComponentBlueprint):
|
||||
def Stop(self):
|
||||
self.shutdown()
|
||||
self.reactor.stop()
|
||||
Refactor.writeFileDataToJson(C.CLIENTS_CONNECTED, {}, "w")
|
||||
self._connected = dict()
|
||||
|
||||
def Start(self):
|
||||
self.prereq()
|
||||
@ -110,7 +110,7 @@ class DHCPServers(QtCore.QObject, ComponentBlueprint):
|
||||
raise DHCPdServerNotFound("DHCPServer", "The binary (dhcpd) not found")
|
||||
|
||||
def get_mac_vendor(self, mac):
|
||||
""" discovery mac vendor by mac address """
|
||||
"""discovery mac vendor by mac address"""
|
||||
try:
|
||||
d_vendor = EUI(mac)
|
||||
d_vendor = d_vendor.oui.registration().org
|
||||
@ -118,6 +118,13 @@ class DHCPServers(QtCore.QObject, ComponentBlueprint):
|
||||
d_vendor = "unknown mac"
|
||||
return d_vendor
|
||||
|
||||
def removeInactivityClient(self, mac: str):
|
||||
if mac in self._connected:
|
||||
self._connected.pop(mac)
|
||||
|
||||
@property
|
||||
def getStaClients(self):
|
||||
return self._connected
|
||||
|
||||
class DHCPSettings(CoreSettings):
|
||||
Name = "WP DHCP"
|
||||
|
@ -18,7 +18,6 @@ class DhcpdServer(DHCPServers):
|
||||
def __init__(self, parent=0):
|
||||
super(DhcpdServer, self).__init__(parent)
|
||||
self._isRunning = False
|
||||
self._connected = {}
|
||||
self.leases = {}
|
||||
|
||||
def setIsRunning(self, value):
|
||||
@ -27,7 +26,7 @@ class DhcpdServer(DHCPServers):
|
||||
@property
|
||||
def getStatusReactor(self):
|
||||
return self._isRunning
|
||||
|
||||
|
||||
def Initialize(self):
|
||||
self.ifaceHostapd = self.conf.get("accesspoint", "interface")
|
||||
leases = C.DHCPLEASES_PATH
|
||||
@ -60,16 +59,16 @@ class DhcpdServer(DHCPServers):
|
||||
)
|
||||
print(
|
||||
display_messages(
|
||||
"{} client join the AP IpAddr::[{}]".format(
|
||||
setcolor(mac, color="green"),
|
||||
setcolor(user_info["IP"], color="green"),
|
||||
"{} client join the AP".format(
|
||||
setcolor(mac, color="green")
|
||||
),
|
||||
info=True,
|
||||
)
|
||||
)
|
||||
self._connected[mac] = user_info
|
||||
|
||||
def logOutputDhcpServer(self, data):
|
||||
""" filter: data info sended DHCPD request """
|
||||
"""filter: data info sended DHCPD request"""
|
||||
raw_data = data
|
||||
data = data.split()
|
||||
if self.conf.get("accesspoint", "status_ap", format=bool):
|
||||
@ -124,7 +123,6 @@ class DhcpdServer(DHCPServers):
|
||||
self.add_DHCP_Requests_clients(data[4], self.leases[data[4]])
|
||||
|
||||
self.logger.info(raw_data)
|
||||
Refactor.writeFileDataToJson(C.CLIENTS_CONNECTED, self.leases, "w")
|
||||
|
||||
@property
|
||||
def commandargs(self):
|
||||
|
@ -29,7 +29,6 @@ class PyDHCP(DHCPServers):
|
||||
def __init__(self, parent=0):
|
||||
super(PyDHCP, self).__init__(parent)
|
||||
self._isRunning = False
|
||||
self._connected = {}
|
||||
|
||||
def Initialize(self):
|
||||
self.ifaceHostapd = self.conf.get("accesspoint", "interface")
|
||||
@ -41,7 +40,7 @@ class PyDHCP(DHCPServers):
|
||||
def getStatusReactor(self):
|
||||
return self._isRunning
|
||||
|
||||
def get_DHCPoutPut(self, data):
|
||||
def observerDHCPLeasesClient(self, data):
|
||||
self._connected[data["MAC"]] = data
|
||||
if self.conf.get("accesspoint", "status_ap", format=bool):
|
||||
print(
|
||||
@ -55,6 +54,6 @@ class PyDHCP(DHCPServers):
|
||||
|
||||
def boot(self):
|
||||
self.reactor = DHCPThread(self.ifaceHostapd, self.DHCPConf)
|
||||
self.reactor.DHCPProtocol._request.connect(self.get_DHCPoutPut)
|
||||
self.reactor.DHCPProtocol._request.connect(self.observerDHCPLeasesClient)
|
||||
self.reactor.send_output.connect(self.LogOutput)
|
||||
self.reactor.setObjectName(self.ID)
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
)
|
||||
)
|
@ -37,7 +37,7 @@ class TCPProxyDock(DockableWidget):
|
||||
self.THeaders = OrderedDict([("Plugin", []), ("Logging", [])])
|
||||
|
||||
def writeModeData(self, data):
|
||||
""" get data output and add on QtableWidgets """
|
||||
"""get data output and add on QtableWidgets"""
|
||||
self.THeaders["Plugin"].append(data.keys()[0])
|
||||
self.THeaders["Logging"].append(data[data.keys()[0]])
|
||||
Headers = []
|
||||
@ -69,7 +69,7 @@ class Sniffkin3(MitmMode):
|
||||
self.check_PluginDict = {}
|
||||
|
||||
def setPluginOption(self, name, status):
|
||||
""" get each plugins status"""
|
||||
"""get each plugins status"""
|
||||
# enable realtime disable and enable plugin
|
||||
if self.conf.get("accesspoint", "status_ap", format=bool):
|
||||
self.reactor.disablePlugin(name, status)
|
||||
@ -82,8 +82,8 @@ class Sniffkin3(MitmMode):
|
||||
self.reactor.setObjectName(self.ID)
|
||||
self.reactor._ProcssOutput.connect(self.LogOutput)
|
||||
|
||||
def setDataColor(self, data=dict):
|
||||
""" set color in data log keys"""
|
||||
def setDataColor(self, data: dict):
|
||||
"""set color in data log keys"""
|
||||
if list(dict(data).keys())[0] == "urlsCap":
|
||||
data["urlsCap"]["Headers"]["Method"] = setcolor(
|
||||
data["urlsCap"]["Headers"]["Method"], color="orange_bg"
|
||||
@ -145,12 +145,8 @@ class Sniffkin3(MitmMode):
|
||||
)
|
||||
if key_plugin in self.config.get_all_childname("plugins"):
|
||||
return self.config.set("plugins", key_plugin, status)
|
||||
|
||||
print(
|
||||
display_messages(
|
||||
"unknown plugin: {}".format(key_plugin), error=True
|
||||
)
|
||||
)
|
||||
|
||||
print(display_messages("unknown plugin: {}".format(key_plugin), error=True))
|
||||
except IndexError:
|
||||
print(display_messages("unknown sintax command", error=True))
|
||||
|
||||
@ -295,11 +291,11 @@ class Sniffkin3Core(QtCore.QThread):
|
||||
return dict_head, None
|
||||
|
||||
def getpid(self):
|
||||
""" return the pid of current process in background"""
|
||||
"""return the pid of current process in background"""
|
||||
return "thread"
|
||||
|
||||
def getID(self):
|
||||
""" return the name of process in background"""
|
||||
"""return the name of process in background"""
|
||||
return self.objectName()
|
||||
|
||||
def stop(self):
|
||||
|
@ -36,7 +36,7 @@ class TCPProxyDock(DockableWidget):
|
||||
self.THeaders = OrderedDict([("Plugin", []), ("Logging", [])])
|
||||
|
||||
def writeModeData(self, data):
|
||||
""" get data output and add on QtableWidgets """
|
||||
"""get data output and add on QtableWidgets"""
|
||||
self.THeaders["Plugin"].append(data.keys()[0])
|
||||
self.THeaders["Logging"].append(data[data.keys()[0]])
|
||||
Headers = []
|
||||
@ -203,7 +203,7 @@ class CaptivePortal(ProxyMode):
|
||||
print(display_messages("unknown sintax command", error=True))
|
||||
|
||||
def search_all_ProxyPlugins(self):
|
||||
""" load all plugins function """
|
||||
"""load all plugins function"""
|
||||
plugin_classes = plugin.CaptiveTemplatePlugin.__subclasses__()
|
||||
for p in plugin_classes:
|
||||
self.plugins.append(p())
|
||||
|
@ -189,7 +189,7 @@ class ProxyMode(Widget, ComponentBlueprint):
|
||||
pass
|
||||
|
||||
def optionsRules(self, type):
|
||||
""" add rules iptable by type plugins"""
|
||||
"""add rules iptable by type plugins"""
|
||||
return self.search[type]
|
||||
|
||||
def ClearRules(self):
|
||||
|
@ -35,7 +35,7 @@ class TCPProxyDock(DockableWidget):
|
||||
self.THeaders = OrderedDict([("Plugin", []), ("Logging", [])])
|
||||
|
||||
def writeModeData(self, data):
|
||||
""" get data output and add on QtableWidgets """
|
||||
"""get data output and add on QtableWidgets"""
|
||||
self.THeaders["Plugin"].append(data.keys()[0])
|
||||
self.THeaders["Logging"].append(data[data.keys()[0]])
|
||||
Headers = []
|
||||
|
@ -25,6 +25,7 @@ from wifipumpkin3.core.servers.rest.ext.exceptions import exception
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
class SettingsAPmodeResource(Resource):
|
||||
config = SettingsINI.getInstance()
|
||||
key_name = "ap_mode"
|
||||
@ -67,7 +68,9 @@ class SettingsDHCPResource(Resource):
|
||||
if attribute:
|
||||
if not attribute in self.config.get_all_childname(self.key_name):
|
||||
return exception(
|
||||
"Cannot found that attribute {} on {}!".format(attribute, self.key_name),
|
||||
"Cannot found that attribute {} on {}!".format(
|
||||
attribute, self.key_name
|
||||
),
|
||||
code=400,
|
||||
)
|
||||
return jsonify({attribute: self.config.get(self.key_name, attribute)})
|
||||
|
@ -37,7 +37,6 @@ class Capturing(list):
|
||||
|
||||
|
||||
class CommandsResource(Resource):
|
||||
|
||||
@token_required
|
||||
def get(self, command=None):
|
||||
self.root = PumpkinShell.getInstance()
|
||||
@ -48,12 +47,14 @@ class CommandsResource(Resource):
|
||||
|
||||
|
||||
class CommandsPostResource(Resource):
|
||||
|
||||
@token_required
|
||||
def post(self, command=None):
|
||||
data = request.get_json(force=True)
|
||||
if not "commands" in data:
|
||||
return exception("Cannot found that key commands on data", code=400,)
|
||||
return exception(
|
||||
"Cannot found that key commands on data",
|
||||
code=400,
|
||||
)
|
||||
self.root = PumpkinShell.getInstance()
|
||||
output = []
|
||||
with Capturing(output) as output:
|
||||
|
@ -71,7 +71,9 @@ class SettingsPluginResource(Resource):
|
||||
if attribute:
|
||||
if not attribute in self.config.get_all_childname(self.key_name):
|
||||
return exception(
|
||||
"Cannot found that attribute {} on {}!".format(attribute, self.key_name),
|
||||
"Cannot found that attribute {} on {}!".format(
|
||||
attribute, self.key_name
|
||||
),
|
||||
code=400,
|
||||
)
|
||||
return jsonify({attribute: self.config.get(self.key_name, attribute)})
|
||||
|
@ -27,12 +27,12 @@ class ui_DhcpSettingsClass(WidgetBase):
|
||||
|
||||
def __init__(self, parent):
|
||||
self.parent = parent
|
||||
self.desc_dhcp_server = u"DHCP or Dynamic Host Configuration Protocol is a protocol used in networks through which a system can automatically obtain the network settings, at boot time, required for communicating with other network devices. .\n"
|
||||
self.desc_ip_range = u"Using DHCP, the Access Point will provide an IP address to devices that connect, in a private range.\n"
|
||||
self.desc_dhcp_server = "DHCP or Dynamic Host Configuration Protocol is a protocol used in networks through which a system can automatically obtain the network settings, at boot time, required for communicating with other network devices. .\n"
|
||||
self.desc_ip_range = "Using DHCP, the Access Point will provide an IP address to devices that connect, in a private range.\n"
|
||||
self.class_headers = {
|
||||
u"10.0.0.20/50": "Class-A-Address",
|
||||
u"172.16.0.100/150": "Class-B-Address",
|
||||
u"192.168.0.100/150": "Class-C-Address",
|
||||
"10.0.0.20/50": "Class-A-Address",
|
||||
"172.16.0.100/150": "Class-B-Address",
|
||||
"192.168.0.100/150": "Class-C-Address",
|
||||
}
|
||||
self.radio_dhcpd_server_status = False
|
||||
|
||||
@ -43,11 +43,13 @@ class ui_DhcpSettingsClass(WidgetBase):
|
||||
)
|
||||
|
||||
self.widget_main = urwid.Padding(
|
||||
self.menu(u"DHCP Server", self.class_headers.keys()), left=2, right=2,
|
||||
self.menu("DHCP Server", self.class_headers.keys()),
|
||||
left=2,
|
||||
right=2,
|
||||
)
|
||||
self.top = urwid.Overlay(
|
||||
self.widget_main,
|
||||
urwid.SolidFill(u"\N{MEDIUM SHADE}"),
|
||||
urwid.SolidFill("\N{MEDIUM SHADE}"),
|
||||
align="center",
|
||||
width=("relative", 60),
|
||||
valign="middle",
|
||||
@ -68,7 +70,7 @@ class ui_DhcpSettingsClass(WidgetBase):
|
||||
bgroup = [] # button group
|
||||
self.radioPyDhcpServer = urwid.RadioButton(
|
||||
bgroup,
|
||||
u"PyDHCPServer",
|
||||
"PyDHCPServer",
|
||||
state=not self.radio_dhcpd_server_status,
|
||||
on_state_change=self.on_radioButton_changes,
|
||||
user_data="pydhcp_server",
|
||||
@ -76,7 +78,7 @@ class ui_DhcpSettingsClass(WidgetBase):
|
||||
|
||||
self.radioDhcpdServer = urwid.RadioButton(
|
||||
bgroup,
|
||||
u"ISC DHCPServer",
|
||||
"ISC DHCPServer",
|
||||
state=self.radio_dhcpd_server_status,
|
||||
on_state_change=self.on_radioButton_changes,
|
||||
user_data="dhcp_server",
|
||||
@ -96,26 +98,26 @@ class ui_DhcpSettingsClass(WidgetBase):
|
||||
child_keys = self._conf.get_all_childname("dhcp")
|
||||
for config in child_keys:
|
||||
default_config.append(
|
||||
u"{} = {}\n".format(config, self._conf.get("dhcp", config))
|
||||
"{} = {}\n".format(config, self._conf.get("dhcp", config))
|
||||
)
|
||||
|
||||
body.append(urwid.Text([u"\n[Default]\n"] + default_config))
|
||||
body.append(urwid.Text([u"Press (", ("quit button", u"Q"), u") to quit."]))
|
||||
body.append(urwid.Text(["\n[Default]\n"] + default_config))
|
||||
body.append(urwid.Text(["Press (", ("quit button", "Q"), ") to quit."]))
|
||||
|
||||
return urwid.ListBox(urwid.SimpleFocusListWalker(body))
|
||||
|
||||
def item_chosen(self, button, choice):
|
||||
data_config = [u"-----------DHCP-----------\n"]
|
||||
data_config = ["-----------DHCP-----------\n"]
|
||||
data_set = {}
|
||||
child_keys = self._conf.get_all_childname(self.class_headers.get(choice))
|
||||
for config in child_keys:
|
||||
data_config.append(
|
||||
u"{} = {}\n".format(
|
||||
"{} = {}\n".format(
|
||||
config, self._conf.get(self.class_headers.get(choice), config)
|
||||
)
|
||||
)
|
||||
data_set[config] = self._conf.get(self.class_headers.get(choice), config)
|
||||
data_config.append(u"-----------DHCP-----------\n")
|
||||
data_config.append("-----------DHCP-----------\n")
|
||||
|
||||
for key, value in data_set.items():
|
||||
self._conf.set("dhcp", key, value)
|
||||
@ -129,8 +131,8 @@ class ui_DhcpSettingsClass(WidgetBase):
|
||||
self._conf.set("accesspoint", "pydns_server", True)
|
||||
self._conf.set("accesspoint", "dhcpd_server", False)
|
||||
|
||||
response = urwid.Text([u"[DHCP configuration]", u"\n"] + data_config)
|
||||
done = urwid.Button(u"Ok")
|
||||
response = urwid.Text(["[DHCP configuration]", "\n"] + data_config)
|
||||
done = urwid.Button("Ok")
|
||||
urwid.connect_signal(done, "click", self.exit_program)
|
||||
self.widget_main.original_widget = urwid.Filler(
|
||||
urwid.Pile([response, urwid.AttrMap(done, None, focus_map="reversed")])
|
||||
|
@ -1,11 +1,7 @@
|
||||
import urwid, time, threading
|
||||
from tabulate import tabulate
|
||||
from netaddr import EUI
|
||||
from wifipumpkin3.core.utility.collection import SettingsINI
|
||||
from wifipumpkin3.core.servers.dhcp.dhcp import DHCPServers
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
import fcntl, termios, struct, os
|
||||
from wifipumpkin3.core.common.platforms import hexdump
|
||||
from multiprocessing import Process
|
||||
from wifipumpkin3.core.config.globalimport import *
|
||||
from wifipumpkin3.core.ui.uimode import WidgetBase
|
||||
|
||||
@ -49,8 +45,6 @@ class ui_TableMonitorClient(WidgetBase):
|
||||
def __init__(self, parent):
|
||||
self.parent = parent
|
||||
self.table_clients = []
|
||||
self.__threadServices = []
|
||||
self.__threadStatus = False
|
||||
self.header_text = [
|
||||
("titlebar", ""),
|
||||
"Clients: ",
|
||||
@ -58,7 +52,7 @@ class ui_TableMonitorClient(WidgetBase):
|
||||
",",
|
||||
("title", "DOWN"),
|
||||
":scroll",
|
||||
" Monitor DHCP Requests",
|
||||
" DHCP Information",
|
||||
]
|
||||
|
||||
def getClientsCount(self):
|
||||
@ -66,7 +60,7 @@ class ui_TableMonitorClient(WidgetBase):
|
||||
|
||||
def setup_view(self):
|
||||
self.header_wid = urwid.AttrWrap(urwid.Text(self.header_text), "title")
|
||||
self.menu = urwid.Text([u"Press (", ("quit button", u"Q"), u") to quit."])
|
||||
self.menu = urwid.Text(["Press (", ("quit button", "Q"), ") to quit."])
|
||||
self.lwDevices = urwid.SimpleListWalker([])
|
||||
self.body = urwid.ListBox(self.lwDevices)
|
||||
self.main_box = urwid.LineBox(self.body)
|
||||
@ -74,7 +68,8 @@ class ui_TableMonitorClient(WidgetBase):
|
||||
self.layout = urwid.Frame(
|
||||
header=self.header_wid, body=self.main_box, footer=self.menu
|
||||
)
|
||||
self.add_Clients(Refactor.readFileDataToJson(C.CLIENTS_CONNECTED))
|
||||
dhcp_mode: DHCPServers = self.parent.getDefault.getController("dhcp_controller").Active
|
||||
self.add_Clients(dhcp_mode.getStaClients)
|
||||
|
||||
def render_view(self):
|
||||
return self.layout
|
||||
@ -96,12 +91,10 @@ class ui_TableMonitorClient(WidgetBase):
|
||||
self.main()
|
||||
|
||||
def stop(self):
|
||||
if len(self.__threadServices) > 0:
|
||||
self.table_clients = []
|
||||
self.lwDevices.append(urwid.Text(("", self.up_Clients())))
|
||||
pass
|
||||
|
||||
def get_mac_vendor(self, mac):
|
||||
""" discovery mac vendor by mac address """
|
||||
"""discovery mac vendor by mac address"""
|
||||
try:
|
||||
d_vendor = EUI(mac)
|
||||
d_vendor = d_vendor.oui.registration().org
|
||||
@ -110,7 +103,7 @@ class ui_TableMonitorClient(WidgetBase):
|
||||
return d_vendor
|
||||
|
||||
def add_Clients(self, data_dict):
|
||||
""" add client on table list() """
|
||||
"""add client on table list()"""
|
||||
self.table_clients = []
|
||||
for data in data_dict:
|
||||
self.table_clients.append(
|
||||
|
@ -21,7 +21,7 @@ import wifipumpkin3.core.utility.constants as C
|
||||
|
||||
|
||||
class SettingsINI(object):
|
||||
""" settings INI file implemented for Wifi-Pumpkin"""
|
||||
"""settings INI file implemented for Wifi-Pumpkin"""
|
||||
|
||||
_instance = None
|
||||
|
||||
@ -36,14 +36,14 @@ class SettingsINI(object):
|
||||
return SettingsINI._instance
|
||||
|
||||
def get(self, name_group, key, format=str):
|
||||
""" Get the value for setting key """
|
||||
"""Get the value for setting key"""
|
||||
self.psettings.beginGroup(name_group)
|
||||
value = self.psettings.value(key, type=format)
|
||||
self.closeGroup()
|
||||
return value
|
||||
|
||||
def set(self, name_group, key, value):
|
||||
""" Sets the value of setting key to value """
|
||||
"""Sets the value of setting key to value"""
|
||||
self.psettings.beginGroup(name_group)
|
||||
self.psettings.setValue(key, value)
|
||||
self.closeGroup()
|
||||
@ -54,22 +54,22 @@ class SettingsINI(object):
|
||||
self.closeGroup()
|
||||
|
||||
def set_one(self, name_group, key, value):
|
||||
""" Sets the value of setting key to value """
|
||||
"""Sets the value of setting key to value"""
|
||||
self.set(name_group, key, value)
|
||||
for item in self.get_all_childname(name_group):
|
||||
if item != key:
|
||||
self.set(name_group, item, False)
|
||||
|
||||
def get_by_index_key(self, index, key=str):
|
||||
""" get specific key value by index type(list) """
|
||||
"""get specific key value by index type(list)"""
|
||||
return str(self.get(key, self.get_all_childname(key)[index]))
|
||||
|
||||
def get_all_childname(self, key):
|
||||
""" get list all childskeys on file config.ini """
|
||||
"""get list all childskeys on file config.ini"""
|
||||
return [x.split("/")[1] for x in self.get_all_keys() if x.split("/")[0] == key]
|
||||
|
||||
def get_name_activated_plugin(self, key):
|
||||
""" get status by plugin name """
|
||||
"""get status by plugin name"""
|
||||
plugins = self.get_all_childname(key)
|
||||
for plugin in plugins:
|
||||
if self.get(key, plugin, format=bool):
|
||||
@ -77,9 +77,9 @@ class SettingsINI(object):
|
||||
return None
|
||||
|
||||
def get_all_keys(self):
|
||||
""" get all keys on settings"""
|
||||
"""get all keys on settings"""
|
||||
return self.psettings.allKeys()
|
||||
|
||||
def closeGroup(self):
|
||||
""" close group settings"""
|
||||
"""close group settings"""
|
||||
self.psettings.endGroup()
|
||||
|
@ -20,7 +20,7 @@ import wifipumpkin3 as wp3
|
||||
|
||||
dir_of_executable = os.path.dirname(__file__)
|
||||
dir_path = os.getcwd()
|
||||
user_config_dir = os.path.expanduser("~")
|
||||
config_dir = "/usr/share/wifipumpkin3"
|
||||
wp3_setup_packager_path = wp3.__path__[0]
|
||||
|
||||
SYSTEMCOMMAND = [
|
||||
@ -34,19 +34,17 @@ SYSTEMCOMMAND = [
|
||||
"nano",
|
||||
]
|
||||
|
||||
HELPFILESPATH = user_config_dir + "/.config/wifipumpkin3/helps/"
|
||||
EXCEPTFILESPATH = user_config_dir + "/.config/wifipumpkin3/exceptions/"
|
||||
APIRESTPATH = user_config_dir + "/.config/wifipumpkin3/api/"
|
||||
HELPFILESPATH = config_dir + "/helps/"
|
||||
EXCEPTFILESPATH = config_dir + "/exceptions/"
|
||||
APIRESTPATH = config_dir + "/api/"
|
||||
|
||||
# DHCP logger connected
|
||||
CLIENTS_CONNECTED = (
|
||||
user_config_dir + "/.config/wifipumpkin3/config/session/connected.json"
|
||||
)
|
||||
CLIENTS_CONNECTED = config_dir + "/config/session/connected.json"
|
||||
|
||||
DHCPSERVERBINARY = "core/packets/binary/dhcpserver"
|
||||
|
||||
# DNS file hosts
|
||||
DNSHOSTS = user_config_dir + "/.config/wifipumpkin3/config/app/dns_hosts.ini"
|
||||
DNSHOSTS = config_dir + "/config/app/dns_hosts.ini"
|
||||
|
||||
# donation button
|
||||
# TODO: add donation in readme
|
||||
@ -57,13 +55,11 @@ DONATE_TXT = (
|
||||
|
||||
# settings DHCP
|
||||
DHCPLEASES_PATH = "/var/lib/dhcp/dhcpd.leases"
|
||||
DHCPCONF_PATH = user_config_dir + "/.config/wifipumpkin3/config/dhcpd.conf"
|
||||
DHCPCONF_PATH = config_dir + "/config/dhcpd.conf"
|
||||
|
||||
# settings HOSTAPD
|
||||
HOSTAPDCONF_PATH = user_config_dir + "/.config/wifipumpkin3/config/hostapd/hostapd.conf"
|
||||
HOSTAPDCONF_PATH2 = (
|
||||
user_config_dir + "/.config/wifipumpkin3/config/hostapd/hostapd+.conf"
|
||||
)
|
||||
HOSTAPDCONF_PATH = config_dir + "/config/hostapd/hostapd.conf"
|
||||
HOSTAPDCONF_PATH2 = config_dir + "/config/hostapd/hostapd+.conf"
|
||||
ALGORITMS = ("TKIP", "CCMP", "TKIP + CCMP")
|
||||
|
||||
# system configs
|
||||
@ -75,17 +71,17 @@ DOCKERIPTABLESPATH = "/etc/iptables.ipv4.nat"
|
||||
DOCKERHOSTAPDCONF_PATH = "/etc/hostapd/hostapd.conf"
|
||||
|
||||
# logging
|
||||
LOG_PUMPKINPROXY = user_config_dir + "/.config/wifipumpkin3/logs/ap/pumpkin_proxy.log"
|
||||
LOG_PYDNSSERVER = user_config_dir + "/.config/wifipumpkin3/logs/ap/pydns_server.log"
|
||||
LOG_PYDHCPSERVER = user_config_dir + "/.config/wifipumpkin3/logs/ap/pydhcp_server.log"
|
||||
LOG_SNIFFKIN3 = user_config_dir + "/.config/wifipumpkin3/logs/ap/sniffkin3.log"
|
||||
LOG_CAPTIVEPO = user_config_dir + "/.config/wifipumpkin3/logs/ap/captiveportal.log"
|
||||
LOG_RESPONDER3 = user_config_dir + "/.config/wifipumpkin3/logs/ap/responder3.log"
|
||||
LOG_HOSTAPD = user_config_dir + "/.config/wifipumpkin3/logs/ap/hostapd.log"
|
||||
LOG_ALL = user_config_dir + "/.config/wifipumpkin3/logs/everything.log"
|
||||
LOG_PUMPKINPROXY = config_dir + "/logs/ap/pumpkin_proxy.log"
|
||||
LOG_PYDNSSERVER = config_dir + "/logs/ap/pydns_server.log"
|
||||
LOG_PYDHCPSERVER = config_dir + "/logs/ap/pydhcp_server.log"
|
||||
LOG_SNIFFKIN3 = config_dir + "/logs/ap/sniffkin3.log"
|
||||
LOG_CAPTIVEPO = config_dir + "/logs/ap/captiveportal.log"
|
||||
LOG_RESPONDER = config_dir + "/logs/ap/responder.log"
|
||||
LOG_HOSTAPD = config_dir + "/logs/ap/hostapd.log"
|
||||
LOG_ALL = config_dir + "/logs/everything.log"
|
||||
|
||||
|
||||
LOG_BASE = user_config_dir + "/.config/wifipumpkin3/logs/ap"
|
||||
LOG_BASE = config_dir + "/logs/ap"
|
||||
|
||||
|
||||
ALL_LOGSPATH = (
|
||||
@ -95,17 +91,17 @@ ALL_LOGSPATH = (
|
||||
LOG_SNIFFKIN3,
|
||||
LOG_SNIFFKIN3,
|
||||
LOG_CAPTIVEPO,
|
||||
LOG_RESPONDER3,
|
||||
LOG_RESPONDER,
|
||||
LOG_HOSTAPD,
|
||||
LOG_ALL,
|
||||
)
|
||||
|
||||
# APP SETTINGS
|
||||
CONFIG_INI = user_config_dir + "/.config/wifipumpkin3/config/app/config.ini"
|
||||
CONFIG_SK_INI = user_config_dir + "/.config/wifipumpkin3/config/app/sniffkin3.ini"
|
||||
CONFIG_PP_INI = user_config_dir + "/.config/wifipumpkin3/config/app/pumpkinproxy.ini"
|
||||
CONFIG_CP_INI = user_config_dir + "/.config/wifipumpkin3/config/app/captive-portal.ini"
|
||||
CONFIG_CP_INI_ROOT = "config/app/captive-portal.ini"
|
||||
CONFIG_INI = config_dir + "/config/app/config.ini"
|
||||
CONFIG_SK_INI = config_dir + "/config/app/sniffkin3.ini"
|
||||
CONFIG_PP_INI = config_dir + "/config/app/pumpkinproxy.ini"
|
||||
CONFIG_CP_INI = config_dir + "/config/app/captive-portal.ini"
|
||||
CONFIG_CP_INI_ROOT = config_dir + "/config/app/captive-portal.ini"
|
||||
|
||||
|
||||
ALL_CONFIGSINI = {
|
||||
@ -129,7 +125,7 @@ SOURCE_URL = "https://github.com/P0cL4bs/WiFi-Pumpkin.git"
|
||||
|
||||
|
||||
# settings template
|
||||
TEMPLATES_FLASK = user_config_dir + "/.config/wifipumpkin3/config/"
|
||||
TEMPLATES_FLASK = config_dir + "/config/"
|
||||
TEMP_CUSTOM = dir_path + "/templates/phishing/custom"
|
||||
TEMP_Win = dir_path + "/templates/fakeupdate/Windows_Update"
|
||||
TEMP_Java = dir_path + "/templates/fakeupdate/Java_Update"
|
||||
|
@ -133,7 +133,10 @@ def display_messages(
|
||||
len(string) * "=",
|
||||
)
|
||||
elif header:
|
||||
return "\n{}\n{}\n".format(string, len(string) * "=",)
|
||||
return "\n{}\n{}\n".format(
|
||||
string,
|
||||
len(string) * "=",
|
||||
)
|
||||
else:
|
||||
if error:
|
||||
return "{}{}[-]{} {}".format(
|
||||
|
@ -57,10 +57,10 @@ class Docker(Mode):
|
||||
if self.conf.get("accesspoint", "enable_hostapd_config", format=bool):
|
||||
for key in self.conf.get_all_childname("hostapd_config"):
|
||||
if key not in self.ignore_key_hostapd:
|
||||
self.Settings. \
|
||||
SettingsAP["hostapd"]. \
|
||||
append("{}={}\n".format(key, self.conf.get("hostapd_config", key)))
|
||||
|
||||
self.Settings.SettingsAP["hostapd"].append(
|
||||
"{}={}\n".format(key, self.conf.get("hostapd_config", key))
|
||||
)
|
||||
|
||||
with open(C.DOCKERHOSTAPDCONF_PATH, "w") as apconf:
|
||||
for i in self.Settings.SettingsAP["hostapd"]:
|
||||
apconf.write(i)
|
||||
@ -136,7 +136,7 @@ class Docker(Mode):
|
||||
)
|
||||
|
||||
def setNetworkManager(self, interface=str, Remove=False):
|
||||
""" mac address of interface to exclude """
|
||||
"""mac address of interface to exclude"""
|
||||
networkmanager = C.NETWORKMANAGER
|
||||
config = configparser.RawConfigParser()
|
||||
MAC = Linux.get_interface_mac(interface)
|
||||
@ -216,7 +216,7 @@ class DockerSettings(CoreSettings):
|
||||
return DHCP
|
||||
|
||||
def Configure(self):
|
||||
""" configure interface and dhcpd for mount Access Point """
|
||||
"""configure interface and dhcpd for mount Access Point"""
|
||||
self.ifaceHostapd = self.conf.get("accesspoint", "interface")
|
||||
self.DHCP = self.getDHCPConfig()
|
||||
self.SettingsAP = {
|
||||
@ -289,7 +289,7 @@ class DockerSettings(CoreSettings):
|
||||
return True
|
||||
|
||||
def get_supported_interface(self, dev):
|
||||
""" get all support mode from interface wireless """
|
||||
"""get all support mode from interface wireless"""
|
||||
_iface = {"info": {}, "Supported": []}
|
||||
try:
|
||||
output = check_output(
|
||||
|
@ -55,14 +55,13 @@ class RestAPI(Mode):
|
||||
# add extra hostapd settings
|
||||
self.addExtraHostapdSettings()
|
||||
|
||||
|
||||
if self.conf.get("accesspoint", "enable_hostapd_config", format=bool):
|
||||
for key in self.conf.get_all_childname("hostapd_config"):
|
||||
if key not in self.ignore_key_hostapd:
|
||||
self.Settings. \
|
||||
SettingsAP["hostapd"]. \
|
||||
append("{}={}\n".format(key, self.conf.get("hostapd_config", key)))
|
||||
|
||||
self.Settings.SettingsAP["hostapd"].append(
|
||||
"{}={}\n".format(key, self.conf.get("hostapd_config", key))
|
||||
)
|
||||
|
||||
with open(C.HOSTAPDCONF_PATH, "w") as apconf:
|
||||
for i in self.Settings.SettingsAP["hostapd"]:
|
||||
apconf.write(i)
|
||||
@ -87,7 +86,7 @@ class RestAPI(Mode):
|
||||
)
|
||||
|
||||
def get_error_hostapdServices(self, data):
|
||||
"""check error hostapd on mount AP """
|
||||
"""check error hostapd on mount AP"""
|
||||
if self.conf.get("accesspoint", "status_ap", format=bool):
|
||||
self.Shutdown()
|
||||
print(
|
||||
@ -98,7 +97,7 @@ class RestAPI(Mode):
|
||||
)
|
||||
|
||||
def setNetworkManager(self, interface=str, Remove=False):
|
||||
""" mac address of interface to exclude """
|
||||
"""mac address of interface to exclude"""
|
||||
networkmanager = C.NETWORKMANAGER
|
||||
config = configparser.RawConfigParser()
|
||||
MAC = Linux.get_interface_mac(interface)
|
||||
@ -178,7 +177,7 @@ class RestApiSettings(CoreSettings):
|
||||
return DHCP
|
||||
|
||||
def Configure(self):
|
||||
""" configure interface and dhcpd for mount Access Point """
|
||||
"""configure interface and dhcpd for mount Access Point"""
|
||||
self.ifaceHostapd = self.conf.get("accesspoint", "interface")
|
||||
self.DHCP = self.getDHCPConfig()
|
||||
self.SettingsAP = {
|
||||
@ -234,11 +233,11 @@ class RestApiSettings(CoreSettings):
|
||||
self.apply_dhcp_config_leases_config(self.SettingsAP)
|
||||
|
||||
def checkNetworkAP(self):
|
||||
"this will be checked on web interface "
|
||||
"this will be checked on web interface"
|
||||
return True
|
||||
|
||||
def get_supported_interface(self, dev):
|
||||
""" get all support mode from interface wireless """
|
||||
"""get all support mode from interface wireless"""
|
||||
_iface = {"info": {}, "Supported": []}
|
||||
try:
|
||||
output = check_output(
|
||||
|
@ -2,6 +2,7 @@ from wifipumpkin3.core.config.globalimport import *
|
||||
import weakref
|
||||
from subprocess import check_output, STDOUT, CalledProcessError
|
||||
from wifipumpkin3.core.common.threads import ProcessHostapd
|
||||
from wifipumpkin3.core.servers.dhcp.dhcp import DHCPServers
|
||||
from wifipumpkin3.core.wirelessmode.wirelessmode import Mode
|
||||
from wifipumpkin3.core.common.uimodel import *
|
||||
from wifipumpkin3.core.utility.printer import display_messages, setcolor
|
||||
@ -38,6 +39,7 @@ class Static(Mode):
|
||||
def __init__(self, parent=0):
|
||||
super(Static, self).__init__(parent)
|
||||
self.confgSecurity = []
|
||||
self.parent = parent
|
||||
|
||||
@property
|
||||
def Settings(self):
|
||||
@ -54,14 +56,13 @@ class Static(Mode):
|
||||
# add extra hostapd settings
|
||||
self.addExtraHostapdSettings()
|
||||
|
||||
|
||||
if self.conf.get("accesspoint", "enable_hostapd_config", format=bool):
|
||||
for key in self.conf.get_all_childname("hostapd_config"):
|
||||
if key not in self.ignore_key_hostapd:
|
||||
self.Settings. \
|
||||
SettingsAP["hostapd"]. \
|
||||
append("{}={}\n".format(key, self.conf.get("hostapd_config", key)))
|
||||
|
||||
self.Settings.SettingsAP["hostapd"].append(
|
||||
"{}={}\n".format(key, self.conf.get("hostapd_config", key))
|
||||
)
|
||||
|
||||
with open(C.HOSTAPDCONF_PATH, "w") as apconf:
|
||||
for i in self.Settings.SettingsAP["hostapd"]:
|
||||
apconf.write(i)
|
||||
@ -84,9 +85,10 @@ class Static(Mode):
|
||||
info=True,
|
||||
)
|
||||
)
|
||||
self.getDHCPMode.removeInactivityClient(data)
|
||||
|
||||
def setNetworkManager(self, interface=str, Remove=False):
|
||||
""" mac address of interface to exclude """
|
||||
"""mac address of interface to exclude"""
|
||||
networkmanager = C.NETWORKMANAGER
|
||||
config = configparser.RawConfigParser()
|
||||
MAC = Linux.get_interface_mac(interface)
|
||||
@ -166,7 +168,7 @@ class StaticSettings(CoreSettings):
|
||||
return DHCP
|
||||
|
||||
def Configure(self):
|
||||
""" configure interface and dhcpd for mount Access Point """
|
||||
"""configure interface and dhcpd for mount Access Point"""
|
||||
self.ifaceHostapd = self.conf.get("accesspoint", "interface")
|
||||
self.DHCP = self.getDHCPConfig()
|
||||
self.SettingsAP = {
|
||||
@ -239,7 +241,7 @@ class StaticSettings(CoreSettings):
|
||||
return True
|
||||
|
||||
def get_supported_interface(self, dev):
|
||||
""" get all support mode from interface wireless """
|
||||
"""get all support mode from interface wireless"""
|
||||
_iface = {"info": {}, "Supported": []}
|
||||
try:
|
||||
output = check_output(
|
||||
|
@ -2,6 +2,7 @@ from wifipumpkin3.core.config.globalimport import *
|
||||
from re import *
|
||||
from os import path
|
||||
from shutil import move
|
||||
from wifipumpkin3.core.servers.dhcp.dhcp import DHCPServers
|
||||
from wifipumpkin3.core.widgets.default.session_config import *
|
||||
from wifipumpkin3.exceptions.errors.hostapdException import HostapdInitializeError
|
||||
import sys
|
||||
@ -46,7 +47,7 @@ class Mode(Qt.QObject):
|
||||
self.hostapd_path = self.getHostapdPath
|
||||
|
||||
def checkifHostapdBinaryExist(self):
|
||||
""" check if hostapd binary file exist"""
|
||||
"""check if hostapd binary file exist"""
|
||||
if path.isfile(self.hostapd_path):
|
||||
return True
|
||||
return False
|
||||
@ -63,7 +64,7 @@ class Mode(Qt.QObject):
|
||||
return self.conf.get(self.configApMode, self.subConfig, format=bool)
|
||||
|
||||
def get_soft_dependencies(self):
|
||||
""" check if Hostapd is installed """
|
||||
"""check if Hostapd is installed"""
|
||||
if not self.checkifHostapdBinaryExist():
|
||||
print(
|
||||
display_messages(
|
||||
@ -145,7 +146,7 @@ class Mode(Qt.QObject):
|
||||
self.Shutdown()
|
||||
|
||||
def get_error_hostapdServices(self, data):
|
||||
"""check error hostapd on mount AP """
|
||||
"""check error hostapd on mount AP"""
|
||||
if self.conf.get("accesspoint", "status_ap", format=bool):
|
||||
self.Shutdown()
|
||||
raise HostapdInitializeError(
|
||||
@ -182,5 +183,9 @@ class Mode(Qt.QObject):
|
||||
self.Settings.SettingsAP["hostapd"].append(config)
|
||||
|
||||
def LogOutput(self, data):
|
||||
""" get inactivity client from hostapd response"""
|
||||
"""get inactivity client from hostapd response"""
|
||||
pass
|
||||
|
||||
@property
|
||||
def getDHCPMode(self) -> DHCPServers:
|
||||
return self.parent.getDefault.getController("dhcp_controller").Active
|
||||
|
@ -24,7 +24,7 @@ from wifipumpkin3.core.utility.printer import (
|
||||
|
||||
|
||||
class Ap(ExtensionUI):
|
||||
""" show all variable and status from AP """
|
||||
"""show all variable and status from AP"""
|
||||
|
||||
Name = "ap"
|
||||
|
||||
@ -41,9 +41,17 @@ class Ap(ExtensionUI):
|
||||
print(self.__doc__)
|
||||
|
||||
def do_ap(self, args):
|
||||
"""ap: show all variable and status from AP """
|
||||
"""ap: show all variable and status from AP"""
|
||||
headers_table, output_table = (
|
||||
["bssid", "ssid", "channel", "interface", "status", "security", "hostapd_config"],
|
||||
[
|
||||
"bssid",
|
||||
"ssid",
|
||||
"channel",
|
||||
"interface",
|
||||
"status",
|
||||
"security",
|
||||
"hostapd_config",
|
||||
],
|
||||
[],
|
||||
)
|
||||
print(display_messages("Settings AccessPoint:", info=True, sublime=True))
|
||||
@ -84,11 +92,10 @@ class Ap(ExtensionUI):
|
||||
print(display_messages("Settings Security:", info=True, sublime=True))
|
||||
display_tabulate(headers_sec, output_sec)
|
||||
self.show_help_command("help_security_command")
|
||||
|
||||
|
||||
if enable_hostapd_config:
|
||||
print(display_messages("Settings Hostapd:", info=True, sublime=True))
|
||||
for key in self.conf.get_all_childname("hostapd_config"):
|
||||
print(" {}={}".format(key, self.root.conf.get("hostapd_config", key)))
|
||||
print('\n')
|
||||
print("\n")
|
||||
self.show_help_command("help_hostapd_config_command")
|
||||
|
||||
|
@ -22,7 +22,7 @@ from wifipumpkin3.core.utility.printer import banner, setcolor, display_messages
|
||||
|
||||
|
||||
class Banner(ExtensionUI):
|
||||
""" display an awesome wp3 banner """
|
||||
"""display an awesome wp3 banner"""
|
||||
|
||||
Name = "banner"
|
||||
|
||||
@ -39,7 +39,7 @@ class Banner(ExtensionUI):
|
||||
print(self.__doc__)
|
||||
|
||||
def do_banner(self, args):
|
||||
"""core: display an awesome wp3 banner """
|
||||
"""core: display an awesome wp3 banner"""
|
||||
_author = "{}".format(setcolor(__author__, color="yellow"))
|
||||
_version = setcolor(__version__, color="yellow")
|
||||
_codename = setcolor(__codename__, color="ciano")
|
||||
|
@ -25,7 +25,7 @@ from wifipumpkin3.core.utility.printer import (
|
||||
|
||||
|
||||
class Dhcpconf(ExtensionUI):
|
||||
""" show/choise dhcp server configuration """
|
||||
"""show/choise dhcp server configuration"""
|
||||
|
||||
Name = "dhcpconf"
|
||||
|
||||
@ -35,53 +35,62 @@ class Dhcpconf(ExtensionUI):
|
||||
|
||||
self.register_command("do_dhcpconf", self.do_dhcpconf)
|
||||
self.register_command("help_dhcpconf", self.help_dhcpconf)
|
||||
self.ip_class = ["Class-A-Address","Class-B-Address", "Class-C-Address"]
|
||||
self.ip_class = ["Class-A-Address", "Class-B-Address", "Class-C-Address"]
|
||||
super(Dhcpconf, self).__init__(parse_args=self.parse_args, root=self.root)
|
||||
|
||||
def help_dhcpconf(self):
|
||||
self.show_help_command("help_dhcpconf_command")
|
||||
|
||||
def do_dhcpconf(self, args):
|
||||
"""ap: show/choise dhcp server configuration """
|
||||
"""ap: show/choise dhcp server configuration"""
|
||||
status_ap = self.root.conf.get("accesspoint", "status_ap", format=bool)
|
||||
if args:
|
||||
try:
|
||||
id_dhcp_option = int(args.split()[0])
|
||||
selected_id_option = self.ip_class[id_dhcp_option]
|
||||
for key in self.root.conf.get_all_childname(selected_id_option):
|
||||
self.root.conf.set("dhcp", key,self.root.conf.get(selected_id_option, key))
|
||||
|
||||
self.root.conf.set(
|
||||
"dhcp", key, self.root.conf.get(selected_id_option, key)
|
||||
)
|
||||
|
||||
if status_ap:
|
||||
print(display_messages("OBS: this settings require restart the AP",error=True))
|
||||
|
||||
print(
|
||||
display_messages(
|
||||
"OBS: this settings require restart the AP", error=True
|
||||
)
|
||||
)
|
||||
|
||||
return
|
||||
except Exception:
|
||||
return print(
|
||||
display_messages(
|
||||
"the parameter id {} was not found.".format(
|
||||
setcolor(args, color="orange")
|
||||
),
|
||||
error=True,
|
||||
)
|
||||
display_messages(
|
||||
"the parameter id {} was not found.".format(
|
||||
setcolor(args, color="orange")
|
||||
),
|
||||
error=True,
|
||||
)
|
||||
)
|
||||
headers_table, output_table = (
|
||||
["Id","Class", "IP address range", "Netmask" , "Router"],
|
||||
["Id", "Class", "IP address range", "Netmask", "Router"],
|
||||
[],
|
||||
)
|
||||
print(display_messages("DHCP Server Option:", info=True, sublime=True))
|
||||
for ip_class in self.ip_class:
|
||||
output_table.append(
|
||||
[
|
||||
self.ip_class.index(ip_class),
|
||||
ip_class.split("-")[1],
|
||||
self.root.conf.get(ip_class,"range"),
|
||||
self.root.conf.get(ip_class, "netmask"),
|
||||
self.root.conf.get(ip_class, "router"),
|
||||
])
|
||||
[
|
||||
self.ip_class.index(ip_class),
|
||||
ip_class.split("-")[1],
|
||||
self.root.conf.get(ip_class, "range"),
|
||||
self.root.conf.get(ip_class, "netmask"),
|
||||
self.root.conf.get(ip_class, "router"),
|
||||
]
|
||||
)
|
||||
display_tabulate(headers_table, output_table, tablefmt="presto", newline=False)
|
||||
print(display_messages("DHCP Server Settings:", info=True, sublime=True))
|
||||
for config in self.root.conf.get_all_childname("dhcp"):
|
||||
print(
|
||||
" {}={}".format(setcolor(config, color="purple"), self.root.conf.get("dhcp", config))
|
||||
" {}={}".format(
|
||||
setcolor(config, color="purple"), self.root.conf.get("dhcp", config)
|
||||
)
|
||||
)
|
||||
print("\n")
|
||||
|
@ -24,7 +24,7 @@ from wifipumpkin3.core.utility.printer import (
|
||||
|
||||
|
||||
class DhcpMode(ExtensionUI):
|
||||
""" show/set all available dhcp server """
|
||||
"""show/set all available dhcp server"""
|
||||
|
||||
Name = "dhcpmode"
|
||||
|
||||
@ -73,7 +73,7 @@ class DhcpMode(ExtensionUI):
|
||||
return list(self.root.dhcp_controller.getInfo().keys())
|
||||
|
||||
def do_dhcpmode(self, args):
|
||||
"""ap: show/set all available dhcp server """
|
||||
"""ap: show/set all available dhcp server"""
|
||||
if args:
|
||||
try:
|
||||
id_dhcp = args.split()[0]
|
||||
|
@ -23,7 +23,7 @@ import re
|
||||
|
||||
|
||||
class Dump(ExtensionUI):
|
||||
""" get informations from clients connected on AccessPoint"""
|
||||
"""get informations from clients connected on AccessPoint"""
|
||||
|
||||
Name = "dump"
|
||||
|
||||
@ -105,7 +105,7 @@ class Dump(ExtensionUI):
|
||||
return list(self.root.all_modules.keys())
|
||||
|
||||
def do_dump(self, args):
|
||||
"""ap: dump informations from client connected on AP """
|
||||
"""ap: dump informations from client connected on AP"""
|
||||
self.options["target"][0] = None
|
||||
if len(args.split()) > 0:
|
||||
mac_addr = args.split()[0]
|
||||
|
@ -24,7 +24,7 @@ from wifipumpkin3.core.utility.printer import (
|
||||
|
||||
|
||||
class Info(ExtensionUI):
|
||||
""" get information about proxy/plugin settings """
|
||||
"""get information about proxy/plugin settings"""
|
||||
|
||||
Name = "info"
|
||||
|
||||
@ -115,7 +115,10 @@ class Info(ExtensionUI):
|
||||
for command in settings:
|
||||
output_settings.append(
|
||||
[
|
||||
setcolor("{}".format(command), color="blue",),
|
||||
setcolor(
|
||||
"{}".format(command),
|
||||
color="blue",
|
||||
),
|
||||
proxies["Config"].get("settings", command),
|
||||
]
|
||||
)
|
||||
|
@ -20,7 +20,7 @@ from wifipumpkin3.core.utility.printer import setcolor, display_messages
|
||||
|
||||
|
||||
class Kill(ExtensionUI):
|
||||
""" terminate a module in background by id """
|
||||
"""terminate a module in background by id"""
|
||||
|
||||
Name = "kill"
|
||||
|
||||
|
@ -24,7 +24,7 @@ from wifipumpkin3.core.utility.printer import (
|
||||
|
||||
|
||||
class Plugins(ExtensionUI):
|
||||
""" show all available plugins """
|
||||
"""show all available plugins"""
|
||||
|
||||
Name = "plugins"
|
||||
|
||||
@ -41,7 +41,7 @@ class Plugins(ExtensionUI):
|
||||
self.show_help_command("help_plugins_command")
|
||||
|
||||
def do_plugins(self, args=str):
|
||||
"""network: show all available plugins """
|
||||
"""network: show all available plugins"""
|
||||
headers_table, output_table = ["Name", "Active", "Description"], []
|
||||
headers_plugins, output_plugins = ["Name", "Active"], []
|
||||
all_plugins, config_instance = None, None
|
||||
|
@ -24,7 +24,7 @@ from wifipumpkin3.core.utility.printer import (
|
||||
|
||||
|
||||
class Proxies(ExtensionUI):
|
||||
""" show all available proxies """
|
||||
"""show all available proxies"""
|
||||
|
||||
Name = "proxies"
|
||||
|
||||
|
@ -1,110 +0,0 @@
|
||||
from wifipumpkin3.core.common.terminal import ExtensionUI
|
||||
from wifipumpkin3.core.config.globalimport import *
|
||||
from wifipumpkin3.core.utility.printer import display_messages, setcolor
|
||||
from scapy.all import *
|
||||
from wifipumpkin3.core.common.platforms import is_tool
|
||||
import re
|
||||
|
||||
# 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 Update(ExtensionUI):
|
||||
""" pulling updates from remote git repository """
|
||||
|
||||
Name = "update"
|
||||
|
||||
options = {
|
||||
"branches": ["dev", "beta", "master", "news", "test"],
|
||||
"default_branch": ["dev", "Name of current github branch"],
|
||||
"urlparser": "pip3 install --upgrade git+git://github.com/P0cL4bs/wifipumpkin3@{}",
|
||||
}
|
||||
completions = options.get("branches")
|
||||
|
||||
def __init__(self, parse_args=None, root=None):
|
||||
self.parse_args = parse_args
|
||||
self.root = root
|
||||
|
||||
self.register_command("do_update", self.do_update)
|
||||
self.register_command("complete_update", self.complete_update)
|
||||
self.register_command("help_update", self.help_update)
|
||||
|
||||
super(Update, self).__init__(parse_args=self.parse_args, root=self.root)
|
||||
|
||||
def check_deps_pip(self):
|
||||
return is_tool("pip3")
|
||||
|
||||
def help_update(self):
|
||||
print(
|
||||
"\n".join(
|
||||
[
|
||||
" Usage: update [branch]",
|
||||
" param branch: default is dev,options: master, ",
|
||||
" news, test and beta. \n",
|
||||
" Description:",
|
||||
" pulling updates from remote git repository",
|
||||
"",
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
def complete_update(self, text, args, start_index, end_index):
|
||||
if text:
|
||||
return [command for command in self.completions if command.startswith(text)]
|
||||
else:
|
||||
return self.completions
|
||||
|
||||
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([])
|
@ -7,7 +7,7 @@ from wifipumpkin3.core.utility.printer import display_messages
|
||||
|
||||
# https://stackoverflow.com/questions/3365740/how-to-import-all-submodules
|
||||
def import_submodules(package, recursive=True):
|
||||
""" Import all submodules of a module, recursively, including subpackages
|
||||
"""Import all submodules of a module, recursively, including subpackages
|
||||
|
||||
:param package: package (name or actual module)
|
||||
:type package: str | module
|
||||
|
117
wifipumpkin3/modules/misc/custom_captiveflask.py
Normal file
117
wifipumpkin3/modules/misc/custom_captiveflask.py
Normal file
@ -0,0 +1,117 @@
|
||||
from wifipumpkin3.core.common.terminal import ModuleUI
|
||||
from wifipumpkin3.core.config.globalimport import *
|
||||
from wifipumpkin3.core.utility.printer import (
|
||||
display_messages,
|
||||
setcolor
|
||||
)
|
||||
import tempfile
|
||||
from os import path
|
||||
from zipfile import ZipFile
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
from wifipumpkin3.core.utility.collection import SettingsINI
|
||||
from distutils.dir_util import copy_tree
|
||||
from shutil import copyfile
|
||||
|
||||
# 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 ModPump(ModuleUI):
|
||||
"""Install custom captiveflask templates"""
|
||||
|
||||
name = "custom_captiveflask"
|
||||
|
||||
temp_path = tempfile.gettempdir()
|
||||
captiveflask_setup_path = C.wp3_setup_packager_path + "/plugins/captiveflask"
|
||||
|
||||
config_default = SettingsINI(C.CONFIG_CP_INI_ROOT)
|
||||
|
||||
def __init__(self, parse_args=None, root=None):
|
||||
self.parse_args = parse_args
|
||||
self.root = root
|
||||
self.name_module = self.name
|
||||
|
||||
self.plugins_remote = {}
|
||||
self.table_headers = ["Name", "Author", "Installed", "Preview"]
|
||||
super(ModPump, self).__init__(parse_args=self.parse_args, root=self.root)
|
||||
|
||||
def do_install(self, args):
|
||||
"""install captiveflask template by zip file"""
|
||||
if args:
|
||||
try:
|
||||
plugin_name, file_path = args.split()[0], args.split()[1]
|
||||
except Exception as e:
|
||||
return print(display_messages("the argument is invalid please type ?install for more information", error=True))
|
||||
if not path.isfile(file_path):
|
||||
return print(
|
||||
display_messages(
|
||||
"the file {} not found ".format(file_path), error=True
|
||||
)
|
||||
)
|
||||
head, tail = os.path.split(file_path)
|
||||
dest = copyfile(file_path, "{}/{}".format(self.temp_path, tail))
|
||||
print(display_messages("copy content file .zip to {}".format(dest), info=True))
|
||||
|
||||
path_to_zip_file = tempfile.gettempdir() + "/{}".format(tail)
|
||||
with ZipFile(path_to_zip_file, "r") as zip_ref:
|
||||
zip_ref.extractall(tempfile.gettempdir())
|
||||
temp_path_file_extracted = "{}/{}.py".format(self.temp_path, plugin_name)
|
||||
print(
|
||||
display_messages(
|
||||
"extracted files on : {}".format(temp_path_file_extracted), info=True
|
||||
)
|
||||
)
|
||||
if not path.isfile(temp_path_file_extracted):
|
||||
return print(
|
||||
display_messages(
|
||||
"the file {} not found ".format(temp_path_file_extracted), error=True
|
||||
)
|
||||
)
|
||||
temp_templates_path = "{}/{}".format(self.temp_path, plugin_name)
|
||||
if not path.isdir(temp_templates_path):
|
||||
return print(
|
||||
display_messages(
|
||||
"the directory template {} not found ".format(temp_templates_path), error=True
|
||||
)
|
||||
)
|
||||
source = temp_path_file_extracted
|
||||
destination = "{}/{}.py".format(self.captiveflask_setup_path, plugin_name)
|
||||
dest = copyfile(source, destination)
|
||||
print(display_messages("copy content file to {}".format(dest), info=True))
|
||||
|
||||
copy_tree(
|
||||
temp_templates_path, C.config_dir + "/config/templates/{}".format(plugin_name)
|
||||
)
|
||||
print(
|
||||
display_messages(
|
||||
"plugin {} install {}".format( plugin_name,setcolor("sucessful", color="green")),
|
||||
info=True,
|
||||
)
|
||||
)
|
||||
return
|
||||
print(
|
||||
display_messages("unknown command: {} ".format(args), error=True)
|
||||
)
|
||||
|
||||
def help_install(self):
|
||||
self.show_help_command("help_install_customcaptiveflask")
|
||||
|
||||
def do_options(self, line):
|
||||
pass
|
||||
|
||||
def do_set(self, args):
|
||||
pass
|
@ -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 = "wifipumpkin3/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, "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(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:
|
||||
|
@ -22,7 +22,7 @@ from wifipumpkin3.core.common.threads import ProcessThread
|
||||
|
||||
|
||||
class ModPump(ModuleUI):
|
||||
""" Perform a dns spoof with accesspoint attack """
|
||||
"""Perform a dns spoof with accesspoint attack"""
|
||||
|
||||
name = "dns_spoof"
|
||||
|
||||
@ -70,7 +70,7 @@ class ModPump(ModuleUI):
|
||||
self.options["redirectTo"][0] = self.conf.get("dhcp", "router")
|
||||
|
||||
def do_add(self, args):
|
||||
""" add domain for perform attack dns spoof """
|
||||
"""add domain for perform attack dns spoof"""
|
||||
if not self.options.get("domains")[0]:
|
||||
self.options["domains"][0] = ",".join([args])
|
||||
return
|
||||
@ -80,7 +80,7 @@ class ModPump(ModuleUI):
|
||||
self.options["domains"][0] = ",".join(targets)
|
||||
|
||||
def do_rm(self, args):
|
||||
""" remove a domain from list dns spoof """
|
||||
"""remove a domain from list dns spoof"""
|
||||
if not self.options.get("domains")[0]:
|
||||
return print(display_messages("the list of domains is empty", error=True))
|
||||
|
||||
@ -99,7 +99,7 @@ class ModPump(ModuleUI):
|
||||
)
|
||||
|
||||
def do_start(self, args):
|
||||
""" start update dns zones file """
|
||||
"""start update dns zones file"""
|
||||
if self._background_mode:
|
||||
print(
|
||||
display_messages(
|
||||
@ -129,7 +129,8 @@ class ModPump(ModuleUI):
|
||||
for target in self.options.get("domains")[0].split(","):
|
||||
print(
|
||||
display_messages(
|
||||
"-> [{}] ".format(setcolor(target, color="red")), info=True,
|
||||
"-> [{}] ".format(setcolor(target, color="red")),
|
||||
info=True,
|
||||
)
|
||||
)
|
||||
|
||||
@ -143,7 +144,7 @@ class ModPump(ModuleUI):
|
||||
self.set_background_mode(True)
|
||||
|
||||
def do_stop(self, args):
|
||||
""" stop or restore the default dns zone file """
|
||||
"""stop or restore the default dns zone file"""
|
||||
self.handler_dnshosts = open(self.filepath_dns_hosts, "w")
|
||||
for line in self.default_hosts:
|
||||
self.handler_dnshosts.write(line + "\n")
|
||||
|
@ -36,7 +36,7 @@ DOT11_REQUEST_SUBTYPE = 2
|
||||
|
||||
|
||||
class ModPump(ModuleUI):
|
||||
""" Sends deauthentication packets to a wifi network AP """
|
||||
"""Sends deauthentication packets to a wifi network AP"""
|
||||
|
||||
name = "wifideauth"
|
||||
|
||||
@ -71,41 +71,33 @@ class ModPump(ModuleUI):
|
||||
super(ModPump, self).__init__(parse_args=self.parse_args, root=self.root)
|
||||
|
||||
def do_show_scan(self, args):
|
||||
""" show result scanner wireless network """
|
||||
"""show result scanner wireless network"""
|
||||
if not self.aps:
|
||||
print(
|
||||
display_messages(
|
||||
"Scanner result not found", error=True
|
||||
)
|
||||
)
|
||||
print(display_messages("Scanner result not found", error=True))
|
||||
return
|
||||
self.showDataOutputScanNetworks()
|
||||
|
||||
|
||||
def do_targets(self, args):
|
||||
""" show device targets to Deauth Atack """
|
||||
"""show device targets to Deauth Atack"""
|
||||
if not self._mac_blacklist:
|
||||
print(display_messages("required: no targets found", error=True))
|
||||
return
|
||||
print(display_messages("Targets:", info=True, sublime=True))
|
||||
table_targets = []
|
||||
table_headers_targets = [
|
||||
"BSSID"
|
||||
]
|
||||
table_headers_targets = ["BSSID"]
|
||||
for bssid in self._mac_blacklist:
|
||||
table_targets.append(
|
||||
[setcolor(bssid, color="red")]
|
||||
)
|
||||
table_targets.append([setcolor(bssid, color="red")])
|
||||
display_tabulate(table_headers_targets, table_targets)
|
||||
print("\n")
|
||||
|
||||
|
||||
def do_add(self, args):
|
||||
""" add target by mac address (bssid) """
|
||||
"""add target by mac address (bssid)"""
|
||||
try:
|
||||
mac_address = args.split()[0]
|
||||
mac_address = args.split()[0]
|
||||
except IndexError:
|
||||
print(display_messages("required: no arguments found", error=True))
|
||||
return
|
||||
|
||||
|
||||
if "." in mac_address:
|
||||
for target in self.aps.keys():
|
||||
if Linux.check_is_mac(target):
|
||||
@ -117,34 +109,31 @@ class ModPump(ModuleUI):
|
||||
display_messages("No valid mac address".format(mac_address), error=True)
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
|
||||
self._mac_blacklist.add(mac_address)
|
||||
|
||||
|
||||
def complete_add(self, text, args, start_index, end_index):
|
||||
if text:
|
||||
return [
|
||||
command
|
||||
for command in list(self.aps.keys())
|
||||
if command.startswith(text)
|
||||
command for command in list(self.aps.keys()) if command.startswith(text)
|
||||
]
|
||||
else:
|
||||
return list(self.aps.keys())
|
||||
|
||||
|
||||
def help_add(self):
|
||||
self.show_help_command("help_wifideauth_add_command")
|
||||
|
||||
|
||||
def do_rm(self, args):
|
||||
""" remove target by mac address (bssid) """
|
||||
"""remove target by mac address (bssid)"""
|
||||
try:
|
||||
mac_address = args.split()[0]
|
||||
mac_address = args.split()[0]
|
||||
except IndexError:
|
||||
print(display_messages("required: no arguments found:", error=True))
|
||||
return
|
||||
if "." in mac_address:
|
||||
self._mac_blacklist.clear()
|
||||
return
|
||||
|
||||
|
||||
if not Linux.check_is_mac(mac_address):
|
||||
print(
|
||||
display_messages("No valid mac address".format(mac_address), error=True)
|
||||
@ -152,28 +141,27 @@ class ModPump(ModuleUI):
|
||||
return
|
||||
if mac_address not in self._mac_blacklist:
|
||||
print(
|
||||
display_messages("Target MAC address not found".format(mac_address), error=True)
|
||||
display_messages(
|
||||
"Target MAC address not found".format(mac_address), error=True
|
||||
)
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
self._mac_blacklist.remove(mac_address)
|
||||
|
||||
def complete_rm(self, text, args, start_index, end_index):
|
||||
if text:
|
||||
return [
|
||||
command
|
||||
for command in list(self.aps.keys())
|
||||
if command.startswith(text)
|
||||
command for command in list(self.aps.keys()) if command.startswith(text)
|
||||
]
|
||||
else:
|
||||
return list(self.aps.keys())
|
||||
|
||||
|
||||
def help_rm(self):
|
||||
self.show_help_command("help_wifideauth_rm_command")
|
||||
|
||||
def do_scan(self, args):
|
||||
""" start scanner wireless networks AP"""
|
||||
"""start scanner wireless networks AP"""
|
||||
print(
|
||||
display_messages(
|
||||
"setting interface: {} monitor momde".format(
|
||||
@ -202,7 +190,7 @@ class ModPump(ModuleUI):
|
||||
print(display_messages("thread sniffing successfully stopped", info=True))
|
||||
|
||||
def do_start(self, args):
|
||||
""" execute deauth module attack """
|
||||
"""execute deauth module attack"""
|
||||
if self._background_mode:
|
||||
print(
|
||||
display_messages(
|
||||
@ -220,17 +208,17 @@ class ModPump(ModuleUI):
|
||||
)
|
||||
)
|
||||
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(
|
||||
@ -239,7 +227,7 @@ class ModPump(ModuleUI):
|
||||
info=True,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
for target_mac in self._mac_blacklist:
|
||||
info_target = self.aps.get(target_mac)
|
||||
if info_target:
|
||||
@ -261,7 +249,7 @@ class ModPump(ModuleUI):
|
||||
info=True,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
self.set_monitor_mode("monitor")
|
||||
self.thread_deauth = ThreadDeauth(self._mac_blacklist, client_mac, interface)
|
||||
self.thread_deauth.setObjectName("wifideauth")
|
||||
@ -270,7 +258,7 @@ class ModPump(ModuleUI):
|
||||
self.set_background_mode(True)
|
||||
|
||||
def do_stop(self, args):
|
||||
""" stop attack deauth module """
|
||||
"""stop attack deauth module"""
|
||||
if self.is_running:
|
||||
self.thread_deauth.stop()
|
||||
self.set_background_mode(False)
|
||||
@ -442,7 +430,6 @@ class ModPump(ModuleUI):
|
||||
)
|
||||
if len(self.table_station) > 0:
|
||||
display_tabulate(self.table_headers_STA, self.table_station)
|
||||
|
||||
|
||||
def sniffAp(self, pkt):
|
||||
self.getStationTrackFrame(pkt)
|
||||
|
@ -34,7 +34,7 @@ DOT11_REQUEST_SUBTYPE = 2
|
||||
|
||||
|
||||
class ModPump(ModuleUI):
|
||||
""" Scan WiFi networks and detect devices"""
|
||||
"""Scan WiFi networks and detect devices"""
|
||||
|
||||
name = "wifiscan"
|
||||
|
||||
@ -63,7 +63,7 @@ class ModPump(ModuleUI):
|
||||
super(ModPump, self).__init__(parse_args=self.parse_args, root=self.root)
|
||||
|
||||
def do_run(self, args):
|
||||
""" execute module """
|
||||
"""execute module"""
|
||||
print(
|
||||
display_messages(
|
||||
"setting interface: {} monitor momde".format(
|
||||
|
0
wifipumpkin3/plugins/bin/__init__.py
Normal file
0
wifipumpkin3/plugins/bin/__init__.py
Normal file
@ -8,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):
|
||||
@ -64,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 - \
|
@ -37,7 +37,7 @@ from wifipumpkin3.plugins.pumpkinproxy import *
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
from wifipumpkin3.core.utility.collection import SettingsINI
|
||||
|
||||
import sys, getopt, logging, traceback, string, os
|
||||
import sys, getopt, logging
|
||||
|
||||
gVersion = "0.9"
|
||||
|
||||
@ -133,7 +133,7 @@ def parseOptions(argv):
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
def main(argv):
|
||||
def init(argv):
|
||||
(
|
||||
logFile,
|
||||
logLevel,
|
||||
@ -166,5 +166,5 @@ def main(argv):
|
||||
reactor.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
def main():
|
||||
init(sys.argv[1:])
|
@ -20,18 +20,10 @@ import wifipumpkin3.core.utility.constants as C
|
||||
|
||||
|
||||
class DarkLogin(CaptiveTemplatePlugin):
|
||||
meta = {
|
||||
"Name": "DarkLogin",
|
||||
"Version": "1.0",
|
||||
"Description": "Example is a simple portal default page",
|
||||
"Author": "Pumpkin-Dev",
|
||||
"TemplatePath": C.TEMPLATES_FLASK + "templates/DarkLogin",
|
||||
"StaticPath": C.TEMPLATES_FLASK + "templates/DarkLogin/static",
|
||||
"Preview": "plugins/captivePortal/templates/DarkLogin/preview.png",
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
for key, value in self.meta.items():
|
||||
self.__dict__[key] = value
|
||||
self.dict_domain = {}
|
||||
self.ConfigParser = False
|
||||
Name = "DarkLogin"
|
||||
Version = "1.0"
|
||||
Description = "Example is a simple portal default page"
|
||||
Author = "Pumpkin-Dev"
|
||||
TemplatePath = C.TEMPLATES_FLASK + "templates/DarkLogin"
|
||||
StaticPath = C.TEMPLATES_FLASK + "templates/DarkLogin/static"
|
||||
Preview = C.TEMPLATES_FLASK + "templates/DarkLogin/preview.png"
|
||||
|
@ -20,27 +20,11 @@ import wifipumpkin3.core.utility.constants as C
|
||||
|
||||
|
||||
class FlaskDemo(CaptiveTemplatePlugin):
|
||||
meta = {
|
||||
"Name": "FlaskDemo",
|
||||
"Version": "1.0",
|
||||
"Description": "Example is a simple portal default page",
|
||||
"Author": "Pumpkin-Dev",
|
||||
"TemplatePath": C.TEMPLATES_FLASK + "templates/Flask",
|
||||
"StaticPath": C.TEMPLATES_FLASK + "templates/Flask/static",
|
||||
"Preview": "plugins/captivePortal/templates/Flask/preview.png",
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
for key, value in self.meta.items():
|
||||
self.__dict__[key] = value
|
||||
self.dict_domain = {}
|
||||
self.ConfigParser = True
|
||||
|
||||
def init_language(self, lang):
|
||||
if lang.lower() != "default":
|
||||
self.TemplatePath = (
|
||||
C.TEMPLATES_FLASK + "templates/Flask/language/{}".format(lang)
|
||||
)
|
||||
return
|
||||
for key, value in self.meta.items():
|
||||
self.__dict__[key] = value
|
||||
Name = "FlaskDemo"
|
||||
Version = "1.0"
|
||||
Description = "Example is a simple portal default page"
|
||||
Author = "Pumpkin-Dev"
|
||||
TemplatePath = C.TEMPLATES_FLASK + "templates/Flask"
|
||||
StaticPath = C.TEMPLATES_FLASK + "templates/Flask/static"
|
||||
Preview = C.TEMPLATES_FLASK + "templates/Flask/preview.png"
|
||||
Languages = ["En", "ptBr"]
|
@ -4,7 +4,7 @@ import wifipumpkin3.core.utility.constants as C
|
||||
# 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)
|
||||
# Copyright 2022 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.
|
||||
@ -20,19 +20,10 @@ import wifipumpkin3.core.utility.constants as C
|
||||
|
||||
|
||||
class LoginPage(CaptiveTemplatePlugin):
|
||||
meta = {
|
||||
"Name": "loginPage",
|
||||
"Version": "1.0",
|
||||
"Description": "Example is a simple portal default page",
|
||||
"Author": "Pumpkin-Dev",
|
||||
"Language": "En",
|
||||
"TemplatePath": C.TEMPLATES_FLASK + "templates/loginPage",
|
||||
"StaticPath": C.TEMPLATES_FLASK + "templates/loginPage/static",
|
||||
"Preview": "plugins/captivePortal/templates/loginPage/preview.png",
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
for key, value in self.meta.items():
|
||||
self.__dict__[key] = value
|
||||
self.dict_domain = {}
|
||||
self.ConfigParser = False
|
||||
Name = "loginPage"
|
||||
Version = "1.0"
|
||||
Description = "Example is a simple portal default page"
|
||||
Author = "Pumpkin-Dev"
|
||||
TemplatePath = C.TEMPLATES_FLASK + "templates/loginPage"
|
||||
StaticPath = C.TEMPLATES_FLASK + "templates/loginPage/static"
|
||||
Preview = C.TEMPLATES_FLASK + "templates/loginPage/preview.png"
|
@ -20,19 +20,10 @@ import wifipumpkin3.core.utility.constants as C
|
||||
|
||||
|
||||
class Loginv4(CaptiveTemplatePlugin):
|
||||
meta = {
|
||||
"Name": "Login_v4",
|
||||
"Version": "1.0",
|
||||
"Description": "Example is a simple portal default page",
|
||||
"Author": "Pumpkin-Dev",
|
||||
"Language": "En",
|
||||
"TemplatePath": C.TEMPLATES_FLASK + "templates/Login_v4",
|
||||
"StaticPath": C.TEMPLATES_FLASK + "templates/Login_v4/static",
|
||||
"Preview": "plugins/captivePortal/templates/Login_v4/preview.png",
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
for key, value in self.meta.items():
|
||||
self.__dict__[key] = value
|
||||
self.dict_domain = {}
|
||||
self.ConfigParser = False
|
||||
Name = "Login_v4"
|
||||
Version = "1.0"
|
||||
Description = "Example is a simple portal default page"
|
||||
Author = "Pumpkin-Dev"
|
||||
TemplatePath = C.TEMPLATES_FLASK + "templates/Login_v4"
|
||||
StaticPath = C.TEMPLATES_FLASK + "templates/Login_v4/static"
|
||||
Preview = C.TEMPLATES_FLASK + "templates/Login_v4/preview.png"
|
@ -1,3 +1,4 @@
|
||||
from typing import Optional
|
||||
from wifipumpkin3.core.utility.collection import SettingsINI
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
|
||||
@ -20,20 +21,38 @@ import wifipumpkin3.core.utility.constants as C
|
||||
|
||||
|
||||
class CaptiveTemplatePlugin(object):
|
||||
Name = "plugin template captive-portal"
|
||||
version = "1.0"
|
||||
config = SettingsINI(C.CONFIG_CP_INI)
|
||||
loggers = {}
|
||||
Name: str = "CaptiveTemplatePlugin"
|
||||
Version: str = "1.1"
|
||||
Description: str = "Example is a simple portal default page"
|
||||
Author: str = "Pumpkin-Dev"
|
||||
TemplatePath: str = None
|
||||
StaticPath: str = None
|
||||
Preview: str = None
|
||||
Languages: Optional[list] = []
|
||||
config: SettingsINI = SettingsINI(C.CONFIG_CP_INI)
|
||||
|
||||
def __init__(self) -> None:
|
||||
if self.Languages:
|
||||
key = "set_{}".format(self.Name)
|
||||
if not self.config.get_all_childname(key):
|
||||
for lang in self.Languages:
|
||||
self.config.set(key, lang, False)
|
||||
self.config.set(key, self.Languages[0], True)
|
||||
if not self.Name in self.config.get_all_childname("plugins"):
|
||||
self.config.set("plugins", self.Name, False)
|
||||
|
||||
def init_language(self, lang):
|
||||
pass
|
||||
def init_language(self, lang: Optional[str]):
|
||||
if lang:
|
||||
self.TemplatePath = (
|
||||
C.TEMPLATES_FLASK + "templates/{}/templates/{}".format(self.Name, lang)
|
||||
)
|
||||
|
||||
def getSellectedLanguage(self):
|
||||
selected_lang, key = None, "set_{}".format(self.Name)
|
||||
def getActivatedLanguage(self) -> Optional[str]:
|
||||
key = "set_{}".format(self.Name)
|
||||
for lang in self.config.get_all_childname(key):
|
||||
if self.config.get(key, lang, format=bool):
|
||||
selected_lang = lang
|
||||
return selected_lang
|
||||
return lang
|
||||
return None
|
||||
|
||||
def initialize(self):
|
||||
self.init_language(self.getSellectedLanguage())
|
||||
self.init_language(self.getActivatedLanguage())
|
||||
|
@ -41,7 +41,7 @@ from wifipumpkin3.plugins.external.sslstrip.DnsCache import DnsCache
|
||||
|
||||
class ClientRequest(Request):
|
||||
|
||||
""" This class represents incoming client requests and is essentially where
|
||||
"""This class represents incoming client requests and is essentially where
|
||||
the magic begins. Here we remove the client headers we dont like, and then
|
||||
respond with either favicon spoofing, session denial, or proxy through HTTP
|
||||
or SSL to the server.
|
||||
|
@ -23,7 +23,7 @@ from wifipumpkin3.plugins.external.sslstrip.ServerConnection import ServerConnec
|
||||
|
||||
class SSLServerConnection(ServerConnection):
|
||||
|
||||
"""
|
||||
"""
|
||||
For SSL connections to a server, we need to do some additional stripping. First we need
|
||||
to make note of any relative links, as the server will be expecting those to be requested
|
||||
via SSL as well. We also want to slip our favicon in here and kill the secure bit on cookies.
|
||||
|
@ -33,7 +33,7 @@ import gzip, inspect, io
|
||||
|
||||
class ServerConnection(HTTPClient):
|
||||
|
||||
""" The server connection is where we do the bulk of the stripping. Everything that
|
||||
"""The server connection is where we do the bulk of the stripping. Everything that
|
||||
comes back is examined. The headers we dont like are removed, and the links are stripped
|
||||
from HTTPS to HTTP.
|
||||
"""
|
||||
|
@ -24,7 +24,7 @@ class StrippingProxy(HTTPChannel):
|
||||
"""sslstrip is, at heart, a transparent proxy server that does some unusual things.
|
||||
This is the basic proxy server class, where we get callbacks for GET and POST methods.
|
||||
We then proxy these out using HTTP or HTTPS depending on what information we have about
|
||||
the (connection, client_address) tuple in our cache.
|
||||
the (connection, client_address) tuple in our cache.
|
||||
"""
|
||||
|
||||
requestFactory = ClientRequest
|
||||
|
@ -24,7 +24,7 @@ import wifipumpkin3.core.utility.constants as C
|
||||
|
||||
|
||||
class PSniffer(object):
|
||||
""" plugins data sniffers"""
|
||||
"""plugins data sniffers"""
|
||||
|
||||
name = "plugin sniffkin3 master"
|
||||
version = "1.0"
|
||||
@ -34,11 +34,11 @@ class PSniffer(object):
|
||||
session = None
|
||||
|
||||
def filterPackets(self, pkt):
|
||||
""" intercept packetes data """
|
||||
"""intercept packetes data"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_http_headers(self, http_payload):
|
||||
""" get header dict http request"""
|
||||
"""get header dict http request"""
|
||||
try:
|
||||
headers_raw = http_payload[: http_payload.index("\r\n\r\n") + 2]
|
||||
headers = dict(findall(r"(?P<name>.*?):(?P<value>.*?)\r\n", headers_raw))
|
||||
@ -64,5 +64,5 @@ class PSniffer(object):
|
||||
return logger
|
||||
|
||||
def hexdumpPackets(self, pkt):
|
||||
""" show packets hexdump """
|
||||
"""show packets hexdump"""
|
||||
return hexdump(pkt)
|
||||
|
@ -20,7 +20,7 @@ from wifipumpkin3.plugins.sniffkin3.default import PSniffer
|
||||
|
||||
|
||||
class Stealing_emails(PSniffer):
|
||||
""" capture POP3,IMAP,SMTP """
|
||||
"""capture POP3,IMAP,SMTP"""
|
||||
|
||||
_activated = False
|
||||
_instance = None
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user