Use random names by default to avoid collision

dev
Ice3man 2022-02-24 14:34:37 +05:30
parent 42b3a5d3e2
commit 9e1e86d89f
1 changed files with 3 additions and 8 deletions

View File

@ -11,19 +11,14 @@ import (
)
// Default resume file
const DefaultResumeFileName = "resume.cfg"
const DefaultResumeFileName = "resume-%s.cfg"
func DefaultResumeFilePath() string {
home, err := os.UserHomeDir()
if err != nil {
return DefaultResumeFileName
}
resumeFile := filepath.Join(home, ".config", "nuclei", DefaultResumeFileName)
// Generate random name if already exists
if _, err := os.Stat(resumeFile); !os.IsNotExist(err) {
resumeFile = filepath.Join(home, ".config", "nuclei", fmt.Sprintf("resume-%s.cfg", xid.New().String()))
return fmt.Sprintf("resume-%s.cfg", xid.New().String())
}
resumeFile := filepath.Join(home, ".config", "nuclei", fmt.Sprintf("resume-%s.cfg", xid.New().String()))
return resumeFile
}