Add -version flag
This commit is contained in:
parent
54f34077d3
commit
c9aaa2782f
|
@ -206,7 +206,7 @@ func processEntry(scanner *certspotter.Scanner, entry *ct.LogEntry) {
|
|||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
cmd.ParseFlags()
|
||||
|
||||
if *watchlistFilename == "-" {
|
||||
var err error
|
||||
|
|
|
@ -33,6 +33,7 @@ var script = flag.String("script", "", "Script to execute when a matching certif
|
|||
var logsURL = flag.String("logs", defaultLogList, "File path or URL of JSON list of logs to monitor")
|
||||
var noSave = flag.Bool("no_save", false, "Do not save a copy of matching certificates")
|
||||
var verbose = flag.Bool("verbose", false, "Be verbose")
|
||||
var showVersion = flag.Bool("version", false, "Print version and exit")
|
||||
var startAtEnd = flag.Bool("start_at_end", false, "Start monitoring logs from the end rather than the beginning")
|
||||
var allTime = flag.Bool("all_time", false, "Scan certs from all time, not just since last scan")
|
||||
var state *State
|
||||
|
@ -298,6 +299,14 @@ func processLog(logInfo *loglist.Log, processCallback certspotter.ProcessCallbac
|
|||
return 0
|
||||
}
|
||||
|
||||
func ParseFlags() {
|
||||
flag.Parse()
|
||||
if *showVersion {
|
||||
fmt.Fprintf(os.Stdout, "Cert Spotter %s\n", certspotter.Version)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
func Main(statePath string, processCallback certspotter.ProcessCallback) int {
|
||||
var err error
|
||||
|
||||
|
|
|
@ -47,6 +47,6 @@ func processEntry(scanner *certspotter.Scanner, entry *ct.LogEntry) {
|
|||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
cmd.ParseFlags()
|
||||
os.Exit(cmd.Main(*stateDir, processEntry))
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (C) 2021 Opsmate, Inc.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla
|
||||
// Public License, v. 2.0. If a copy of the MPL was not distributed
|
||||
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
//
|
||||
// This software is distributed WITHOUT A WARRANTY OF ANY KIND.
|
||||
// See the Mozilla Public License for details.
|
||||
|
||||
package certspotter
|
||||
|
||||
const Version = "0.11"
|
Loading…
Reference in New Issue