2020-06-07 21:33:48 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2020-06-09 16:01:46 +00:00
|
|
|
"flag"
|
2020-06-07 21:33:48 +00:00
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Main function
|
|
|
|
func main() {
|
2020-06-09 16:01:46 +00:00
|
|
|
// Register flags
|
|
|
|
registerWatcherFlags()
|
|
|
|
flag.Parse()
|
|
|
|
|
2020-06-07 21:33:48 +00:00
|
|
|
// Check args
|
|
|
|
targetFuzzers, targetErr := getFuzzersToWatch()
|
|
|
|
if targetErr != nil {
|
|
|
|
log.Println(targetErr.Error())
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start thread to watch the fuzzer(s)
|
|
|
|
registerFuzzers(targetFuzzers)
|
|
|
|
go watchFuzzers()
|
|
|
|
|
|
|
|
// Start HTTP handler exposing the metrics
|
|
|
|
http.Handle("/metrics", promhttp.Handler())
|
|
|
|
http.ListenAndServe(":2112", nil)
|
|
|
|
}
|