-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwifid.py
83 lines (67 loc) · 1.8 KB
/
wifid.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
77
78
79
80
81
82
83
#!/usr/bin/env python3
# Github : https://github.com/SlavPH
# Telegram : https://telegram.me/SlavPH
# LIbraries
import os
import sys
# Colors
black='\033[1;90m' # Black
red='\033[1;91m' # Red
green='\033[1;92m' # Green
yellow='\033[1;93m' # Yellow
blue='\033[1;94m' # Blue
purple='\033[1;95m' # Purple
cyan='\033[1;96m' # Cyan
white='\033[1;97m' # White
reset='\033[0m' # Reset
# Clear Terminal
os.system("clear")
# Icon
icon = (f"""
{blue} .__ _____.__ {red} ________
{blue} __ _ _|__|/ ____\__|{red} \______ \
{blue} \ \/ \/ / \ __\| |{red} | | \
{blue} \ /| || | | |{red} | ` \
{blue} \/\_/ |__||__| |__|{red} /_______ /
{green} Simple Wifi Manager{red} \/
{green} By SlavPH & Aqaye Farazamehr
{reset}
""")
# Menu
menu = (f"""
{red}[1] {green}Show interfaces
{red}[2] {green}Turn wifi on
{red}[3] {green}Turn wifi off
{red}[4] {green}Show wifi devices
{red}[5] {green}Connect to wifi
{red}[0] {green}Exit
{reset}
""")
print(icon)
print(menu)
# Main Function
def main():
# input option
option = input(f"\n{cyan}Choose your option : {reset}")
if option == "1":
os.system("nmcli d")
main()
elif option == "2":
os.system("nmcli r wifi on")
main()
elif option == "3":
os.system("nmcli r wifi off")
main()
elif option == "4":
os.system("nmcli d wifi list")
main()
elif option == "5":
ssid = input(f"\n {yellow}[*] Enter the wifi name : {red}")
passwd = input(f"\n {yellow}[*] Enter the password : {red}")
print(f"{reset}\n")
os.system(f"nmcli d wifi connect {ssid} password {passwd}")
main()
elif option == "0":
sys.exit()
if __name__ == "__main__":
main()