-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclpemt
134 lines (121 loc) · 4.44 KB
/
clpemt
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
# Detect package manager
detect_package_manager() {
if command -v apt &> /dev/null; then
PM="apt"
elif command -v dnf &> /dev/null; then
PM="dnf"
elif command -v pacman &> /dev/null; then
PM="pacman"
else
echo "Unsupported package manager."
exit 1
fi
}
# Display Title
display_title() {
clear
echo "====================="
echo " CLPE Multitool "
echo "====================="
}
# Functions
system_monitoring() {
case $1 in
1) neofetch ;;
2) df -h ;;
3) free -h ;;
4) top -bn1 | grep "Cpu(s)" ;;
5) sensors ;;
*) echo "Invalid option" ;;
esac
}
network_tools() {
case $1 in
1) ip a ;;
2) read -p "Host to ping: " h; ping -c 4 $h ;;
3) speedtest-cli ;;
4) ss -tuln ;;
*) echo "Invalid option" ;;
esac
}
file_management() {
case $1 in
1) read -p "Directory to backup: " d; read -p "Destination: " dst; tar -czvf $dst $d ;;
2) read -p "Backup file: " f; read -p "Restore to: " r; tar -xzvf $f -C $r ;;
3) read -p "File to compress: " f; read -p "Destination (file.tar.gz): " dst; tar -czvf $dst $f ;;
4) read -p "Compressed file: " f; read -p "Extract to: " d; tar -xzvf $f -C $d ;;
5) read -p "Directory: " d; find $d -type f -exec du -h {} + | sort -rh | head -n 10 ;;
*) echo "Invalid option" ;;
esac
}
package_management() {
case $1 in
1) read -p "Package to search: " pkg; $PM search $pkg ;;
2) read -p "Package to install: " pkg; sudo $PM install $pkg ;;
*) echo "Invalid option" ;;
esac
}
git_tools() {
case $1 in
1) git status ;;
2) git pull ;;
3) git push ;;
4) git log ;;
5) git branch ;;
6) read -p "Branch name to checkout: " branch; git checkout $branch ;;
*) echo "Invalid option" ;;
esac
}
system_management() {
case $1 in
1) sudo $PM update ;;
2) sudo $PM clean ;;
3) sudo $PM autoremove ;;
*) echo "Invalid option" ;;
esac
}
security_tools() {
case $1 in
1) sudo firewall-cmd --state ;;
2) sudo firewall-cmd --add-service=ssh --permanent; sudo firewall-cmd --reload ;;
3) sudo firewall-cmd --remove-service=ssh --permanent; sudo firewall-cmd --reload ;;
*) echo "Invalid option" ;;
esac
}
web_tools() {
case $1 in
1) read -p "Search query: " query; xdg-open "https://www.google.com/search?q=$query" ;;
2) read -p "Spotify search query: " query; xdg-open "https://open.spotify.com/search/$query" ;;
3) read -p "YouTube search query: " query; xdg-open "https://www.youtube.com/results?search_query=$query" ;;
*) echo "Invalid option" ;;
esac
}
# Display Menu
display_menu() {
display_title
echo -e "Categories:\n1) System Monitoring\n2) Network Tools\n3) File Management\n4) Package Management\n5) Git Tools\n6) System Management\n7) Security Tools\n8) Web Tools\n0) Exit"
}
# Main Menu Loop
main_menu() {
while true; do
display_menu
read -p "Choose a category: " cat
case $cat in
1) echo -e "1) System Info\n2) Disk Usage\n3) Memory Usage\n4) CPU Usage\n5) Check Temperature"; read -p "Choose tool: " tool; system_monitoring $tool ;;
2) echo -e "1) Network Info\n2) Ping\n3) Speed Test\n4) Open Ports"; read -p "Choose tool: " tool; network_tools $tool ;;
3) echo -e "1) Backup\n2) Restore\n3) Compress\n4) Decompress\n5) Find Large Files"; read -p "Choose tool: " tool; file_management $tool ;;
4) echo -e "1) Search Package\n2) Install Package"; read -p "Choose tool: " tool; package_management $tool ;;
5) echo -e "1) Git Status\n2) Git Pull\n3) Git Push\n4) Git Log\n5) Git Branch\n6) Checkout Branch"; read -p "Choose tool: " tool; git_tools $tool ;;
6) echo -e "1) System Update\n2) Clear Cache\n3) Remove Old Kernels"; read -p "Choose tool: " tool; system_management $tool ;;
7) echo -e "1) Firewall Status\n2) Enable SSH\n3) Disable SSH"; read -p "Choose tool: " tool; security_tools $tool ;;
8) echo -e "1) Google Search\n2) Spotify Search\n3) YouTube Search"; read -p "Choose tool: " tool; web_tools $tool ;;
0) exit 0 ;;
*) echo "Invalid category" ;;
esac
read -p "Press Enter to return to the main menu or Ctrl+C to exit."
done
}
# Run
detect_package_manager
main_menu