Skip to content

Commit

Permalink
Merge pull request #1821 from projectdiscovery/issue-1797-cleanup-res…
Browse files Browse the repository at this point in the history
…ume-files

clean up old resume files
  • Loading branch information
ehsandeep committed Apr 14, 2022
2 parents 9d27344 + bab8c40 commit 837b1a9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
14 changes: 13 additions & 1 deletion v2/cmd/nuclei/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"os/signal"
"path/filepath"
"time"

"github.com/projectdiscovery/fileutil"
"github.com/projectdiscovery/goflags"
Expand Down Expand Up @@ -231,8 +232,19 @@ on extensive configurability, massive extensibility and ease of use.`)
gologger.Warning().Msgf("Could not read ignore file from custom path: %s\n", err)
}
}
cleanupOldResumeFiles()
}
func cleanupOldResumeFiles() {
root, err := config.GetConfigDir()
if err != nil {
return
}
filter := fileutil.FileFilters{
OlderThan: 24*time.Hour*10, // cleanup on the 10th day
Prefix: "resume-",
}
_=fileutil.DeleteFilesOlderThan(root, filter)
}

func createGroup(flagSet *goflags.FlagSet, groupName, description string, flags ...*goflags.FlagData) {
flagSet.SetGroup(groupName, description)
for _, currentFlag := range flags {
Expand Down
2 changes: 1 addition & 1 deletion v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ require (
github.com/projectdiscovery/cryptoutil v1.0.0
github.com/projectdiscovery/fastdialer v0.0.15-0.20220127193345-f06b0fd54d47
github.com/projectdiscovery/filekv v0.0.0-20210915124239-3467ef45dd08
github.com/projectdiscovery/fileutil v0.0.0-20210928100737-cab279c5d4b5
github.com/projectdiscovery/fileutil v0.0.0-20220411194636-887419690acd
github.com/projectdiscovery/goflags v0.0.8-0.20220323170412-1721b7db8fa0
github.com/projectdiscovery/gologger v1.1.4
github.com/projectdiscovery/hmap v0.0.2-0.20210917080408-0fd7bd286bfa
Expand Down
2 changes: 2 additions & 0 deletions v2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,8 @@ github.com/projectdiscovery/fileutil v0.0.0-20210914153648-31f843feaad4/go.mod h
github.com/projectdiscovery/fileutil v0.0.0-20210926202739-6050d0acf73c/go.mod h1:U+QCpQnX8o2N2w0VUGyAzjM3yBAe4BKedVElxiImsx0=
github.com/projectdiscovery/fileutil v0.0.0-20210928100737-cab279c5d4b5 h1:2dbm7UhrAKnccZttr78CAmG768sSCd+MBn4ayLVDeqA=
github.com/projectdiscovery/fileutil v0.0.0-20210928100737-cab279c5d4b5/go.mod h1:U+QCpQnX8o2N2w0VUGyAzjM3yBAe4BKedVElxiImsx0=
github.com/projectdiscovery/fileutil v0.0.0-20220411194636-887419690acd h1:zFHkfyY0PTQGkZSXMqd8ALOStRGhVMXD1Td325okrFQ=
github.com/projectdiscovery/fileutil v0.0.0-20220411194636-887419690acd/go.mod h1:Pm0f+MWgDFMSSI9NBedNh48LyYPs8gD3Jd8DXGmp4aQ=
github.com/projectdiscovery/folderutil v0.0.0-20211206150108-b4e7ea80f36e h1:RJJuYyuwskYtzZi2gziy6SE/b7saWEzyskaA252E0VY=
github.com/projectdiscovery/folderutil v0.0.0-20211206150108-b4e7ea80f36e/go.mod h1:BMqXH4jNGByVdE2iLtKvc/6XStaiZRuCIaKv1vw9PnI=
github.com/projectdiscovery/goflags v0.0.7/go.mod h1:Jjwsf4eEBPXDSQI2Y+6fd3dBumJv/J1U0nmpM+hy2YY=
Expand Down

0 comments on commit 837b1a9

Please sign in to comment.