mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 11:40:13 +00:00
fix filename error
This commit is contained in:
parent
2b7be8d449
commit
44e88e0aa7
@ -456,7 +456,7 @@ func (opt *Option) NewRunner() (*Runner, error) {
|
||||
if opt.ResumeFrom != "" {
|
||||
r.StatFile, err = files.NewFile(opt.ResumeFrom, false, true, true)
|
||||
} else {
|
||||
r.StatFile, err = files.NewFile(strings.ReplaceAll(r.Tasks.Name, ":", "_")+".stat", false, true, true)
|
||||
r.StatFile, err = files.NewFile(safeFilename(r.Tasks.Name)+".stat", false, true, true)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -506,7 +506,7 @@ func (opt *Option) BuildWords(r *Runner) error {
|
||||
var err error
|
||||
if opt.DefaultDict {
|
||||
dicts = append(dicts, pkg.LoadDefaultDict())
|
||||
logs.Log.Info("not set any dictionary, use default dictionary: https://github.com/maurosoria/dirsearch/blob/master/db/dicc.txt")
|
||||
logs.Log.Info("use default dictionary: https://github.com/maurosoria/dirsearch/blob/master/db/dicc.txt")
|
||||
}
|
||||
for i, f := range opt.Dictionaries {
|
||||
dict, err := loadFileToSlice(f)
|
||||
|
@ -18,7 +18,7 @@ type Task struct {
|
||||
func NewTaskGenerator(port string) *TaskGenerator {
|
||||
gen := &TaskGenerator{
|
||||
ports: utils.ParsePortsString(port),
|
||||
tasks: make(chan *Task, 256),
|
||||
tasks: make(chan *Task),
|
||||
In: make(chan *Task),
|
||||
}
|
||||
|
||||
@ -56,6 +56,7 @@ func (gen *TaskGenerator) Run(baseurl string) {
|
||||
|
||||
if len(gen.ports) == 0 {
|
||||
gen.In <- &Task{baseUrl: parsed.String()}
|
||||
return
|
||||
}
|
||||
|
||||
for _, p := range gen.ports {
|
||||
|
@ -164,3 +164,11 @@ func wrapWordsFunc(f func(string) string) func(string) []string {
|
||||
return []string{f(s)}
|
||||
}
|
||||
}
|
||||
|
||||
func safeFilename(filename string) string {
|
||||
filename = strings.ReplaceAll(filename, "http://", "")
|
||||
filename = strings.ReplaceAll(filename, "https://", "")
|
||||
filename = strings.ReplaceAll(filename, ":", "_")
|
||||
filename = strings.ReplaceAll(filename, "/", "_")
|
||||
return filename
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user