全部只依赖 curl(部分功能需要 jq),无需注册、无需 API Key。
站点对外只有两个接口(/ 查自己、/<IP> 查指定 IP),这些脚本就是围绕它们的封装;
批量场景由脚本内部循环调用 + 限速实现,不依赖批量接口。
所有脚本均已实测可用。
chmod +x *.sh./myip.sh # 完整详情(纯文本)
./myip.sh -q # 只输出 IP,适合脚本取值
./myip.sh -j # 完整 JSON
./myip.sh -x socks5h://127.0.0.1:1080 # 走代理查,确认代理出口./ipcheck.sh 1.1.1.1 # 纯文本详情
./ipcheck.sh 1.1.1.1 8.8.8.8 # 查多个
./ipcheck.sh -j 1.1.1.1 # JSON
./ipcheck.sh -f type 1.1.1.1 # 只取某字段(需 jq)-f 可选字段:ip country city isp asn type score level blocklisted residential
$ ./ipcheck.sh -f type 1.1.1.1
数据中心
$ ./ipcheck.sh -f residential 202.96.128.86
yes只在 IP 变化时输出,适合换节点、拨号重连、判断代理是否掉线回落。
./ipwatch.sh # 每 10 秒
./ipwatch.sh 30 # 每 30 秒
./ipwatch.sh 10 -d # 变化时同时打印完整详情
./ipwatch.sh 10 -x socks5h://127.0.0.1:1080 # 盯代理出口
./ipwatch.sh 30 >> ~/ip-changes.log & # 后台记录监控出口 IP,每 10s 检查一次(Ctrl-C 退出)
[2026-08-15 11:07:22] 当前出口: 203.0.113.9
[2026-08-15 11:14:02] ⚡ IP 变化: 203.0.113.9 → 198.51.100.7
./batch-check.sh ips.txt # CSV 到 stdout
./batch-check.sh ips.txt > out.csv # 存文件,Excel 可直接打开
./batch-check.sh -t ips.txt # 人眼友好的表格
cat ips.txt | ./batch-check.sh # 从管道读输入文件很宽容 —— 自动提取 IP、去重、跳过注释与空行,支持代理串格式:
# 我的代理池
8.8.8.8
1.1.1.1:8080
user:pass@203.0.113.9:3128
输出(CSV 列):ip,country,city,isp,asn,type,score,level,blocklisted,tiktok,ecom,social,ai
自动去重、逐个查询并留间隔(默认 1 秒,可用
IPYOU_SLEEP调整),遇429自动退避重试。
.\ipyou.ps1 # 本机详情
.\ipyou.ps1 -Quiet # 只取 IP
.\ipyou.ps1 1.1.1.1 # 查指定 IP
.\ipyou.ps1 1.1.1.1 -Json # 返回对象,可继续取字段
.\ipyou.ps1 8.8.8.8,1.1.1.1 -Table # 多 IP 表格
.\ipyou.ps1 -Watch 10 # 监控出口 IP$d = .\ipyou.ps1 1.1.1.1 -Json
$d.usage_inferred.label
$d.ip_score.score文件为 UTF-8 BOM 编码,Windows PowerShell 5.1 下中文才不会乱码,别用无 BOM 的编辑器另存。 若执行被策略拦截:
powershell -ExecutionPolicy Bypass -File .\ipyou.ps1
python3 ipyou.py # 本机详情
python3 ipyou.py -q # 只取 IP
python3 ipyou.py 1.1.1.1 # 查指定 IP
python3 ipyou.py -j 1.1.1.1 # JSON
python3 ipyou.py -f type 1.1.1.1
python3 ipyou.py -b ips.txt > out.csv # 批量 → CSV作为库导入(只用标准库,无需 pip install):
from ipyou import myip, myip_details, details, batch, is_residential
print(myip()) # '1.2.3.4'
d = details('1.1.1.1')
print(d['usage_inferred']['label'], d['ip_score']['score'])
print(is_residential('202.96.128.86')) # True
for row in batch(['8.8.8.8', '1.1.1.1']): # 自动去重,循环调用并留间隔
print(row['ip'], row['usage_inferred']['label'], row['ip_score']['score'])| 变量 | 默认值 | 说明 |
|---|---|---|
IPYOU_BASE |
https://ipyou.net |
服务地址,改成自建实例也能用 |
IPYOU_TIMEOUT |
10–60(按脚本) | 请求超时秒数 |
IPYOU_BASE=https://your-instance.example ./myip.sh有防滥用限流,正常使用不受影响;超限返回 429 与 Retry-After。
批量场景优先用 batch-check.sh —— 它已经处理好去重、限速与 429 退避;自己写循环时记得加 sleep。
MIT —— 随便改,随便用。