作者 Author: 北京老李 (Beijing Lao Li)
版本 Version: 0.0.2
许可证 License: MIT
本工具仅支持单主机扫描,出于安全考虑,以下输入会被拒绝:
允许的目标格式:
192.168.1.1scanme.nmap.org127.0.0.1, localhostLi Base Scan 是一个集成多种安全工具的Linux基线扫描器,v0.0.2版本包含以下增强功能:
工具功能扫描类型nmap端口扫描、服务识别网络层lynis系统安全审计主机层niktoWeb漏洞扫描应用层sqlmapSQL注入测试应用层trivy容器/文件系统漏洞多层
text
快速扫描 127.0.0.1
text
标准扫描 127.0.0.1
text
完整扫描 127.0.0.1
完整扫描 127.0.0.1 包含web
text
web扫描 http://localhost
扫描网站 http://example.com
text
合规扫描 127.0.0.1
基线检查 localhost
text
隐蔽扫描 192.168.1.1
慢速扫描 target.com
text
"快速扫描 192.168.1.1"
"标准扫描 localhost"
"检查系统安全"
"扫描网站 http://localhost:8080"
"完整安全评估 127.0.0.1"
"基线扫描"
"隐蔽扫描 10.0.0.1"
text
"扫描 example.com 并检查SQL注入"
"发现什么漏洞?"
"给我修复建议"
"导出HTML报告"
"系统加固情况如何?"
"Web应用有什么问题?"
bash
# 快速扫描
python3 scripts/li_base_scan.py 127.0.0.1 --mode quick
# 标准扫描
python3 scripts/li_base_scan.py 127.0.0.1 --mode standard
# 完整扫描
python3 scripts/li_base_scan.py 127.0.0.1 --mode full
bash
python3 scripts/li_base_scan.py -c "快速扫描 127.0.0.1"
bash
# 导出Markdown报告
python3 scripts/li_base_scan.py 127.0.0.1 --mode full --export markdown
# 导出JSON报告
python3 scripts/li_base_scan.py 127.0.0.1 --mode full --export json
# 生成HTML报告(通过entrypoint)
python3 scripts/entrypoint.py '{"target": "127.0.0.1", "tools": ["nmap", "lynis"], "format": "html"}'
bash
python3 scripts/li_base_scan.py --history
bash
python3 scripts/li_base_scan.py 127.0.0.1 --mode standard --json
报告保存在: /root/.openclaw/skills/li-base-scan/reports/
scan_<hash>_<timestamp>.md - Markdown格式scan_<hash>_<timestamp>.json - JSON格式数据库位置: /root/.openclaw/skills/li-base-scan/history.db
python
# 使用tempfile.NamedTemporaryFile代替硬编码路径
with tempfile.NamedTemporaryFile(mode='w', suffix='.json',
delete=False, dir='/tmp') as f:
temp_file = f.name
os.chmod(temp_file, 0o600) # 限制权限
python
# 子进程超时后正确终止
proc.terminate()
try:
proc.wait(timeout=5)
except subprocess.TimeoutExpired:
proc.kill()
python
# 不暴露内部实现细节
return {"error": "扫描执行失败", "tool": "nmap"}
# 详细错误记录到日志
logger.error(f"Nmap scan failed")
日志位置: /var/log/li-base-scan.log
text
2024-01-01 10:00:00 - INFO - Starting scan: mode=quick, target_hash=a1b2c3d4
bash
# 安装所有依赖
apt-get update
apt-get install -y nmap lynis nikto sqlmap
# trivy安装
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh
bash
python3 scripts/li_base_scan.py -c "快速扫描 127.0.0.1"
bash
python3 scripts/li_base_scan.py 127.0.0.1 --mode full --export markdown
bash
python3 scripts/li_base_scan.py http://localhost:8080 --mode web
bash
python3 scripts/li_base_scan.py --history
⚠️ 仅扫描您拥有或获得明确授权的系统!
bash
# 增加超时时间
python3 scripts/li_base_scan.py 127.0.0.1 --timeout 600
bash
# JSON输出或禁用进度
python3 scripts/li_base_scan.py 127.0.0.1 --json
python3 scripts/li_base_scan.py 127.0.0.1 --no-progress
bash
tail -f /var/log/li-base-scan.log
This tool supports SINGLE HOST scanning only. The following inputs are REJECTED for security reasons:
Allowed target formats:
192.168.1.1scanme.nmap.org127.0.0.1, localhostLi Base Scan is a Linux security baseline scanner integrating multiple tools. Version 0.0.2 includes:
ToolFunctionScan TypenmapPort scanning, service detectionNetwork LayerlynisSystem security auditHost LayerniktoWeb vulnerability scanningApplication LayersqlmapSQL injection testingApplication LayertrivyContainer/filesystem vulnerabilitiesMulti-layer
text
quick scan 127.0.0.1
text
standard scan 127.0.0.1
text
full scan 127.0.0.1
text
web scan http://localhost
scan website http://example.com
text
compliance scan 127.0.0.1
baseline check localhost
text
stealth scan 192.168.1.1
slow scan target.com
bash
# Quick scan
python3 scripts/li_base_scan.py 127.0.0.1 --mode quick
# Standard scan
python3 scripts/li_base_scan.py 127.0.0.1 --mode standard
# Full scan
python3 scripts/li_base_scan.py 127.0.0.1 --mode full
bash
python3 scripts/li_base_scan.py -c "quick scan 127.0.0.1"
bash
# Export Markdown report
python3 scripts/li_base_scan.py 127.0.0.1 --mode full --export markdown
# Export JSON report
python3 scripts/li_base_scan.py 127.0.0.1 --mode full --export json
bash
python3 scripts/li_base_scan.py --history
bash
python3 scripts/li_base_scan.py 127.0.0.1 --mode standard --json
Reports saved to: /root/.openclaw/skills/li-base-scan/reports/
scan_<hash>_<timestamp>.md - Markdown formatscan_<hash>_<timestamp>.json - JSON formatDatabase location: /root/.openclaw/skills/li-base-scan/history.db
python
# Use tempfile.NamedTemporaryFile instead of hardcoded paths
with tempfile.NamedTemporaryFile(mode='w', suffix='.json',
delete=False, dir='/tmp') as f:
temp_file = f.name
os.chmod(temp_file, 0o600) # Restrict permissions
python
# Properly terminate subprocess after timeout
proc.terminate()
try:
proc.wait(timeout=5)
except subprocess.TimeoutExpired:
proc.kill()
python
# Don't expose internal implementation details
return {"error": "Scan execution failed", "tool": "nmap"}
# Log detailed errors
logger.error(f"Nmap scan failed")
Log location: /var/log/li-base-scan.log
text
2024-01-01 10:00:00 - INFO - Starting scan: mode=quick, target_hash=a1b2c3d4
bash
# Install all dependencies
apt-get update
apt-get install -y nmap lynis nikto sqlmap
# Install trivy
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh
bash
python3 scripts/li_base_scan.py -c "quick scan 127.0.0.1"
bash
python3 scripts/li_base_scan.py 127.0.0.1 --mode full --export markdown
bash
python3 scripts/li_base_scan.py http://localhost:8080 --mode web
bash
python3 scripts/li_base_scan.py --history
⚠️ Only scan systems you own or have explicit authorization to scan!
bash
# Increase timeout
python3 scripts/li_base_scan.py 127.0.0.1 --timeout 600
bash
# JSON output or disable progress
python3 scripts/li_base_scan.py 127.0.0.1 --json
python3 scripts/li_base_scan.py 127.0.0.1 --no-progress
bash
tail -f ~/.openclaw/logs/li-base-scan.log
Author: 北京老李 (Beijing Lao Li)
Email: (请添加您的邮箱)
GitHub: (请添加您的GitHub链接)
Made with ❤️ by 北京老李 (Beijing Lao Li)