fix abs path parse

This commit is contained in:
M09ic 2024-04-26 18:57:02 +08:00
parent 13530eee5d
commit b2d85a7698
3 changed files with 5 additions and 6 deletions

View File

@ -32,7 +32,7 @@ func Spray() {
var option internal.Option
if files.IsExist(DefaultConfig) {
logs.Log.Warnf("config.yaml exist, loading")
logs.Log.Debug("config.yaml exist, loading")
err := internal.LoadConfig(DefaultConfig, &option)
if err != nil {
logs.Log.Error(err.Error())

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/chainreactors/spray
go 1.21.3
go 1.21
require github.com/chainreactors/go-metrics v0.0.0-20220926021830-24787b7a10f8

View File

@ -19,6 +19,7 @@ import (
"io/ioutil"
"net/url"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
@ -417,7 +418,6 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
}
ports := utils.ParsePort(opt.PortRange)
// prepare task
tasks := make(chan *Task, opt.PoolSize)
var taskfrom string
@ -486,14 +486,13 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
} else if opt.URLFile != "" {
file, err = os.Open(opt.URLFile)
if err != nil {
logs.Log.Error(err.Error())
return nil, err
}
taskfrom = opt.URLFile
taskfrom = filepath.Base(opt.URLFile)
} else if files.HasStdin() {
file = os.Stdin
taskfrom = "stdin"
}
if file != nil {
content, err := ioutil.ReadAll(file)
if err != nil {