hugefiver/fakessh

GitHub: hugefiver/fakessh

一个伪装成真实 OpenSSH 服务的轻量级蜜罐,用于捕获和分析 SSH 暴力破解的凭据与攻击行为。

Stars: 22 | Forks: 3

# 伪造 SSH Server - **可用** - **确实能用** ## 为什么要写这个 为了让自己开心。 ## 如何下载 前往 [发布页面](https://github.com/hugefiver/fakessh/releases/latest),下载最新的二进制文件。 ## Nix / Flake 此仓库现在支持两种源模式: - 本地工作树(默认):`.#fakessh` - Git 源输入:`.#fakessh-git` 示例: - 构建本地源:`nix build .#fakessh` - 运行本地源:`nix run .#default -- -V` - 构建 Git 源(从 lock):`nix build .#fakessh-git` - 更新 Git 源至最新并重新构建: ``` nix flake lock --update-input fakessh-src nix build .#fakessh-git ``` ### 如何选择 预构建的二进制文件命名为 `fakessh_{version}_{os}_{arch}[_minimal]`。 - `darwin` os 代表 `macOS`。 - `amd64` arch 代表 `x86_64`,它可能会有类似 `v2`、`v3` 的后缀。`v3` 代表高性能但需要 CPU 微架构支持,无后缀代表 `v1`,可以在几乎所有 AMD/Intel x86_64 CPU 上运行。有关更多信息,请参见 [这篇维基百科](https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels)。 - 有一个名为 `fakessh_{version}_macosuniversal` 的二进制文件,它是包含所有架构(`amd64`、`arm64`)的 macOS 通用二进制文件。 - 我们大多数人应该使用 `minimal` 二进制文件。它仅包含基本功能,但对大多数用户来说已经足够。一些高级功能将在未来添加,可能从 `0.5.0` 版本开始。 ## TODO - [x] 配置文件 - [ ] 用于 git 服务器的 shell(不会包含在 `minimal` 构建中) - [x] 最大连接数 - [x] 速率限制 - [ ] 用于记录入侵者行为的伪 shell(在 `0.5.1` 中开发中)(!minimal) - [ ] 以 tar/zip 文件形式自定义根文件系统(在 `0.5.2` 中开发中)(!minimal) ## 配置文件 阅读 [此文件](./conf/config.toml) 获取信息。 ## 许可证 [反美 AI 公共许可证](https://github.com/hugefiver/AAAPL) - 详见 [LICENSE](LICENSE)。 ## 命令行用法 ``` Usage of FakeSSH: -A disable anti honeypot scan -V show version of this binary -a enable anti honeypot scan (default) -bind addr binding addr (default ":22") -c path config path -config path config path -delay int wait time for each login (ms) -devia int deviation for wait time (ms) -format [plain|json] log format: [plain|json] (default "plain") -gen generate a private key to key file path -h show this page -help show this page -key path key file path, can set more than one -level [debug|info|warning] log level: [debug|info|warning] (default "info") -log file log file -max maxconn see maxconn -maxconn max:loss_ratio:hard_max max unauthenticated connections in format max:loss_ratio:hard_max, optionalable, see README -maxsucc maxsuccconn see maxsuccconn -maxsuccconn max:loss_rate:hard_max max success connections in format max:loss_rate:hard_max, see maxconn -mc maxconn see maxconn -msc maxsuccconn see maxsuccconn -o option see option -option module.key=value options for modules, "module.key=value" -passwd log password to file -r float success ratio float percent age (0.0 ~ 100.0, default: 0) -rate interval:limit rate limit in format interval:limit -seed string success seed (any string) -try int max try times (default 3) -type string type for generate private key (default "ed25519") -user user:password users in format user:password, can set more than one -version string ssh server version (default "OpenSSH_9.3p1") ``` ### key 选项 1. 一般格式为 `type:option`,选项部分可以留空。 2. 可用的类型包括:`ed25519`、`rsa`、`ecdsa`,如果留空则默认为 `ed25519`。 3. 如果未指定密钥路径,你可以设置多种类型,以 `,` 分隔。例如,`rsa` | `rsa:2048` | `ecdsa:P256,rsa` | `ed25519,ecdsa` 都是可用的,但在生成模式下仅使用设置的第一种类型。 4. `rsa` 的选项是密钥大小,默认为 `4096`。 5. `ecdsa` 的选项是曲线类型,例如 `P256`、`P384`、`P521`,默认为 `P384`。 ### 最大连接数 你可以使用命令行选项 `-maxconn`(或简写 `-mc`)来设置**未认证连接**的最大数量,配置文件中的 `server.max_conn` 具有相同的作用。 而 `-maxsuccconn`(简写 `-msc` 或配置文件中的 `server.max_succ_conn`)用于设置最大**成功**连接数,语法相同。 `-maxconn` 和 `-maxsuccconn` 的格式为 `max:loss_ratio:hard_max`,配置文件的格式展示在 [此文件](./conf/config.toml) 中。 这表示当连接数达到 `max` 时,连接将按一定比例丢失。该比例会线性增加,当连接数等于或大于 `hard_max` 时,比例将达到 `1.0`。 - `max` 是整数,可选,默认代表 `0`: - `max < 0` => 无限制连接,除非设置了 `hard_max`。 - `max = 0` => 使用程序默认值(当前对于 `maxconn` 是 `100`,对于 `maxsuccconn` 是 `5`)。 - `loss_ratio` 是浮点数,可选,默认代表 `0`: - `loss_ratio < 0` => 在达到 `hard_max` 之前不丢失连接。 - `loss_ratio >= 0` => 按此比例丢失连接,并且该比例会线性增加,直到连接数达到 `hard_max`。 - `hard_max` 是整数,可选,默认代表 `0`: - 当 `max < 0` 时 `hard_max <= 0` => 无限制连接。 - 当 `max >= 0` 时 `hard_max <= 0` => 它将取 `max * 2` 和默认值(当前对于 `maxconn` 是 `65535`,对于 `maxsuccconn` 是 `10`)中的**较大**值。
标签:BOF, ETW劫持, EVTX分析, Flake, Go语言, Nix, Python安全, SSH, SSH蜜罐, TGT, 假服务器, 威胁情报, 安全测试, 开发者工具, 攻击性安全, 攻击捕获, 攻防演练, 日志审计, 日志记录, 欺骗防御, 程序破解, 网络安全, 蜜罐, 证书利用, 进程注入, 隐私保护