mirror of
https://github.com/yyhuni/xingrin.git
synced 2026-01-31 11:46:16 +08:00
refactor(worker): isolate scan tools to dedicated directory
- Move scan tools base path from `/usr/local/bin` to `/opt/xingrin-tools/bin` to avoid conflicts with system tools and Python packages - Create dedicated `/opt/xingrin-tools/bin` directory in worker Dockerfile following FHS standards - Update PATH environment variable to prioritize project-specific tools directory - Add `SCAN_TOOLS_PATH` environment variable to `.env.example` with documentation - Update settings.py to use new default path with explanatory comments - Fix TypeScript type annotation in system-logs-view.tsx for better maintainability - Remove frontend package-lock.json to reduce repository size - Update task distributor comment to reflect new tool location This change improves tool isolation and prevents naming conflicts while maintaining FHS compliance.
This commit is contained in:
@@ -274,7 +274,7 @@ class TaskDistributor:
|
||||
network_arg = ""
|
||||
server_url = f"https://{settings.PUBLIC_HOST}:{settings.PUBLIC_PORT}"
|
||||
|
||||
# 挂载路径(统一挂载 /opt/xingrin,工具已移到 /usr/local/bin 不受影响)
|
||||
# 挂载路径(统一挂载 /opt/xingrin,扫描工具在 /opt/xingrin-tools/bin 不受影响)
|
||||
host_xingrin_dir = "/opt/xingrin"
|
||||
|
||||
# 环境变量:SERVER_URL + IS_LOCAL,其他配置容器启动时从配置中心获取
|
||||
|
||||
@@ -278,8 +278,9 @@ ENABLE_COMMAND_LOGGING = get_bool_env('ENABLE_COMMAND_LOGGING', True)
|
||||
# ==================== 数据目录配置(统一使用 /opt/xingrin) ====================
|
||||
# 所有数据目录统一挂载到 /opt/xingrin,便于管理和备份
|
||||
|
||||
# 扫描工具基础路径(worker 容器内)
|
||||
SCAN_TOOLS_BASE_PATH = os.getenv('SCAN_TOOLS_PATH', '/usr/local/bin')
|
||||
# 扫描工具基础路径(worker 容器内,符合 FHS 标准)
|
||||
# 使用 /opt/xingrin-tools/bin 隔离项目专用扫描工具,避免与系统工具或 Python 包冲突
|
||||
SCAN_TOOLS_BASE_PATH = os.getenv('SCAN_TOOLS_PATH', '/opt/xingrin-tools/bin')
|
||||
|
||||
# 字典文件基础路径
|
||||
WORDLISTS_BASE_PATH = os.getenv('WORDLISTS_PATH', '/opt/xingrin/wordlists')
|
||||
|
||||
@@ -41,6 +41,9 @@ SCAN_RESULTS_DIR=/opt/xingrin/results
|
||||
# Django 日志目录
|
||||
# 注意:如果留空或删除此变量,日志将只输出到 Docker 控制台(标准输出),不写入文件
|
||||
LOG_DIR=/opt/xingrin/logs
|
||||
# 扫描工具路径(容器内路径,符合 FHS 标准,已隔离避免命名冲突)
|
||||
# 默认值已在 settings.py 中设置,无需修改,除非需要回退到旧路径
|
||||
SCAN_TOOLS_PATH=/opt/xingrin-tools/bin
|
||||
|
||||
# ==================== 日志级别配置 ====================
|
||||
# 应用日志级别:DEBUG / INFO / WARNING / ERROR
|
||||
|
||||
@@ -71,19 +71,26 @@ RUN pipx install uro && \
|
||||
pipx install waymore && \
|
||||
pipx install dnsgen
|
||||
|
||||
# 3. 安装 Sublist3r(放在 /usr/local/share 下,避免被挂载覆盖)
|
||||
# 3. 安装 Sublist3r(Python 脚本工具,放在 /usr/local/share 标准目录)
|
||||
RUN git clone https://github.com/aboul3la/Sublist3r.git /usr/local/share/Sublist3r && \
|
||||
pip3 install --no-cache-dir -r /usr/local/share/Sublist3r/requirements.txt --break-system-packages
|
||||
|
||||
# 4. 从 go-builder 阶段复制 Go 环境和编译好的工具
|
||||
# 扫描工具放在 /usr/local/bin,避免被 /opt/xingrin 挂载覆盖
|
||||
# 创建项目专用工具目录(符合 FHS 标准,/opt 用于独立软件包)
|
||||
# 避免与系统工具或 Python 包冲突,避免被 /opt/xingrin 挂载覆盖
|
||||
RUN mkdir -p /opt/xingrin-tools/bin
|
||||
|
||||
ENV GOPATH=/root/go
|
||||
ENV PATH=/usr/local/go/bin:/usr/local/bin:$PATH:$GOPATH/bin
|
||||
ENV GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
COPY --from=go-builder /usr/local/go /usr/local/go
|
||||
COPY --from=go-builder /go/bin/* /usr/local/bin/
|
||||
COPY --from=go-builder /usr/local/bin/massdns /usr/local/bin/massdns
|
||||
|
||||
# 从 go-builder 复制扫描工具到专用目录(避免与系统工具或 Python 包冲突)
|
||||
COPY --from=go-builder /go/bin/* /opt/xingrin-tools/bin/
|
||||
COPY --from=go-builder /usr/local/bin/massdns /opt/xingrin-tools/bin/massdns
|
||||
|
||||
# 将专用工具目录添加到 PATH(优先级高于 /usr/local/bin,避免冲突)
|
||||
ENV PATH=/opt/xingrin-tools/bin:/usr/local/go/bin:/usr/local/bin:$PATH:$GOPATH/bin
|
||||
|
||||
# 5. 安装 uv( Python 包管理器)并安装 Python 依赖
|
||||
COPY backend/requirements.txt .
|
||||
|
||||
@@ -41,7 +41,7 @@ export function SystemLogsView() {
|
||||
|
||||
const content = useMemo(() => logsData?.content ?? "", [logsData?.content])
|
||||
|
||||
const editorRef = useRef<Parameters<Parameters<typeof Editor>[0]['onMount']>[0] | null>(null)
|
||||
const editorRef = useRef<any>(null)
|
||||
|
||||
// 自动滚动到底部
|
||||
useEffect(() => {
|
||||
|
||||
9238
frontend/package-lock.json
generated
9238
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user