aboutsummaryrefslogtreecommitdiff
path: root/autoDHCP.py
diff options
context:
space:
mode:
Diffstat (limited to 'autoDHCP.py')
-rwxr-xr-xautoDHCP.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/autoDHCP.py b/autoDHCP.py
index ce699c4..cdada36 100755
--- a/autoDHCP.py
+++ b/autoDHCP.py
@@ -9,21 +9,21 @@ import subprocess
import tempfile
-def guess_wifi():
+def guess_wifi() -> list[str]:
return [interface for interface in os.listdir('/sys/class/net/') if
exists(f'/sys/class/net/{interface}/wireless')]
-def guess_nowifi():
+def guess_nowifi() -> list[str]:
return [interface for interface in os.listdir('/sys/class/net/') if
not exists(f'/sys/class/net/{interface}/wireless')]
-def guess_interface():
+def guess_interface() -> list[str]:
return [interface for interface in os.listdir('/sys/class/net/')]
-def guess_internet():
+def guess_internet() -> list[str]:
com = subprocess.Popen(['ip', 'route', 'show'], stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stdout, stderr = com.communicate()
@@ -39,7 +39,7 @@ def guess_internet():
return list(set(internet_i))
-def stripedLine(line):
+def stripedLine(line) -> str:
words = line.split(' ')
if 'dev' in words and words.index('dev'):
return words[words.index('dev') + 1]
@@ -47,10 +47,11 @@ def stripedLine(line):
return ''
-def menu(listEntry, strInput, refresh=None):
+def menu(listEntry, strInput, refresh=None) -> int:
if listEntry == []:
print(f"Error menu: Empty list\n({strInput})", file=sys.stderr)
- exit(1)
+ sys.exit(1)
+
c = -1
if len(listEntry) == 1:
c = 0
@@ -73,7 +74,7 @@ def menu(listEntry, strInput, refresh=None):
ip = '10.5.6.11'
netRange = '24'
-ssid = '🦄_🌈'
+ssid = '🦖'
password = 'chocoball'
hostapd_conf = '''
@@ -252,6 +253,7 @@ if __name__ == '__main__':
if arg.teth:
os.system('sysctl net.ipv4.ip_forward=1')
+ os.system('sysctl net.ipv6.conf.all.forwarding=1')
os.system(f'iptables -t nat -A POSTROUTING -o {inetInt} -j MASQUERADE')
os.system('iptables -A FORWARD -m conntrack --ctstate'
' RELATED,ESTABLISHED -j ACCEPT')