fscan/fscan-lite/Makefile
ZacharyZcR a3177b28a6 fix: 修复插件系统逻辑Bug和架构问题
主要修复:
1. 修复时间显示Bug - StartTime初始化问题
2. 修复Web智能探测错误检测预定义端口而非用户指定端口
3. 修复本地插件被错误调用到端口扫描中的问题
4. 修复host:port格式双重处理导致的多余端口扫描
5. 统一插件过滤逻辑,消除接口不一致性
6. 优化Web检测缓存机制,减少重复HTTP请求

技术改进:
- 重构插件适用性检查逻辑,确保策略过滤器正确工作
- 区分Web检测的自动发现模式和用户指定端口模式
- 在解析阶段正确处理host:port格式,避免与默认端口冲突
- 完善缓存机制,提升性能

测试验证:
- ./fscan -h 127.0.0.1:3306 现在只检测3306端口
- 本地插件不再参与端口扫描
- Web检测只对指定端口进行协议检测
- 时间显示正确
2025-09-01 23:50:32 +00:00

145 lines
3.2 KiB
Makefile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Makefile for fscan-lite
# 极简但完整的跨平台构建脚本
# 目标最大兼容性支持古老的make版本
# 编译器和标志
CC = gcc
CFLAGS = -std=c89 -Wall -O2
LDFLAGS =
LIBS =
# 平台检测
UNAME_S := $(shell uname -s 2>/dev/null || echo Windows)
# Windows平台配置
ifeq ($(OS),Windows_NT)
PLATFORM = windows
EXT = .exe
LIBS = -lws2_32
RM = del /Q
MKDIR = mkdir
PATHSEP = \\
else
# Unix-like系统配置
PLATFORM = unix
EXT =
LIBS = -lpthread
RM = rm -f
MKDIR = mkdir -p
PATHSEP = /
# Linux特定配置
ifeq ($(UNAME_S),Linux)
PLATFORM = linux
endif
# macOS特定配置
ifeq ($(UNAME_S),Darwin)
PLATFORM = macos
endif
endif
# 目录和文件
SRCDIR = src
INCDIR = include
BINDIR = bin
TARGET = $(BINDIR)$(PATHSEP)fscan-lite$(EXT)
# 源文件
SOURCES = $(SRCDIR)/main.c $(SRCDIR)/scanner.c $(SRCDIR)/platform.c
OBJECTS = main.o scanner.o platform.o
# 默认目标
all: $(TARGET)
# 创建输出目录
$(BINDIR):
$(MKDIR) $(BINDIR)
# 主要构建目标
$(TARGET): $(BINDIR) $(OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)
@echo "Build completed: $@"
# 目标文件编译规则
main.o: $(SRCDIR)/main.c
$(CC) $(CFLAGS) -I$(INCDIR) -c $< -o $@
scanner.o: $(SRCDIR)/scanner.c
$(CC) $(CFLAGS) -I$(INCDIR) -c $< -o $@
platform.o: $(SRCDIR)/platform.c
$(CC) $(CFLAGS) -I$(INCDIR) -c $< -o $@
# 静态编译目标
static: LDFLAGS += -static
static: CFLAGS += -DSTATIC_BUILD
static: $(TARGET)
@echo "Static build completed"
# 最小化编译(体积优化)
small: CFLAGS = -std=c89 -Os -ffunction-sections -fdata-sections -DSTATIC_BUILD
small: LDFLAGS = -static -s -Wl,--gc-sections
small: $(TARGET)
@echo "Minimal build completed"
# 调试版本
debug: CFLAGS += -g -DDEBUG
debug: $(TARGET)
@echo "Debug build completed"
# 测试目标
test: $(TARGET)
@echo "Running basic tests..."
$(TARGET) --version
$(TARGET) --help
@echo "Basic tests completed"
# 清理
clean:
$(RM) *.o
$(RM) $(TARGET)
# 完全清理(包括目录)
distclean: clean
ifeq ($(OS),Windows_NT)
if exist $(BINDIR) rmdir /S /Q $(BINDIR)
else
rm -rf $(BINDIR)
endif
# 安装(简单复制到系统路径)
install: $(TARGET)
ifeq ($(OS),Windows_NT)
@echo "Manual installation required on Windows"
@echo "Copy $(TARGET) to desired location"
else
install -m 755 $(TARGET) /usr/local/bin/
@echo "Installed to /usr/local/bin/"
endif
# 显示构建信息
info:
@echo "Build information:"
@echo " Platform: $(PLATFORM)"
@echo " Compiler: $(CC)"
@echo " CFLAGS: $(CFLAGS)"
@echo " LIBS: $(LIBS)"
@echo " Target: $(TARGET)"
# 帮助信息
help:
@echo "Available targets:"
@echo " all - Build normal version (default)"
@echo " static - Build static linked version"
@echo " small - Build minimal size version"
@echo " debug - Build debug version"
@echo " test - Run basic tests"
@echo " clean - Remove object files and binary"
@echo " distclean- Remove all generated files"
@echo " install - Install to system (Unix only)"
@echo " info - Show build configuration"
@echo " help - Show this help"
# 声明伪目标
.PHONY: all static small debug test clean distclean install info help