Fixed update template issue

dev
Ice3man543 2020-07-08 17:25:29 +05:30
parent 0c962a943f
commit d6fb6bda51
1 changed files with 2 additions and 2 deletions

View File

@ -62,6 +62,7 @@ func (r *Runner) writeConfiguration(config *nucleiConfig) error {
return err return err
} }
config.LastChecked = time.Now()
templatesConfigFile := path.Join(home, nucleiConfigFilename) templatesConfigFile := path.Join(home, nucleiConfigFilename)
file, err := os.OpenFile(templatesConfigFile, os.O_WRONLY|os.O_CREATE, 0777) file, err := os.OpenFile(templatesConfigFile, os.O_WRONLY|os.O_CREATE, 0777)
if err != nil { if err != nil {
@ -106,7 +107,7 @@ func (r *Runner) updateTemplates() error {
if r.options.TemplatesDirectory != "" { if r.options.TemplatesDirectory != "" {
home = r.options.TemplatesDirectory home = r.options.TemplatesDirectory
} }
r.templatesConfig = &nucleiConfig{TemplatesDirectory: path.Join(home, "nuclei-templates"), LastChecked: time.Now()} r.templatesConfig = &nucleiConfig{TemplatesDirectory: path.Join(home, "nuclei-templates")}
os.RemoveAll(r.templatesConfig.TemplatesDirectory) os.RemoveAll(r.templatesConfig.TemplatesDirectory)
// Download the repository and also write the revision to a HEAD file. // Download the repository and also write the revision to a HEAD file.
@ -134,7 +135,6 @@ func (r *Runner) updateTemplates() error {
if time.Now().Sub(r.templatesConfig.LastChecked) < 24*time.Hour && !r.options.UpdateTemplates { if time.Now().Sub(r.templatesConfig.LastChecked) < 24*time.Hour && !r.options.UpdateTemplates {
return nil return nil
} }
r.templatesConfig.LastChecked = time.Now()
// Get the configuration currently on disk. // Get the configuration currently on disk.
verText := r.templatesConfig.CurrentVersion verText := r.templatesConfig.CurrentVersion