Skip to content

Commit

Permalink
Fixed update template issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Ice3man543 committed Jul 8, 2020
1 parent 0c962a9 commit d6fb6bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions v2/internal/runner/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func (r *Runner) writeConfiguration(config *nucleiConfig) error {
return err
}

config.LastChecked = time.Now()
templatesConfigFile := path.Join(home, nucleiConfigFilename)
file, err := os.OpenFile(templatesConfigFile, os.O_WRONLY|os.O_CREATE, 0777)
if err != nil {
Expand Down Expand Up @@ -106,7 +107,7 @@ func (r *Runner) updateTemplates() error {
if 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)

// Download the repository and also write the revision to a HEAD file.
Expand Down Expand Up @@ -134,7 +135,6 @@ func (r *Runner) updateTemplates() error {
if time.Now().Sub(r.templatesConfig.LastChecked) < 24*time.Hour && !r.options.UpdateTemplates {
return nil
}
r.templatesConfig.LastChecked = time.Now()

// Get the configuration currently on disk.
verText := r.templatesConfig.CurrentVersion
Expand Down

0 comments on commit d6fb6bd

Please sign in to comment.