mirror of
https://github.com/lunchcat/sif.git
synced 2026-06-12 11:01:24 -07:00
661480a56d
- add internal/version: resolve from the release ldflag, else the go build info (module tag / vcs revision), else "dev" - show the version on the boot banner and for `sif version` - Makefile now stamps `make` builds via git describe (matching the release ci), so local/go-install builds report a real version instead of "dev" - patchnotes.ShowOnce skips pseudo/dev versions so non-release builds dont make a doomed github call - document sif version / sif patchnote / SIF_NO_PATCHNOTES in the readme + usage
64 lines
2.1 KiB
Go
64 lines
2.1 KiB
Go
/*
|
|
·━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━·
|
|
: :
|
|
: █▀ █ █▀▀ · Blazing-fast pentesting suite :
|
|
: ▄█ █ █▀ · BSD 3-Clause License :
|
|
: :
|
|
: (c) 2022-2026 vmfunc, xyzeva, :
|
|
: lunchcat alumni & contributors :
|
|
: :
|
|
·━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━·
|
|
*/
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/charmbracelet/log"
|
|
"github.com/dropalldatabases/sif"
|
|
"github.com/dropalldatabases/sif/internal/config"
|
|
"github.com/dropalldatabases/sif/internal/patchnotes"
|
|
ver "github.com/dropalldatabases/sif/internal/version"
|
|
|
|
// Register framework detectors
|
|
_ "github.com/dropalldatabases/sif/internal/scan/frameworks/detectors"
|
|
)
|
|
|
|
// version is stamped at release time via -ldflags "-X main.version=...";
|
|
// ver.Resolve falls back to the build info or "dev" for other builds.
|
|
var version = "dev"
|
|
|
|
func main() {
|
|
version = ver.Resolve(version)
|
|
sif.Version = version
|
|
|
|
if len(os.Args) > 1 {
|
|
switch os.Args[1] {
|
|
case "patchnote", "patchnotes", "-pn", "--patchnotes":
|
|
patchnotes.Print("")
|
|
return
|
|
case "version", "-version", "--version":
|
|
fmt.Printf("sif %s\n", version)
|
|
return
|
|
}
|
|
}
|
|
|
|
settings := config.Parse()
|
|
|
|
app, err := sif.New(settings)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
if !settings.ApiMode {
|
|
patchnotes.ShowOnce(version)
|
|
}
|
|
|
|
err = app.Run()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|