mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-26 21:21:53 +08:00
feat: add -ntp flag to disable TCP supplementary probe
This commit is contained in:
@@ -27,6 +27,7 @@ type Config struct {
|
|||||||
ModuleThreadNum int // 模块线程数
|
ModuleThreadNum int // 模块线程数
|
||||||
DisableBrute bool // 禁用暴力破解
|
DisableBrute bool // 禁用暴力破解
|
||||||
DisablePing bool // 禁用Ping检测
|
DisablePing bool // 禁用Ping检测
|
||||||
|
DisableTcpProbe bool // 禁用TCP补充探测
|
||||||
|
|
||||||
// 扫描模式
|
// 扫描模式
|
||||||
Mode string // 扫描模式
|
Mode string // 扫描模式
|
||||||
@@ -147,6 +148,7 @@ func NewConfig() *Config {
|
|||||||
ModuleThreadNum: 10,
|
ModuleThreadNum: 10,
|
||||||
DisableBrute: false,
|
DisableBrute: false,
|
||||||
DisablePing: false,
|
DisablePing: false,
|
||||||
|
DisableTcpProbe: false,
|
||||||
|
|
||||||
// 扫描模式
|
// 扫描模式
|
||||||
Mode: DefaultScanMode,
|
Mode: DefaultScanMode,
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ func Flag(Info *HostInfo) error {
|
|||||||
flag.IntVar(&fv.ModuleThreadNum, "mt", 20, i18n.GetText("flag_module_thread_num"))
|
flag.IntVar(&fv.ModuleThreadNum, "mt", 20, i18n.GetText("flag_module_thread_num"))
|
||||||
flag.Int64Var(&fv.GlobalTimeout, "gt", 180, i18n.GetText("flag_global_timeout"))
|
flag.Int64Var(&fv.GlobalTimeout, "gt", 180, i18n.GetText("flag_global_timeout"))
|
||||||
flag.BoolVar(&fv.DisablePing, "np", false, i18n.GetText("flag_disable_ping"))
|
flag.BoolVar(&fv.DisablePing, "np", false, i18n.GetText("flag_disable_ping"))
|
||||||
|
flag.BoolVar(&fv.DisableTcpProbe, "ntp", false, i18n.GetText("flag_disable_tcp_probe"))
|
||||||
flag.StringVar(&fv.LocalPlugin, "local", "", "指定本地插件名称 (如: cleaner, avdetect, keylogger 等)")
|
flag.StringVar(&fv.LocalPlugin, "local", "", "指定本地插件名称 (如: cleaner, avdetect, keylogger 等)")
|
||||||
flag.BoolVar(&fv.AliveOnly, "ao", false, i18n.GetText("flag_alive_only"))
|
flag.BoolVar(&fv.AliveOnly, "ao", false, i18n.GetText("flag_alive_only"))
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ type FlagVars struct {
|
|||||||
TimeoutSec int64 // 秒,需转换为 time.Duration
|
TimeoutSec int64 // 秒,需转换为 time.Duration
|
||||||
GlobalTimeout int64
|
GlobalTimeout int64
|
||||||
DisablePing bool
|
DisablePing bool
|
||||||
|
DisableTcpProbe bool
|
||||||
LocalPlugin string
|
LocalPlugin string
|
||||||
AliveOnly bool
|
AliveOnly bool
|
||||||
DisableBrute bool
|
DisableBrute bool
|
||||||
@@ -137,6 +138,7 @@ func BuildConfigFromFlags(fv *FlagVars) *Config {
|
|||||||
ModuleThreadNum: fv.ModuleThreadNum,
|
ModuleThreadNum: fv.ModuleThreadNum,
|
||||||
DisableBrute: fv.DisableBrute,
|
DisableBrute: fv.DisableBrute,
|
||||||
DisablePing: fv.DisablePing,
|
DisablePing: fv.DisablePing,
|
||||||
|
DisableTcpProbe: fv.DisableTcpProbe,
|
||||||
|
|
||||||
// 扫描模式
|
// 扫描模式
|
||||||
Mode: fv.ScanMode,
|
Mode: fv.ScanMode,
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ flag_global_timeout:
|
|||||||
other: "Global timeout"
|
other: "Global timeout"
|
||||||
flag_disable_ping:
|
flag_disable_ping:
|
||||||
other: "Disable ping detection"
|
other: "Disable ping detection"
|
||||||
|
flag_disable_tcp_probe:
|
||||||
|
other: "Disable TCP supplementary probe"
|
||||||
flag_alive_only:
|
flag_alive_only:
|
||||||
other: "Alive detection only"
|
other: "Alive detection only"
|
||||||
flag_username:
|
flag_username:
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ flag_global_timeout:
|
|||||||
other: "全局超时时间"
|
other: "全局超时时间"
|
||||||
flag_disable_ping:
|
flag_disable_ping:
|
||||||
other: "禁用ping探测"
|
other: "禁用ping探测"
|
||||||
|
flag_disable_tcp_probe:
|
||||||
|
other: "禁用TCP补充探测"
|
||||||
flag_alive_only:
|
flag_alive_only:
|
||||||
other: "仅进行存活探测"
|
other: "仅进行存活探测"
|
||||||
flag_username:
|
flag_username:
|
||||||
|
|||||||
@@ -82,6 +82,10 @@ func CheckLive(ctx context.Context, hostslist []string, Ping bool, session *comm
|
|||||||
// tcpSupplementaryProbe TCP 补充探测
|
// tcpSupplementaryProbe TCP 补充探测
|
||||||
// 当 ICMP 响应率过低时(<10%),对未响应主机进行 TCP 探测
|
// 当 ICMP 响应率过低时(<10%),对未响应主机进行 TCP 探测
|
||||||
func tcpSupplementaryProbe(ctx context.Context, allHosts []string, aliveHosts []string, session *common.ScanSession) []string {
|
func tcpSupplementaryProbe(ctx context.Context, allHosts []string, aliveHosts []string, session *common.ScanSession) []string {
|
||||||
|
if session.Config.DisableTcpProbe {
|
||||||
|
return aliveHosts
|
||||||
|
}
|
||||||
|
|
||||||
totalHosts := len(allHosts)
|
totalHosts := len(allHosts)
|
||||||
if totalHosts == 0 {
|
if totalHosts == 0 {
|
||||||
return aliveHosts
|
return aliveHosts
|
||||||
|
|||||||
Reference in New Issue
Block a user