-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsyrcoXs.sh
executable file
·116 lines (90 loc) · 2.82 KB
/
syrcoXs.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
112
113
114
115
116
#!/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.
ok_answer = "HTTP/1.0 200 OK
Content-type: text/html
"
bad_request_answer = "HTTP/1.0 400 Bad Request
Content-type: text/html
<html>
<body>
<h1>Bad Request</h1>
<p>This server did not understand your request.</p>
</body>
</html>
"
not_found_answer_template = "HTTP/1.0 404 Not Found
Content-type: text/html
<html>
<body>
<h1>Not Found</h1>
<p>The requested URL %s was not found on this server.</p>
</body>
</html>
"
bad_answer_response_template = "HTTP/1.0 501 Method Not Implemented
Content-type: text/html
<html>
<body>
<h1>Method Not Implemented</h1>
<p>The method %s is not implemented by this server.</p>
</body>
</html>
"
#while read data; do
#echo "data = $data"
#date
#done
#i="0"
#while [ $i -lt 6 ]
#do
#read data
#i=$[$i+1]
#echo "iii = $i"
#echo "data = $data"
#date
#done
read -r ddata
#( echo '----------------'; date; set -o posix ; set ; echo '====================' ; echo '0'; echo $0; echo '1'; echo $1; echo '2'; echo $2; echo '*'; echo $*; echo '====================' ) > ./syr.log
echo 'HTTP/1.0 200 OK'
#echo 'Location: http://127.0.0.1:33222/'
#echo 'Cache-Control: private'
echo 'Content-Type: text/html; charset=UTF-8'
echo 'X-Content-Type-Options: nosniff'
echo 'Date: Tue, 28 Jun 2011 09:57:46 GMT'
#date
echo 'Server: sffe'
#echo 'Content-Length: 219'
echo 'X-XSS-Protection: 1; mode=block
'
echo '<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">'
echo '<TITLE>HI SYRCOX</TITLE></HEAD><BODY>'
echo '<H1>syrcoX</H1>'
echo 'Hello to all'
echo '<A HREF="http://127.0.0.1:33222/">home</A>.<br><h1>'
date
echo $ddata | sed '/^GET */!d; s/ HTTP\/1.1//;q'| sed '/^GET */!d; s///;q'
echo '<br>--------<br>'
filee=$(echo $ddata | sed '/^GET */!d; s/ HTTP\/1.1//;q'| sed '/^GET */!d; s///;q')
echo '<br>======<br>'
pwd
echo '<br>--------<br>'
ls -l ./
echo '<br>--------<br>'
cat .${filee}
echo '<br>--------<br>'
`.${filee}`
echo '</h1></BODY></HTML>'
echo '</h1></html>'