mirror of
https://github.com/Cronocide/wifipumpkin3.git
synced 2025-01-22 11:18:55 +00:00
added hostapd configuration file from wifipumpkin3 console
This commit is contained in:
parent
c0fb50ad6d
commit
dc9ea50346
@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
|
||||
### Added
|
||||
- added improves wifideauth module for support multi targets
|
||||
- added improves ConsoleUi and added help for command add, rm from wifideauth module
|
||||
- added hostapd configuration file from wifipumpkin3 console
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -53,6 +53,7 @@ docker=false
|
||||
restapi=false
|
||||
|
||||
[accesspoint]
|
||||
enable_hostapd_config=false
|
||||
enable_security=false
|
||||
wpa_algorithms=TKIP
|
||||
wpa_sharedkey=1234567890
|
||||
@ -73,6 +74,12 @@ status_ap=false
|
||||
timer_update_info=2000
|
||||
ap_max_inactivity=3600
|
||||
|
||||
[hostapd_config]
|
||||
ieee80211n=1 #Whether IEEE 802.11n (HT) is enabled
|
||||
hw_mode=g
|
||||
ignore_broadcast_ssid=0 #AP will broadcast SSID
|
||||
skip_inactivity_poll=1
|
||||
|
||||
[colors_log]
|
||||
generic=light-white, #000000
|
||||
pumpkinproxy=light-red, #000000
|
||||
|
16
helps/help_hostapd_config_command.txt
Normal file
16
helps/help_hostapd_config_command.txt
Normal file
@ -0,0 +1,16 @@
|
||||
help hostapd_config
|
||||
===================
|
||||
|
||||
Usage: set hostapd_config.[variable] [value]
|
||||
|
||||
param [variable]: The key come from hostapd configuration file (hostapd.conf)
|
||||
param [value]: The value come from hostapd configuration file (hostapd.conf
|
||||
|
||||
you can see more options on link bellow:
|
||||
https://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf.
|
||||
|
||||
Description:
|
||||
set variables hostapd configuration file
|
||||
|
||||
Referencies:
|
||||
https://wifipumpkin3.github.io/docs/getting-started#core-commands
|
@ -1,7 +1,7 @@
|
||||
set AP variables:
|
||||
|
||||
Usage: set [variable] [value]
|
||||
param variable: set variables accesspoint [ssid, bssid, interface, security, channel]
|
||||
param variable: set variables accesspoint [ssid, bssid, interface, security, channel, hostapd_config]
|
||||
|
||||
Description:
|
||||
Change variables rogue accesspoint attack
|
||||
|
11
helps/help_unset_command.txt
Normal file
11
helps/help_unset_command.txt
Normal file
@ -0,0 +1,11 @@
|
||||
unset hostapd_config variables:
|
||||
|
||||
Usage: unset hostapd_config.[variable]
|
||||
param variable: unset variables for hostapd configuration file
|
||||
|
||||
Description:
|
||||
Unset variables for hostapd.conf
|
||||
|
||||
Referencies:
|
||||
https://wifipumpkin3.github.io/docs/getting-started#core-commands
|
||||
|
@ -90,6 +90,7 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
"parser_set_plugin": self.mitm_controller.sniffkin3,
|
||||
"parser_set_mode": self.wireless_controller.Settings,
|
||||
"parser_set_security": self.wireless_controller.Settings,
|
||||
"parser_set_hostapd_config": self.wireless_controller.Settings,
|
||||
}
|
||||
self.parser_autcomplete_func = {}
|
||||
|
||||
@ -100,7 +101,10 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
# register autocomplete set security command
|
||||
self.parser_autcomplete_func[
|
||||
"parser_set_security"
|
||||
] = self.wireless_controller.Settings.getCommands
|
||||
] = self.wireless_controller.Settings.getCommandsSecurity
|
||||
self.parser_autcomplete_func[
|
||||
"parser_set_hostapd_config"
|
||||
] = self.wireless_controller.Settings.getCommandsHostapd
|
||||
|
||||
self.commands = {
|
||||
"interface": "interface",
|
||||
@ -111,6 +115,7 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
"plugin": None, # only for settings plugin
|
||||
"mode": None, # only for settings mdoe
|
||||
"security": "enable_security",
|
||||
"hostapd_config": "enable_hostapd_config",
|
||||
}
|
||||
|
||||
# get all command plugins and proxies
|
||||
@ -364,8 +369,9 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
return
|
||||
|
||||
for func in self.parser_list_func:
|
||||
if command in 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]:
|
||||
@ -373,6 +379,20 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
|
||||
print(display_messages("unknown command: {} ".format(command), error=True))
|
||||
|
||||
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]
|
||||
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)
|
||||
)
|
||||
except IndexError:
|
||||
return print(
|
||||
display_messages("unknown sintax : {} ".format(args), error=True)
|
||||
)
|
||||
|
||||
def complete_ignore(self, text, args, start_index, end_index):
|
||||
if text:
|
||||
return [
|
||||
@ -393,6 +413,18 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
else:
|
||||
return list(self.logger_manager.all())
|
||||
|
||||
def complete_unset(self, text, args, start_index, end_index):
|
||||
if text:
|
||||
command_list = []
|
||||
for func in self.parser_autcomplete_func:
|
||||
if text.startswith(func.split("_set_")[1]):
|
||||
for command in self.parser_autcomplete_func[func]:
|
||||
if command.startswith(text):
|
||||
command_list.append(command)
|
||||
return command_list
|
||||
else:
|
||||
return ["hostapd_config"]
|
||||
|
||||
def complete_set(self, text, args, start_index, end_index):
|
||||
if text:
|
||||
command_list = []
|
||||
@ -421,6 +453,9 @@ 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")
|
||||
|
||||
def help_mode(self):
|
||||
self.show_help_command("help_mode_command")
|
||||
|
@ -132,12 +132,20 @@ class AccessPointSettings(CoreSettings):
|
||||
)
|
||||
|
||||
@property
|
||||
def getCommands(self):
|
||||
def getCommandsSecurity(self):
|
||||
commands = ["wpa_algorithms", "wpa_sharedkey", "wpa_type"]
|
||||
list_commands = []
|
||||
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")
|
||||
list_commands = []
|
||||
for command in commands_host:
|
||||
list_commands.append("hostapd_config" + "." + command)
|
||||
return list_commands
|
||||
|
||||
def parser_set_security(self, value, settings):
|
||||
try:
|
||||
@ -149,6 +157,14 @@ class AccessPointSettings(CoreSettings):
|
||||
except IndexError:
|
||||
print(display_messages("unknown sintax command", error=True))
|
||||
|
||||
def parser_set_hostapd_config(self, value, settings):
|
||||
try:
|
||||
# key = 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 """
|
||||
self.DHCP = self.Settings.DHCP.conf
|
||||
|
@ -48,6 +48,11 @@ class SettingsINI(object):
|
||||
self.psettings.setValue(key, value)
|
||||
self.closeGroup()
|
||||
|
||||
def unset(self, name_group, key):
|
||||
self.psettings.beginGroup(name_group)
|
||||
self.psettings.remove(key)
|
||||
self.closeGroup()
|
||||
|
||||
def set_one(self, name_group, key, value):
|
||||
""" Sets the value of setting key to value """
|
||||
self.set(name_group, key, value)
|
||||
|
@ -54,7 +54,13 @@ class Docker(Mode):
|
||||
# add extra hostapd settings
|
||||
self.addExtraHostapdSettings()
|
||||
|
||||
ignore = ("interface=", "ssid=", "channel=", "essid=")
|
||||
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)))
|
||||
|
||||
with open(C.DOCKERHOSTAPDCONF_PATH, "w") as apconf:
|
||||
for i in self.Settings.SettingsAP["hostapd"]:
|
||||
apconf.write(i)
|
||||
|
@ -55,7 +55,14 @@ class RestAPI(Mode):
|
||||
# add extra hostapd settings
|
||||
self.addExtraHostapdSettings()
|
||||
|
||||
ignore = ("interface=", "ssid=", "channel=", "essid=")
|
||||
|
||||
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)))
|
||||
|
||||
with open(C.HOSTAPDCONF_PATH, "w") as apconf:
|
||||
for i in self.Settings.SettingsAP["hostapd"]:
|
||||
apconf.write(i)
|
||||
|
@ -54,7 +54,14 @@ class Static(Mode):
|
||||
# add extra hostapd settings
|
||||
self.addExtraHostapdSettings()
|
||||
|
||||
ignore = ("interface=", "ssid=", "channel=", "essid=")
|
||||
|
||||
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)))
|
||||
|
||||
with open(C.HOSTAPDCONF_PATH, "w") as apconf:
|
||||
for i in self.Settings.SettingsAP["hostapd"]:
|
||||
apconf.write(i)
|
||||
|
@ -33,6 +33,7 @@ class Mode(Qt.QObject):
|
||||
Name = "Wireless Mode Generic"
|
||||
service = None
|
||||
reactor = None
|
||||
ignore_key_hostapd = ("interface", "ssid", "channel", "essid", "ap_max_inactivity")
|
||||
|
||||
def __init__(self, parent=None, FSettings=None):
|
||||
super(Mode, self).__init__()
|
||||
|
@ -43,7 +43,7 @@ class Ap(ExtensionUI):
|
||||
def do_ap(self, args):
|
||||
"""ap: show all variable and status from AP """
|
||||
headers_table, output_table = (
|
||||
["BSSID", "SSID", "Channel", "Interface", "Status", "Security"],
|
||||
["bssid", "ssid", "channel", "interface", "status", "security", "hostapd_config"],
|
||||
[],
|
||||
)
|
||||
print(display_messages("Settings AccessPoint:", info=True, sublime=True))
|
||||
@ -58,12 +58,16 @@ class Ap(ExtensionUI):
|
||||
if status_ap
|
||||
else setcolor("not Running", color="red"),
|
||||
self.root.conf.get("accesspoint", self.root.commands["security"]),
|
||||
self.root.conf.get("accesspoint", self.root.commands["hostapd_config"]),
|
||||
]
|
||||
)
|
||||
display_tabulate(headers_table, output_table)
|
||||
enable_security = self.root.conf.get(
|
||||
"accesspoint", self.root.commands["security"], format=bool
|
||||
)
|
||||
enable_hostapd_config = self.root.conf.get(
|
||||
"accesspoint", self.root.commands["hostapd_config"], format=bool
|
||||
)
|
||||
|
||||
if enable_security:
|
||||
headers_sec, output_sec = (
|
||||
@ -80,3 +84,11 @@ 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')
|
||||
self.show_help_command("help_hostapd_config_command")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user