estebanzarate/htbash
GitHub: estebanzarate/htbash
基于 Bash 的 Hack The Box 靶机信息查询工具,支持按操作系统、难度和状态等多维度筛选机器列表。
Stars: 0 | Forks: 0
# HTBash
用 Bash 编写的命令行工具,用于通过 HTB API 列出和查询 Hack The Box 机器。
## 环境要求
- curl
- jq
- Hack The Box API token
## 安装
```
git clone https://github.com/n0m3l4c000nt35/htbash.git
cd htbash
chmod +x htbash
```
保存你的 API token:
```
mkdir -p $HOME/.config/htb
echo "APP_TOKEN" > $HOME/.config/htb/htbash.conf
```
全局安装:
```
sudo ln -s $(pwd)/htbash /usr/bin/htbash
```
## 使用方法
```
htbash [OPTIONS]
```
### 选项
| 参数 | 描述 |
|------|-------------|
| `-u` | 从 HTB API 同步机器列表 |
| `-l` | 列出所有可用机器 |
| `-i ` | 显示指定机器的详细信息 |
### 过滤器(与 `-l` 配合使用)
| 参数 | 值 | 描述 |
|------|--------|-------------|
| `--os` | `linux`, `windows`, `android` | 按 OS 过滤 |
| `--difficulty` | `easy`, `medium`, `hard`, `insane` | 按难度过滤 |
| `--free` | — | 仅显示免费机器 |
| `--owned` | `y`, `n` | 按已攻破状态过滤 |
## 示例
```
# 同步机器列表
htbash -u
# 列出所有机器
htbash -l
# 显示机器信息
htbash -i Lame
# Easy Linux machines
htbash -l --os linux --difficulty easy
# 仅免费机器
htbash -l --free
# Owned machines
htbash -l --owned y
# 尚未 Owned 的 Hard Windows machines
htbash -l --os windows --difficulty hard --owned n
```
## 配置
API token 必须存储在 `$HOME/.config/htb/htbash.conf` 中。运行 `-u` 后,机器缓存将保存到 `$HOME/.config/htb/machines/machines.json`。
## 故障排除
**机器未找到** — 运行 `htbash -u` 同步机器列表并确认名称正确。
**API 连接错误** — 检查 `~/.config/htb/htbash.conf` 中的 token 是否有效。
标签:API客户端, CLI, CTF工具, DNS解析, Golang, Hack The Box, WiFi技术, 安全编程, 应用安全, 开源项目, 数据展示, 漏洞搜索, 漏洞攻防, 红队, 网络安全, 自动化查询, 隐私保护