subzeroid/insto
GitHub: subzeroid/insto
一款支持 REPL 交互和批量执行的 Instagram OSINT 命令行工具,可对目标账号进行全面情报采集、实时监控和多格式关联分析导出。
Stars: 1 | Forks: 0
# insto
基于 [HikerAPI](https://hikerapi.com) 后端的交互式 Instagram OSINT CLI。

基于同一命令语法的两种使用界面:
- **REPL** — `insto` 会启动一个内置于 prompt-toolkit 的交互式会话,支持 Tab 键补全、
底部工具栏(当前目标、后端、配额),以及实时的 `/watch`
通知。视觉效果类似于 Claude Code 的欢迎屏幕。
- **One-shot** — `insto @user -c [args]` 会运行单个斜杠命令
然后退出。支持管道操作:`--json -` 写入标准输出,`--csv -` 对扁平命令
执行相同操作,`/batch -` 从标准输入读取目标。
## 安装
需要 Python ≥ 3.11。请根据您管理其他 CLI 的习惯选择合适的安装方式:
```
uv tool install insto # uv users — fastest, no venv to manage
pipx install insto # pip users — same effect, classic tool
brew install pipx && pipx install insto # macOS, no Python yet
```
若需使用可选的已登录 `aiograpi` 后端(用于查看私密账户及 Instagram 登录墙内的帖子),请安装该额外依赖:
```
uv tool install 'insto[aiograpi]'
pipx install 'insto[aiograpi]'
```
随后 `insto setup` 会提供 `hiker | aiograpi` 选项,并提示您输入
相应的凭据。有关两者的优缺点以及 aiograpi 的账号封禁风险,请参阅 [`docs/backends.md`](docs/backends.md)。
或者从源码检出目录安装(用于开发):
```
git clone git@github.com:subzeroid/insto.git
cd insto
uv sync && uv run insto --help # editable inside .venv
# 或: uv tool install --editable . 将 `insto` 放入 $PATH
```
## 设置
```
insto setup
```
交互式向导。会将您的 HikerAPI token、输出目录、sqlite 存储路径和可选代理等信息写入 `~/.insto/config.toml`(文件权限模式为 `0600`)。
Token 通过 `getpass` 读取,因此不会回显在终端中;为代理参数传入 `-` 可清除之前保存的值。
Token 的优先级为 **命令行标志 > 环境变量 (`HIKERAPI_TOKEN`) > config.toml**;此优先级规则同样适用于代理设置(`--proxy`,`HIKERAPI_PROXY`,`[hiker].proxy`)。支持 `socks5h://` (Tor) 和 `http://` 代理。
### 环境变量
| Variable | Purpose |
|-------------------|---------------------------------------------------------------------|
| `HIKERAPI_TOKEN` | API token(覆盖 config.toml 中的 `[hiker].token`) |
| `HIKERAPI_PROXY` | 代理 URL(覆盖 `[hiker].proxy`) |
| `INSTO_HOME` | 覆盖默认的 `~/.insto/` 配置根目录 |
| `INSTO_BACKEND` | 设置为 `fake` 以启用端到端测试套件使用的无网络后端 |
## 示例
REPL:
```
$ insto
Tips for getting started
___ _ _ ____ _____ ___ /target set OSINT target
|_ _| \ | / ___|_ _/ _ \ /info full profile dump
| || \| \___ \ | || | | | /help list all commands
| || |\ |___) || || |_| |
|___|_| \_|____/ |_| \___/ Recent activity
@nasa
i n s t o ⇋ o s i n t @instagram
instagram tool · open-source intel
hiker · 14.7M requests left · $4,417 · 15 rps cap
insto @→ /
```
输入 `/` 即可弹出包含所有命令的弹窗(类似 Slack / Claude Code 的风格):
```
insto @→ /info
> /target ferrari
> /info
> /posts 10 # last 10 feed posts, media saved under output/ferrari/posts/
> /posts 10 --no-download # URLs only, no CDN write
> /followers 500 --csv followers.csv
> /diff
> /watch ferrari 600 # poll every 10 minutes (5 min floor)
> /dossier # collect a full target package
> /quit
```
`/info ` 也可作为内联形式使用——执行查找而不会更改当前活动的会话目标。所有单目标命令(如 `/posts nasa 5`、`/dossier nasa` 等)同理。
One-shot:
```
insto @ferrari -c info
insto -c info instagram # inline target, no REPL state
insto @ferrari -c posts 10 --json - # 10 posts, JSON to stdout
insto @ferrari -c followers 500 --csv followers.csv
insto @ferrari -c followers 200 --maltego # Maltego CSV under output/ferrari/
cat targets.txt | insto -c batch - info --yes # stdin pipe + non-interactive
insto -c dossier instagram # full target package
```
`-c ` 会将 `argv` 的其余部分作为斜杠命令的参数,
因此 `-c batch targets.txt info` 会执行 `batch targets.txt info`(每次调用使用一个 `-c`)。当 `/batch` 从标准输入读取或目标列表超出确认阈值时,必须使用 `--yes`。
### 全局标志
| Flag | Purpose |
|---------------------------------|----------------------------------------------------------|
| `-c / --cmd [args...]` | One-shot 模式:运行单个斜杠命令后退出 |
| `-i / --interactive` | 即使提供了目标,也强制进入 REPL |
| `--proxy ` | 为本次调用覆盖 `HIKERAPI_PROXY` |
| `--json [PATH or -]` | 输出 JSON 封装(默认路径、文件或标准输出) |
| `--csv [PATH or -]` | 对扁平行命令执行相同操作 |
| `--maltego [PATH or -]` | Maltego 实体导入 CSV(`--output-format maltego` 的别名) |
| `--output-format {json,csv,maltego}` | 显式格式选择器 |
| `--limit N` / `--no-download` | 单命令分页上限与媒体下载退出选项 |
| `--yes / -y` | 跳过确认提示(在使用 `/batch -` 时必填) |
| `--verbose` / `--debug` | `~/.insto/logs/insto.log` 的日志级别 |
| `--version` | 打印版本号并退出 |
| `--print-completion {bash,zsh}` | 输出 shell 自动补全脚本 |
通过管道输出至 `jq`:
```
insto @ferrari -c info --json - | jq '.username, .followers_count'
```
Shell 自动补全(通过 `shtab` 使用 `argparse`):
```
insto --print-completion zsh > ~/.insto/_insto
echo 'fpath+=~/.insto && autoload -Uz compinit && compinit' >> ~/.zshrc
```
## 命令概览
Profile: `info`, `propic`, `email`, `phone`, `export`。
Media: `posts`, `reels`, `stories`, `highlights`, `tagged`。
Network: `followers`, `followings`, `mutuals`, `similar`。
Content: `hashtags`, `mentions`, `locations`, `captions`, `likes`。
Interactions: `comments`, `wcommented`, `wtagged`。
Watch / diff: `watch`, `unwatch`, `watching`, `diff`, `history`。
Operational: `quota`, `health`, `config`, `purge`。
Session: `target`, `current`, `clear`。
Batch / dossier: `batch`, `dossier` (完整目标信息包:profile + media +
network + analytics,支持 `--maltego` CSV 导出)。
在 REPL 中,每个命令均可带或不带前导 `/` 调用。
## 文件存储位置
- `~/.insto/config.toml` — 设置(权限模式 `0600`)。
- `~/.insto/store.db` — sqlite 存储:快照、监控列表、CLI 历史记录。
- `~/.insto/logs/insto.log` — 轮转日志文件(权限模式 `0600`,已隐去敏感信息)。
- `~/.insto/aiograpi.session.json` — aiograpi 后端的持久化 Instagram 会话
(权限模式 `0600`;仅当您选择该后端时创建)。
- `./output///…` — 下载的媒体文件。可通过
配置中的 `[output_dir]` 或接受该参数的命令中的 `--out` 选项进行覆盖。
## 文档
完整文档请访问 :
- [安装](https://subzeroid.github.io/insto/installation/)
- [基本用法](https://subzeroid.github.io/insto/basic-usage/)
- [CLI 参考](https://subzeroid.github.io/insto/cli-reference/)
- [后端](https://subzeroid.github.io/insto/backends/)
- [架构](https://subzeroid.github.io/insto/architecture/)
- [故障排除](https://subzeroid.github.io/insto/troubleshooting/)
贡献指南:参阅 [CONTRIBUTING.md](CONTRIBUTING.md)。安全策略:参阅 [SECURITY.md](SECURITY.md)。
## 许可证
MIT — 详见 [LICENSE](LICENSE)。
标签:aiograpi, API集成, DNS枚举, ESC4, ESC8, HikerAPI, Instagram, OSINT, Python, 二进制发布, 交互式REPL, 代码示例, 可观测性, 命令控制, 命令行界面, 威胁情报, 开发者工具, 开源工具, 情报分析, 情报收集, 数字取证, 数字取证, 数据分析, 数据导出, 数据采集, 无后门, 漏洞研究, 用户画像, 社交媒体调查, 社会工程学, 网络安全, 网络安全工具, 网络诊断, 自动化脚本, 自动化脚本, 逆向工具, 隐私保护, 隐私调查