mirror of
https://github.com/Cronocide/wifipumpkin3.git
synced 2025-01-22 11:18:55 +00:00
fixed logical error dhcpd server implementation #158
This commit is contained in:
parent
3a1f7822e9
commit
2cc9c490d2
@ -26,6 +26,7 @@ All notable changes to this project will be documented in this file.
|
||||
- fixed restApi error when get exceptions http request
|
||||
- fixed wirelesscontroller not started into restAPI mode
|
||||
- fixed locale error in docker container
|
||||
- fixed logical error dhcpd server implementation #158
|
||||
|
||||
## [Released]
|
||||
|
||||
|
@ -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.8-blue)](https://github.com/mh4x0f/wifipumpkin3/)
|
||||
[![changelog](https://img.shields.io/badge/version-1.0.9-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)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 467 KiB After Width: | Height: | Size: 243 KiB |
@ -42,14 +42,15 @@ class CoreSettings(Linux):
|
||||
""" reclaim memory """
|
||||
del obj
|
||||
|
||||
def apply_dhcp_config_leases_config(self):
|
||||
def apply_dhcp_config_leases_config(self, settingsAP):
|
||||
with open(C.DHCPCONF_PATH, "w") as dhcp:
|
||||
for line in self.SettingsAP["dhcp-server"]:
|
||||
for line in settingsAP["dhcp-server"]:
|
||||
dhcp.write(line)
|
||||
dhcp.close()
|
||||
if not path.isdir("/etc/dhcp/"):
|
||||
mkdir("/etc/dhcp")
|
||||
remove("/etc/dhcp/dhcpd.conf")
|
||||
if path.isfile("/etc/dhcp/dhcpd.conf"):
|
||||
remove("/etc/dhcp/dhcpd.conf")
|
||||
move(C.DHCPCONF_PATH, "/etc/dhcp/")
|
||||
|
||||
@property
|
||||
|
@ -55,8 +55,9 @@ class DNSController(ControllerBlueprint):
|
||||
|
||||
def getReactorInfo(self):
|
||||
info_reactor = {}
|
||||
info_reactor[self.ActiveReactor.getID()] = {
|
||||
"ID": self.ActiveReactor.getID(),
|
||||
"PID": self.ActiveReactor.getpid(),
|
||||
}
|
||||
if self.ActiveReactor != None:
|
||||
info_reactor[self.ActiveReactor.getID()] = {
|
||||
"ID": self.ActiveReactor.getID(),
|
||||
"PID": self.ActiveReactor.getpid(),
|
||||
}
|
||||
return info_reactor
|
||||
|
@ -212,6 +212,7 @@ class DockerSettings(CoreSettings):
|
||||
def Configure(self):
|
||||
""" configure interface and dhcpd for mount Access Point """
|
||||
self.ifaceHostapd = self.conf.get("accesspoint", "interface")
|
||||
self.DHCP = self.getDHCPConfig()
|
||||
self.SettingsAP = {
|
||||
"interface": [
|
||||
"ifconfig %s up" % (self.ifaceHostapd),
|
||||
@ -238,11 +239,10 @@ class DockerSettings(CoreSettings):
|
||||
"bssid={}\n".format(self.conf.get("accesspoint", "bssid")),
|
||||
],
|
||||
"dhcp-server": [
|
||||
"subnet %s netmask %s {\n"% (self.DHCP["subnet"], self.DHCP["netmask"]),
|
||||
"authoritative;\n",
|
||||
"default-lease-time {};\n".format(self.DHCP["leasetimeDef"]),
|
||||
"max-lease-time {};\n".format(self.DHCP["leasetimeMax"]),
|
||||
"subnet %s netmask %s {\n"
|
||||
% (self.DHCP["subnet"], self.DHCP["netmask"]),
|
||||
"option routers {};\n".format(self.DHCP["router"]),
|
||||
"option subnet-mask {};\n".format(self.DHCP["netmask"]),
|
||||
"option broadcast-address {};\n".format(self.DHCP["broadcast"]),
|
||||
@ -261,8 +261,8 @@ class DockerSettings(CoreSettings):
|
||||
for line in self.SettingsAP["interface"]:
|
||||
exec_bash(line)
|
||||
# check if dhcp option is enabled.
|
||||
if self.conf.get("accesspoint", "dhcp_server", format=bool):
|
||||
self.apply_dhcp_config_leases_config()
|
||||
if self.conf.get("accesspoint", "dhcpd_server", format=bool):
|
||||
self.apply_dhcp_config_leases_config(self.SettingsAP)
|
||||
|
||||
def checkNetworkAP(self):
|
||||
self.ifaceHostapd = self.conf.get("accesspoint", "interface")
|
||||
|
@ -173,6 +173,7 @@ class RestApiSettings(CoreSettings):
|
||||
def Configure(self):
|
||||
""" configure interface and dhcpd for mount Access Point """
|
||||
self.ifaceHostapd = self.conf.get("accesspoint", "interface")
|
||||
self.DHCP = self.getDHCPConfig()
|
||||
self.SettingsAP = {
|
||||
"interface": [
|
||||
"ifconfig %s up" % (self.ifaceHostapd),
|
||||
@ -199,11 +200,10 @@ class RestApiSettings(CoreSettings):
|
||||
"bssid={}\n".format(self.conf.get("accesspoint", "bssid")),
|
||||
],
|
||||
"dhcp-server": [
|
||||
"subnet %s netmask %s {\n"% (self.DHCP["subnet"], self.DHCP["netmask"]),
|
||||
"authoritative;\n",
|
||||
"default-lease-time {};\n".format(self.DHCP["leasetimeDef"]),
|
||||
"max-lease-time {};\n".format(self.DHCP["leasetimeMax"]),
|
||||
"subnet %s netmask %s {\n"
|
||||
% (self.DHCP["subnet"], self.DHCP["netmask"]),
|
||||
"option routers {};\n".format(self.DHCP["router"]),
|
||||
"option subnet-mask {};\n".format(self.DHCP["netmask"]),
|
||||
"option broadcast-address {};\n".format(self.DHCP["broadcast"]),
|
||||
@ -222,8 +222,8 @@ class RestApiSettings(CoreSettings):
|
||||
for line in self.SettingsAP["interface"]:
|
||||
exec_bash(line)
|
||||
# check if dhcp option is enabled.
|
||||
if self.conf.get("accesspoint", "dhcp_server", format=bool):
|
||||
self.apply_dhcp_config_leases_config()
|
||||
if self.conf.get("accesspoint", "dhcpd_server", format=bool):
|
||||
self.apply_dhcp_config_leases_config(self.SettingsAP)
|
||||
|
||||
def checkNetworkAP(self):
|
||||
"this will be checked on web interface "
|
||||
|
@ -161,6 +161,7 @@ class StaticSettings(CoreSettings):
|
||||
def Configure(self):
|
||||
""" configure interface and dhcpd for mount Access Point """
|
||||
self.ifaceHostapd = self.conf.get("accesspoint", "interface")
|
||||
self.DHCP = self.getDHCPConfig()
|
||||
self.SettingsAP = {
|
||||
"interface": [
|
||||
"ifconfig %s up" % (self.ifaceHostapd),
|
||||
@ -187,11 +188,10 @@ class StaticSettings(CoreSettings):
|
||||
"bssid={}\n".format(self.conf.get("accesspoint", "bssid")),
|
||||
],
|
||||
"dhcp-server": [
|
||||
"subnet %s netmask %s {\n"% (self.DHCP["subnet"], self.DHCP["netmask"]),
|
||||
"authoritative;\n",
|
||||
"default-lease-time {};\n".format(self.DHCP["leasetimeDef"]),
|
||||
"max-lease-time {};\n".format(self.DHCP["leasetimeMax"]),
|
||||
"subnet %s netmask %s {\n"
|
||||
% (self.DHCP["subnet"], self.DHCP["netmask"]),
|
||||
"option routers {};\n".format(self.DHCP["router"]),
|
||||
"option subnet-mask {};\n".format(self.DHCP["netmask"]),
|
||||
"option broadcast-address {};\n".format(self.DHCP["broadcast"]),
|
||||
@ -210,8 +210,8 @@ class StaticSettings(CoreSettings):
|
||||
for line in self.SettingsAP["interface"]:
|
||||
exec_bash(line)
|
||||
# check if dhcp option is enabled.
|
||||
if self.conf.get("accesspoint", "dhcp_server", format=bool):
|
||||
self.apply_dhcp_config_leases_config()
|
||||
if self.conf.get("accesspoint", "dhcpd_server", format=bool):
|
||||
self.apply_dhcp_config_leases_config(self.SettingsAP)
|
||||
|
||||
def checkNetworkAP(self):
|
||||
self.ifaceHostapd = self.conf.get("accesspoint", "interface")
|
||||
|
Loading…
Reference in New Issue
Block a user