fscan/Common/Core/Constants.go
ZacharyZcR 8594a8ba6c refactor: 创建Core子包整合Common包核心模块
- 新建Common/Core/子包,整合分散的核心功能
- Core/Constants.go: 整合端口常量和系统常量
- Core/Plugin.go: 整合插件系统,提供统一插件管理
- Core/Manager.go: 整合配置管理、参数解析和全局变量
- 更新原有文件保持向后兼容,引用Core包新结构
- 优化模块边界,减少文件数量,提升代码组织性
- 验证功能完整性,确保重构后项目正常运行

重构效果:
- 文件数量: 7个核心文件 → 3个Core文件 + 兼容层
- 模块化程度: 高度模块化的插件和配置管理
- 向后兼容: 100%兼容现有API调用
2025-08-05 21:06:21 +08:00

114 lines
5.8 KiB
Go
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.

package Core
/*
Constants.go - 核心常量定义
整合Ports.go等常量文件统一管理所有核心常量。
*/
// =============================================================================
// 端口常量 (从Ports.go迁移)
// =============================================================================
// 预定义端口组常量
var (
WebPorts = "80,81,82,83,84,85,86,87,88,89,90,91,92,98,99,443,800,801,808,880,888,889,1000,1010,1080,1081,1082,1099,1118,1888,2008,2020,2100,2375,2379,3000,3008,3128,3505,5555,6080,6648,6868,7000,7001,7002,7003,7004,7005,7007,7008,7070,7071,7074,7078,7080,7088,7200,7680,7687,7688,7777,7890,8000,8001,8002,8003,8004,8005,8006,8008,8009,8010,8011,8012,8016,8018,8020,8028,8030,8038,8042,8044,8046,8048,8053,8060,8069,8070,8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096,8097,8098,8099,8100,8101,8108,8118,8161,8172,8180,8181,8200,8222,8244,8258,8280,8288,8300,8360,8443,8448,8484,8800,8834,8838,8848,8858,8868,8879,8880,8881,8888,8899,8983,8989,9000,9001,9002,9008,9010,9043,9060,9080,9081,9082,9083,9084,9085,9086,9087,9088,9089,9090,9091,9092,9093,9094,9095,9096,9097,9098,9099,9100,9200,9443,9448,9800,9981,9986,9988,9998,9999,10000,10001,10002,10004,10008,10010,10051,10250,12018,12443,14000,15672,15671,16080,18000,18001,18002,18004,18008,18080,18082,18088,18090,18098,19001,20000,20720,20880,21000,21501,21502,28018"
MainPorts = "21,22,23,80,81,110,135,139,143,389,443,445,502,873,993,995,1433,1521,3306,5432,5672,6379,7001,7687,8000,8005,8009,8080,8089,8443,9000,9042,9092,9200,10051,11211,15672,27017,61616"
)
// =============================================================================
// 扫描模式常量
// =============================================================================
const (
ScanModeAll = "all" // 全扫描模式
ScanModePortScan = "portscan" // 端口扫描模式
ScanModeTcpScan = "tcpscan" // TCP扫描模式
ScanModeUdpScan = "udpscan" // UDP扫描模式
ScanModeWebScan = "webscan" // Web扫描模式
ScanModeNoPoc = "nopoc" // 无POC扫描模式
)
// =============================================================================
// 默认配置常量
// =============================================================================
const (
DefaultThreadNum = 600 // 默认线程数
DefaultModuleThreadNum = 6 // 默认模块线程数
DefaultTimeout = 3 // 默认超时时间(秒)
DefaultWebTimeout = 10 // 默认Web超时时间(秒)
DefaultGlobalTimeout = 7200 // 默认全局超时时间(秒)
DefaultLiveTop = 1000 // 默认存活探测端口数
DefaultPocNum = 20 // 默认POC线程数
DefaultScanMode = ScanModeAll // 默认扫描模式
DefaultLanguage = "zh" // 默认语言
DefaultLogLevel = "base" // 默认日志级别
DefaultOutputFormat = "txt" // 默认输出格式
DefaultUserAgent = "fscan/2.0.2" // 默认User-Agent
DefaultMaxTargets = 10000 // 默认最大目标数量
DefaultMaxPorts = 5000 // 默认最大端口数量
DefaultMaxCredentials = 1000 // 默认最大凭据数量
)
// =============================================================================
// 服务类型常量
// =============================================================================
const (
ServiceTypeSSH = "ssh" // SSH服务
ServiceTypeFTP = "ftp" // FTP服务
ServiceTypeSMB = "smb" // SMB服务
ServiceTypeMySQL = "mysql" // MySQL服务
ServiceTypeMSSQL = "mssql" // MSSQL服务
ServiceTypeOracle = "oracle" // Oracle服务
ServiceTypeRedis = "redis" // Redis服务
ServiceTypeMongo = "mongo" // MongoDB服务
ServiceTypeHTTP = "http" // HTTP服务
ServiceTypeHTTPS = "https" // HTTPS服务
ServiceTypeTelnet = "telnet" // Telnet服务
ServiceTypeLDAP = "ldap" // LDAP服务
ServiceTypeVNC = "vnc" // VNC服务
ServiceTypeRDP = "rdp" // RDP服务
)
// =============================================================================
// 输出格式常量
// =============================================================================
const (
OutputFormatTXT = "txt" // 文本格式
OutputFormatJSON = "json" // JSON格式
OutputFormatCSV = "csv" // CSV格式
OutputFormatXML = "xml" // XML格式
)
// =============================================================================
// 错误常量
// =============================================================================
const (
ErrInvalidIP = "invalid_ip" // 无效IP地址
ErrInvalidPort = "invalid_port" // 无效端口
ErrInvalidURL = "invalid_url" // 无效URL
ErrFileNotFound = "file_not_found" // 文件未找到
ErrConnectionTimeout = "connection_timeout" // 连接超时
ErrConnectionRefused = "connection_refused" // 连接被拒绝
ErrAuthenticationFail = "authentication_fail" // 认证失败
ErrPermissionDenied = "permission_denied" // 权限不足
ErrInvalidFormat = "invalid_format" // 格式无效
ErrResourceNotFound = "resource_not_found" // 资源未找到
)
// =============================================================================
// 版本信息常量
// =============================================================================
const (
Version = "2.0.2" // 版本号
BuildTime = "2024-01-01 00:00:00" // 构建时间
GitCommit = "unknown" // Git提交哈希
Description = "Fast comprehensive scanner" // 项目描述
Author = "shadow1ng" // 作者
Repository = "github.com/shadow1ng/fscan" // 仓库地址
)