-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsyrcoX.sh
executable file
·112 lines (88 loc) · 2.33 KB
/
syrcoX.sh
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
#!/bin/bash
#syrcoX - SYstem Remote COmands eXecutor
#Copyright 2011 Alexander Desyatnichenko <desyatnichenko at gmail.com>
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#MA 02110-1301, USA.
function beginanswer()
{
echo "Content-type: text/html
"
cat ./syrcoXh/main.html|sed -n '/<!DOCTYPE/,/\/nav>/p'
}
function endpage()
{
echo "<p>Server time: "
date
echo "</p>"
cat ./syrcoXh/main.html|sed -n '/<nav/,/\/nav>/p'
echo '</body></html>'
}
function allprocessX()
{
echo "<h1>All process runing:</h1><textarea rows='20' cols='100' name='text'>"
ps aux
echo "</textarea>"
}
function allusersX()
{
echo '<h1>All user singing</h1><pre>'
who
echo '</pre>'
}
function dfX()
{
echo '<h1>Disk space</h1><pre>'
df
echo '</pre>'
}
function cpuinformationX()
{
echo "<h1>CPU information</h1><textarea rows='20' cols='100' name='text'>"
cat /proc/cpuinfo
echo "</textarea>"
}
function memoryinformationX()
{
echo "<h1>Memory Information</h1><textarea rows='20' cols='100' name='text'>"
cat /proc/meminfo
echo "</textarea>"
}
function rebootX()
{
echo '<h1>Reboot</h1><pre>'
su -c "reboot" root
echo '10 seconds to go reboot</pre>'
}
function poweroffX()
{
echo '<h1>Power off</h1><pre>'
su -c "poweroff" root
echo '10 seconds to go poweroff</pre>'
}
function anyaverX()
{
echo '<h1>syrcoX</h1>'
cat ./syrcoXh/main.html|sed -n '/<h1/,/\/h1>/p'
}
beginanswer
case "$1" in
'allprocess') allprocessX;;
'allusers') allusersX;;
'dff') dfX;;
'cpuinformation') cpuinformationX;;
'memoryinformation') memoryinformationX;;
'reboott') rebootX;;
'powerofff') poweroffX;;
*) anyaverX;;
esac
endpage