Documentation
¶
Overview ¶
Config/types.go
Index ¶
- Constants
- Variables
- func Banner()
- func CheckErrs(err error) error
- func CloseOutput() error
- func Flag(Info *HostInfo)
- func FlagFromRemote(info *HostInfo, argString string) error
- func GetText(key string, args ...interface{}) string
- func InitLogger()
- func InitOutput() error
- func LogBase(msg string)
- func LogDebug(msg string)
- func LogError(errMsg string)
- func LogInfo(msg string)
- func LogSuccess(result string)
- func Parse(Info *HostInfo) error
- func ParseIP(host string, filename string, nohosts ...string) (hosts []string, err error)
- func ParseInput(Info *HostInfo) error
- func ParsePass(Info *HostInfo) error
- func ParsePort(ports string) []int
- func ParsePortsFromString(portsStr string) []int
- func ParseUser() error
- func ReadFileLines(filename string) ([]string, error)
- func RegisterPlugin(name string, plugin ScanPlugin)
- func RemoveDuplicate(old []string) []string
- func SaveResult(result *ScanResult) error
- func SetLanguage()
- func Socks5Dialer(forward *net.Dialer) (proxy.Dialer, error)
- func WrapperTCP(network, address string, forward *net.Dialer) (net.Conn, error)
- func WrapperTcpWithTimeout(network, address string, timeout time.Duration) (net.Conn, error)
- type HostInfo
- type LogEntry
- type OutputManager
- type PocInfo
- type ResultType
- type ScanPlugin
- type ScanResult
- type ScanStatus
Constants ¶
View Source
const ( LogLevelAll = "ALL" // 显示所有级别日志 LogLevelError = "ERROR" // 仅显示错误日志 LogLevelBase = "BASE" // 仅显示信息日志 LogLevelInfo = "INFO" // 仅显示信息日志 LogLevelSuccess = "SUCCESS" // 仅显示成功日志 LogLevelDebug = "DEBUG" // 仅显示调试日志 )
定义系统支持的日志级别常量
View Source
const ( PluginTypeService = "service" // 服务类型插件 PluginTypeWeb = "web" // Web类型插件 PluginTypeLocal = "local" // 本地类型插件 )
在 Common/const.go 中添加 插件类型常量
View Source
const ( LangZH = "zh" // 中文 LangEN = "en" // 英文 LangJA = "ja" // 日文 LangRU = "ru" // 俄文 )
支持的语言类型
Variables ¶
View Source
var ( Outputfile string // 输出文件路径 OutputFormat string // 输出格式 )
View Source
var ( // ========================================================= // 扫描目标配置 // ========================================================= Ports string // 要扫描的端口列表,如"80,443,8080" ExcludePorts string // 要排除的端口列表 ExcludeHosts string // 要排除的主机列表 AddPorts string // 额外添加的端口列表 HostPort []string // 主机:端口格式的目标列表 // ========================================================= // 认证与凭据配置 // ========================================================= Username string // 用于认证的用户名 Password string // 用于认证的密码 AddUsers string // 额外添加的用户名列表 AddPasswords string // 额外添加的密码列表 // 特定服务认证 Domain string // Active Directory/SMB域名 HashValue string // 用于哈希认证的单个哈希值 HashValues []string // 哈希值列表 HashBytes [][]byte // 二进制格式的哈希值列表 HashFile string // 包含哈希值的文件路径 SshKeyPath string // SSH私钥文件路径 // ========================================================= // 扫描控制配置 // ========================================================= ScanMode string // 扫描模式或指定的插件列表 ThreadNum int // 并发扫描线程数 ModuleThreadNum int // 模块内部线程数 Timeout int64 // 单个扫描操作超时时间(秒) GlobalTimeout int64 // 整体扫描超时时间(秒) LiveTop int // 显示的存活主机排名数量 DisablePing bool // 是否禁用主机存活性检测 UsePing bool // 是否使用ICMP Ping检测主机存活 EnableFingerprint bool // 是否跳过服务指纹识别 LocalMode bool // 是否启用本地信息收集模式 // ========================================================= // 输入文件配置 // ========================================================= HostsFile string // 包含目标主机的文件路径 UsersFile string // 包含用户名列表的文件路径 PasswordsFile string // 包含密码列表的文件路径 PortsFile string // 包含端口列表的文件路径 // ========================================================= // Web扫描配置 // ========================================================= TargetURL string // 单个目标URL URLsFile string // 包含URL列表的文件路径 URLs []string // 解析后的URL目标列表 WebTimeout int64 // Web请求超时时间(秒),默认5秒 HttpProxy string // HTTP代理地址 Socks5Proxy string // SOCKS5代理地址 // ========================================================= // POC与漏洞利用配置 // ========================================================= // POC配置 PocPath string // POC脚本路径 Pocinfo PocInfo // POC详细信息结构 DisablePocScan bool //nopoc // Redis利用 RedisFile string // Redis利用目标文件 RedisShell string // Redis反弹Shell命令 DisableRedis bool // 是否禁用Redis利用测试 RedisWritePath string // Redis文件写入路径 RedisWriteContent string // Redis文件写入内容 RedisWriteFile string // Redis写入的源文件 // 其他漏洞利用 Shellcode string // 用于MS17010等漏洞利用的Shellcode // ========================================================= // 暴力破解控制 // ========================================================= DisableBrute bool // 是否禁用暴力破解模块 MaxRetries int // 连接失败最大重试次数 // ========================================================= // 输出与显示配置 // ========================================================= DisableSave bool // 是否禁止保存扫描结果 Silent bool // 是否启用静默模式 NoColor bool // 是否禁用彩色输出 LogLevel string // 日志输出级别 ShowProgress bool // 是否显示进度条 ShowScanPlan bool // 是否显示扫描计划详情 SlowLogOutput bool // 是否启用慢速日志输出 Language string // 界面语言设置 ApiAddr string // API地址 SecretKey string // 加密密钥 )
View Source
var ( UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36" Accept = "" /* 135-byte string literal not displayed */ DnsLog bool PocNum int PocFull bool Cookie string )
View Source
var ( // Num 表示待处理的总任务数量 Num int64 // End 表示已经完成的任务数量 End int64 )
全局变量定义
View Source
var AllPorts = "1-65535"
View Source
var DbPorts = "1433,1521,3306,5432,5672,6379,7687,9042,9093,9200,11211,27017,61616"
View Source
var DefaultMap = []string{
"GenericLines",
"GetRequest",
"TLSSessionReq",
"SSLSessionReq",
"ms-sql-s",
"JavaRMI",
"LDAPSearchReq",
"LDAPBindReq",
"oracle-tns",
"Socks5",
}
View Source
var (
ErrParseIP = errors.New(GetText("parse_ip_error")) // IP解析失败的统一错误
)
IP解析相关错误
View Source
var MainPorts = "" /* 178-byte string literal not displayed */
View Source
var OutputMutex sync.Mutex
添加一个全局互斥锁来控制输出
View Source
var Passwords = []string{"123456", "admin", "admin123", "root", "", "pass123", "pass@123", "password", "Password", "P@ssword123", "123123", "654321", "111111", "123", "1", "admin@123", "Admin@123", "admin123!@#", "{user}", "{user}1", "{user}111", "{user}123", "{user}@123", "{user}_123", "{user}#123", "{user}@111", "{user}@2019", "{user}@123#4", "P@ssw0rd!", "P@ssw0rd", "Passw0rd", "qwe123", "12345678", "test", "test123", "123qwe", "123qwe!@#", "123456789", "123321", "666666", "a123456.", "123456~a", "123456!a", "000000", "1234567890", "8888888", "!QAZ2wsx", "1qaz2wsx", "abc123", "abc123456", "1qaz@WSX", "a11111", "a12345", "Aa1234", "Aa1234.", "Aa12345", "a123456", "a123123", "Aa123123", "Aa123456", "Aa12345.", "sysadmin", "system", "1qaz!QAZ", "2wsx@WSX", "qwe123!@#", "Aa123456!", "A123456s!", "sa123456", "1q2w3e", "Charge123", "Aa123456789", "elastic123"}
View Source
var PluginManager = make(map[string]ScanPlugin)
PluginManager 管理插件注册
View Source
var PortMap = map[int][]string{}/* 798 elements not displayed */
View Source
var ProgressBar *progressbar.ProgressBar
添加一个全局的进度条变量
View Source
var ServicePorts = "" /* 189-byte string literal not displayed */
View Source
var StartTime = time.Now()
View Source
var Userdict = map[string][]string{
"ftp": {"ftp", "admin", "www", "web", "root", "db", "wwwroot", "data"},
"mysql": {"root", "mysql"},
"mssql": {"sa", "sql"},
"smb": {"administrator", "admin", "guest"},
"rdp": {"administrator", "admin", "guest"},
"postgresql": {"postgres", "admin"},
"ssh": {"root", "admin"},
"mongodb": {"root", "admin"},
"oracle": {"sys", "system", "admin", "test", "web", "orcl"},
"telnet": {"root", "admin", "test"},
"elastic": {"elastic", "admin", "kibana"},
"rabbitmq": {"guest", "admin", "administrator", "rabbit", "rabbitmq", "root"},
"kafka": {"admin", "kafka", "root", "test"},
"activemq": {"admin", "root", "activemq", "system", "user"},
"ldap": {"admin", "administrator", "root", "cn=admin", "cn=administrator", "cn=manager"},
"smtp": {"admin", "root", "postmaster", "mail", "smtp", "administrator"},
"imap": {"admin", "mail", "postmaster", "root", "user", "test"},
"pop3": {"admin", "root", "mail", "user", "test", "postmaster"},
"zabbix": {"Admin", "admin", "guest", "user"},
"rsync": {"rsync", "root", "admin", "backup"},
"cassandra": {"cassandra", "admin", "root", "system"},
"neo4j": {"neo4j", "admin", "root", "test"},
}
View Source
var WebPorts = "" /* 1044-byte string literal not displayed */
Functions ¶
func FlagFromRemote ¶
FlagFormRemote 解析远程扫描的命令行参数
func ParseIP ¶
ParseIP 解析各种格式的IP地址 参数:
- host: 主机地址(可以是单个IP、IP范围、CIDR或常用网段简写)
- filename: 包含主机地址的文件名
- nohosts: 需要排除的主机地址列表
返回:
- []string: 解析后的IP地址列表
- error: 解析过程中的错误
func ParseInput ¶
ParseInput 解析和验证输入参数配置 处理多种配置的冲突检查、格式验证和参数处理
func ParsePortsFromString ¶
func ReadFileLines ¶
ReadFileLines 读取文件内容并返回非空行的切片 通用的文件读取函数,处理文件打开、读取和错误报告
func SetLanguage ¶
func SetLanguage()
func Socks5Dialer ¶
Socks5Dialer 创建Socks5代理拨号器
func WrapperTCP ¶
WrapperTCP 根据配置创建TCP连接
Types ¶
type LogEntry ¶
type LogEntry struct { Level string // 日志级别: ERROR/INFO/SUCCESS/DEBUG Time time.Time // 日志时间 Content string // 日志内容 }
LogEntry 定义单条日志的结构
type OutputManager ¶
type OutputManager struct {
// contains filtered or unexported fields
}
OutputManager 输出管理器结构体
var ResultOutput *OutputManager
全局输出管理器
type ResultType ¶
type ResultType string
ResultType 定义结果类型
const ( HOST ResultType = "HOST" // 主机存活 PORT ResultType = "PORT" // 端口开放 SERVICE ResultType = "SERVICE" // 服务识别 VULN ResultType = "VULN" // 漏洞发现 )
type ScanPlugin ¶
type ScanPlugin struct { Name string // 插件名称 Ports []int // 适用端口 Types []string // 插件类型标签,一个插件可以有多个类型 ScanFunc func(*HostInfo) error // 扫描函数 }
ScanPlugin 定义扫描插件的结构
type ScanResult ¶
type ScanResult struct { Time time.Time `json:"time"` // 发现时间 Type ResultType `json:"type"` // 结果类型 Target string `json:"target"` // 目标(IP/域名/URL) Status string `json:"status"` // 状态描述 Details map[string]interface{} `json:"details"` // 详细信息 }
ScanResult 扫描结果结构
func GetResults ¶
func GetResults() ([]*ScanResult, error)
type ScanStatus ¶
type ScanStatus struct {
// contains filtered or unexported fields
}
ScanStatus 用于记录和管理扫描状态的结构体
Click to show internal directories.
Click to hide internal directories.