-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWifiPenguin.py
76 lines (57 loc) · 2.08 KB
/
WifiPenguin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import os
writeline = ""
text = ""
def fullcode():
filepath = "/etc/NetworkManager/conf.d/default-wifi-powersave-on.conf"
if os.path.exists(filepath) and os.access(filepath, os.W_OK):
file = open(filepath, "w")
file.write(writeline)
print(text)
else:
print("/etc/NetworkManager/conf.d/default-wifi-powersave-on.conf not found, Please start the program as "
"administrator: sudo python3 WifiPenguin.py. Also make sure your operating system is one of these: Debian"
" or Debian-based distribution (Linux Mint, Ubuntu, KDE-neon, Pop!_OS, Zorin OS etc), Fedora, CentOS, "
"AlmaLinux")
def maincode():
global writeline
global text
text = "Wi-Fi Power Saving Disabled"
writeline = """ [connection]
wifi.powersave = 2"""
fullcode()
def defaultcode():
global writeline
global text
text = "Wi-Fi Power Saving Enabled"
writeline = """ [connection]
wifi.powersave = 3"""
fullcode()
os.system('clear')
maintext = """
__ __ ____ _____ ____ ____ ___ ____ ____ __ __ ____ ____
| T__T Tl j| |l j | \ / _]| \ / T| T Tl j| \
| | | | | T | __j | T | o )/ [_ | _ YY __j| | | | T | _ Y
| | | | | | | l_ | | | _/Y _]| | || T || | | | | | | |
l ` ' ! | | | _] | | | | | [_ | | || l_ || : | | | | | |
\ / j l | T j l | | | T| | || |l | j l | | |
\_/\_/ |____jl__j |____j l__j l_____jl__j__jl___,_j \__,_j|____jl__j__j
"""
print(maintext)
print("\n")
print("[1] Start Wifi Penguin" + "\n")
print("[2] Return to Default" + "\n")
print("[3] Exit" + "\n")
while True:
try:
print(" ")
secim = int(input(">"))
if secim == 1:
print("")
maincode()
elif secim == 2:
print("")
defaultcode()
elif secim == 3:
break
except ValueError:
print("")