1
4
mirror of https://github.com/yunginnanet/HellPot synced 2024-06-25 15:28:01 +00:00

Web: Serve only the exact path

This commit is contained in:
Carl Johnson 2017-08-28 11:31:16 -04:00
parent 186d672aa2
commit b612c1fb98

@ -28,10 +28,14 @@ func main() {
port = "8080"
}
path := flag.String("path", "/", `Path to serve from. Path ending in / serves sub-paths.`)
flag.Parse()
http.HandleFunc(*path, heff.DefaultHoneypot)
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
http.NotFound(w, r)
return
}
log.Printf("serving %v", r)
heff.DefaultHoneypot(w, r)
})
log.Fatal(http.ListenAndServe(":"+port, nil))