1
4
mirror of https://github.com/yunginnanet/HellPot synced 2024-06-28 16:50:51 +00:00
HellPot/heffalump.go
2016-12-10 20:39:00 -05:00

45 lines
631 B
Go

package main
import (
"flag"
"fmt"
"log"
"net/http"
"os"
"github.com/carlmjohnson/heffalump/heff"
)
const usage = `Usage of heffalump:
heffalump [<network address> [<path>]]
heffalump serves an endless HTTP honeypot
<network address> defaults to ":8080".
<path> defaults to "/". Paths ending in "/" will match all sub-pathes.
`
func main() {
flag.Usage = func() {
fmt.Fprintf(os.Stderr, usage)
}
flag.Parse()
addr := flag.Arg(0)
if addr == "" {
addr = ":8080"
}
path := flag.Arg(1)
if path == "" {
path = "/"
}
http.HandleFunc(path, heff.Honeypot)
log.Fatal(http.ListenAndServe(addr, nil))
}