Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
15 changed files
with
502 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import os | ||
import shutil | ||
import sys | ||
|
||
class HostapdMACACL(object): | ||
|
||
def __init__(self, | ||
settings, | ||
options): | ||
|
||
self.debug = options['debug'] | ||
|
||
assert not (options['mac_whitelist'] is not None and options['mac_blacklist'] is not None) | ||
|
||
if options['mac_whitelist'] is not None: | ||
self.input_path = options['mac_whitelist'] | ||
self.output_path = settings.dict['paths']['hostapd']['mac_whitelist'] | ||
self.mode = 'mac_whitelist' | ||
elif options['mac_blacklist'] is not None: | ||
self.input_path = options['mac_blacklist'] | ||
self.output_path = settings.dict['paths']['hostapd']['mac_blacklist'] | ||
self.mode = 'mac_blacklist' | ||
else: | ||
raise Exception('[HostapdACL] this should never happen') | ||
|
||
|
||
if self.debug: | ||
print('[HostapdACL] self.input_path: ', self.input_path) | ||
print('[HostapdACL] self.output_path: ', self.output_path) | ||
print('[HostapdACL] self.mode: ', self.output_path) | ||
|
||
def remove(self): | ||
|
||
if not self.debug: | ||
|
||
try: | ||
|
||
os.remove(self.output_path) | ||
|
||
except FileNotFoundError: | ||
|
||
print('[HostapdACL] Cannot remove file that does not exist') | ||
|
||
def path(self, path=None): | ||
|
||
if path is not None: | ||
self.output_path = path | ||
|
||
return self.output_path | ||
|
||
def generate(self): | ||
|
||
try: | ||
|
||
shutil.copy(self.input_path, self.output_path) | ||
|
||
except FileNotFoundError: | ||
|
||
sys.exit('[HostapdACL] ACL file not found: {}'.format(self.input_path)) | ||
|
||
return self.path() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import os | ||
import shutil | ||
import sys | ||
|
||
class HostapdSSIDACL(object): | ||
|
||
def __init__(self, | ||
settings, | ||
options): | ||
|
||
self.debug = options['debug'] | ||
|
||
assert not (options['ssid_whitelist'] is not None and options['ssid_blacklist'] is not None) | ||
|
||
if options['ssid_whitelist'] is not None: | ||
self.input_path = options['ssid_whitelist'] | ||
self.output_path = settings.dict['paths']['hostapd']['ssid_whitelist'] | ||
self.mode = 'ssid_whitelist' | ||
elif options['ssid_blacklist'] is not None: | ||
self.input_path = options['ssid_blacklist'] | ||
self.output_path = settings.dict['paths']['hostapd']['ssid_blacklist'] | ||
self.mode = 'ssid_blacklist' | ||
else: | ||
raise Exception('[HostapdSSIDACL] this should never happen') | ||
|
||
|
||
if self.debug: | ||
print('[HostapdSSIDACL] self.input_path: ', self.input_path) | ||
print('[HostapdSSIDACL] self.output_path: ', self.output_path) | ||
print('[HostapdSSIDACL] self.mode: ', self.output_path) | ||
|
||
def remove(self): | ||
|
||
if not self.debug: | ||
|
||
try: | ||
|
||
os.remove(self.output_path) | ||
|
||
except FileNotFoundError: | ||
|
||
print('[HostapdSSIDACL] Cannot remove file that does not exist') | ||
|
||
def path(self, path=None): | ||
|
||
if path is not None: | ||
self.output_path = path | ||
|
||
return self.output_path | ||
|
||
def generate(self): | ||
|
||
try: | ||
|
||
shutil.copy(self.input_path, self.output_path) | ||
|
||
except FileNotFoundError: | ||
|
||
sys.exit('[HostapdSSIDACL] ACL file not found: {}'.format(self.input_path)) | ||
|
||
return self.path() |
Oops, something went wrong.