package config
import (
"strings"
"github.com/Masterminds/semver/v3"
)
type AppMode string
const (
AppModeLibrary AppMode = "library"
AppModeCLI AppMode = "cli"
)
var (
CurrentAppMode = AppModeLibrary
)
const (
TemplateConfigFileName = ".templates-config.json"
NucleiTemplatesDirName = "nuclei-templates"
OfficialNucleiTemplatesRepoName = "nuclei-templates"
NucleiIgnoreFileName = ".nuclei-ignore"
NucleiTemplatesIndexFileName = ".templates-index"
NucleiTemplatesCheckSumFileName = ".checksum"
NewTemplateAdditionsFileName = ".new-additions"
CLIConfigFileName = "config.yaml"
ReportingConfigFilename = "reporting-config.yaml"
Version = `v3.4.10`
CustomS3TemplatesDirName = "s3"
CustomGitHubTemplatesDirName = "github"
CustomAzureTemplatesDirName = "azure"
CustomGitLabTemplatesDirName = "gitlab"
BinaryName = "nuclei"
FallbackConfigFolderName = ".nuclei-config"
NucleiConfigDirEnv = "NUCLEI_CONFIG_DIR"
)
func IsOutdatedVersion(current, latest string) bool {
if latest == "" {
return false
}
current = trimDevIfExists(current)
currentVer, _ := semver.NewVersion(current)
newVer, _ := semver.NewVersion(latest)
if currentVer == nil || newVer == nil {
return current != latest
}
return newVer.GreaterThan(currentVer)
}
func trimDevIfExists(version string) string {
if strings.HasSuffix(version, "-dev") {
return strings.TrimSuffix(version, "-dev")
}
return version
}
const (
DebugArgHostErrorStats = "host-error-stats"
DebugExportURLPattern = "req-url-pattern"
)