From be48460f1e0b9665537e96cc5972765dc5ee2217 Mon Sep 17 00:00:00 2001 From: ro0tk1t <1576235794@qq.com> Date: Mon, 25 Jan 2021 16:03:01 +0800 Subject: [PATCH 1/2] fix: panic happend when only use -f option --- core/start.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/start.go b/core/start.go index b7000d1..ac45032 100644 --- a/core/start.go +++ b/core/start.go @@ -182,6 +182,9 @@ func Start(options *Options) { sendog.Send(rstruct.Domain, rstruct.Dns, rstruct.SrcPort, rstruct.FlagId) } }() + if f == nil { + return + } // 循环遍历发送 for { line, _, err := r.ReadLine() From 88eec46b891ddf001cb95c94cf41cb5c5c966c3d Mon Sep 17 00:00:00 2001 From: ro0tk1t <1576235794@qq.com> Date: Wed, 27 Jan 2021 13:01:23 +0800 Subject: [PATCH 2/2] add -f notification --- core/options.go | 8 ++++++-- core/start.go | 3 --- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/options.go b/core/options.go index 08424b9..97510f2 100644 --- a/core/options.go +++ b/core/options.go @@ -117,8 +117,12 @@ func ParseOptions() *Options { if len(options.Domain) > 0 && options.Verify { gologger.Fatalf("-d 与 -verify参数不可以同时出现!") } - if options.FileName != "" && !FileExists(options.FileName) { - gologger.Fatalf("文件:%s 不存在!\n", options.FileName) + if options.FileName != "" { + if !FileExists(options.FileName) { + gologger.Fatalf("文件:%s 不存在!\n", options.FileName) + } else if !options.Verify || len(options.Domain) == 0 { + gologger.Fatalf("-f需配合-d或-verify使用!\n", ) + } } if !options.Stdin && options.Verify && options.FileName == "" { gologger.Fatalf("启用了 -verify 参数但传入域名为空!") diff --git a/core/start.go b/core/start.go index ac45032..b7000d1 100644 --- a/core/start.go +++ b/core/start.go @@ -182,9 +182,6 @@ func Start(options *Options) { sendog.Send(rstruct.Domain, rstruct.Dns, rstruct.SrcPort, rstruct.FlagId) } }() - if f == nil { - return - } // 循环遍历发送 for { line, _, err := r.ReadLine()