Skip to content

Commit

Permalink
setted banner and flags
Browse files Browse the repository at this point in the history
  • Loading branch information
kopolindo committed Mar 27, 2018
1 parent de9bd41 commit c6d6f51
Showing 1 changed file with 53 additions and 2 deletions.
55 changes: 53 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,61 @@
package main

import (
"github.com/kopolindo/cve-scraper/db"
"flag"
"fmt"
"os"

"github.com/alecthomas/template"
_ "github.com/mattn/go-sqlite3"
)

const banner = `
#### # # ###### #### #### ##### ## ##### ###### #####
# # # # # # # # # # # # # # # # #
# # # ##### ##### #### # # # # # # # ##### # #
# # # # # # ##### ###### ##### # #####
# # # # # # # # # # # # # # # # #
#### ## ###### #### #### # # # # # ###### # #
|Version: {{.Ver}}
|Commit: {{.Commit}}
|Build: {{.Build}}
`

type Version struct {
Ver string
Build string
Commit string
}

var ActualVersion = Version{"0.1", "Developing", "de9bd41fa1450f6a5bbb667567040615c945c0c6"}

//FLAGS
var (
cve = flag.String("cve", "", "CVE-ID to look for")
sw = flag.String("sw", "", "Software name to look for")
swVersion = flag.String("swv", "", "Software name AND version software")
version = flag.Bool("v", false, "Print version and exit")
)

func printbanner() {
tmpl := template.New("banner")
template.Must(tmpl.Parse(banner))
_ = tmpl.Execute(os.Stderr, ActualVersion)
}

func Init() {
printbanner()
if flag.NFlag() == 0 {
fmt.Println("\nUsage flags:")
flag.PrintDefaults()
return
}
flag.Parse()
}

func main() {
db.Populate()
Init()
}

0 comments on commit c6d6f51

Please sign in to comment.