update readme, implement new configuration directives
This commit is contained in:
parent
cddb201eb6
commit
f665f7fd34
51
README.md
51
README.md
|
@ -1,31 +1,34 @@
|
|||
# Heffalump [](https://godoc.org/github.com/carlmjohnson/heffalump) [](https://goreportcard.com/report/github.com/carlmjohnson/heffalump)
|
||||
Heffalump is an endless honeypot that gives malicious bots nightmares. To use, in your robots.txt tell robots not to go to a certain URL, which heffalump is reverse proxying. Any web agent that does go to the URL will receive an endless stream of random data, which will overflow its memory and/or storage if it doesn't have a max buffer size set or at the very least severely waste its time.
|
||||
# HellPot
|
||||
[](https://godoc.org/github.com/yunginnanet/HellPot) [](https://goreportcard.com/report/github.com/yunginnanet/HellPot)
|
||||
|
||||
HellPot is an endless honeypot that gives sends bots to hell. Based on [Heffalump](https://github.com/carlmjohnson/heffalump).
|
||||
|
||||
It finishes the work of Heffalump with a few improvements and the addition of a [toml configuration file](https://github.com/spf13/viper) and [JSON logging](https://github.com/rs/zerolog). It is built off of [CokePlate](https://git.tcp.direct/kayos/CokePlate).
|
||||
|
||||
|
||||
The source of the honeypot data is [Once On a Time](http://www.gutenberg.org/files/27771/27771-h/27771-h.htm), one of A. A. Milne's most beloved and most public domain works.
|
||||
The source of the honeypot data is [The Birth of Tragedy (Hellenism and Pessimism)](https://www.gutenberg.org/files/51356/51356-h/51356-h.htm) by Friedrich Nietzsche
|
||||
|
||||

|
||||

|
||||
|
||||
Live example: <a href="https://heffalump.herokuapp.com" rel="nofollow">Do not follow this link.</a> It will flood your browser's memory and likely cause a crash.
|
||||
Live example: <a href="https://vx-underground.org/wp-login.php" rel="nofollow">Do not follow this link.</a> It will flood your browser's memory and likely cause a crash.
|
||||
|
||||
## Installation
|
||||
First install [Go](http://golang.org).
|
||||
|
||||
If you just want to install the binary to your current directory and don't care about the source code, run
|
||||
|
||||
```shell
|
||||
GOBIN=$(pwd) GOPATH=$(mktemp -d) go get github.com/carlmjohnson/heffalump
|
||||
## Example Web Server Config (nginx)
|
||||
|
||||
```
|
||||
location '/robots.txt' {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_pass http://127.0.0.1:8080$request_uri;
|
||||
}
|
||||
location '/wp-login.php' {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_pass http://127.0.0.1:8080$request_uri;
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
```
|
||||
Usage of heffalump:
|
||||
|
||||
heffalump [opts]
|
||||
|
||||
heffalump serves an endless HTTP honeypot
|
||||
|
||||
-addr string
|
||||
Address to serve (default "127.0.0.1:8080")
|
||||
-path string
|
||||
Path to serve from. Path ending in / serves sub-paths. (default "/")
|
||||
```
|
||||
## Example Program Config (toml)
|
||||
|
||||
If the configuration file is missing, the default settings will automatically drop itself in the current working directory as `config.toml`.
|
||||
|
||||
|
|
|
@ -3,3 +3,12 @@ title = "HellPot"
|
|||
[logger]
|
||||
debug = false
|
||||
log_directory = "./logs/"
|
||||
|
||||
[http]
|
||||
bind_addr = "127.0.0.1"
|
||||
bind_port = "8080"
|
||||
# paths to be added to robots.txt that we will respond to
|
||||
paths = [
|
||||
"wp-login.php",
|
||||
"wp-login",
|
||||
]
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.7 MiB |
Binary file not shown.
After Width: | Height: | Size: 935 KiB |
33
hellpot.go
33
hellpot.go
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"HellPot/src/config"
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
@ -10,34 +11,26 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
const robotsTxt = "User-agent: *\r\nDisallow: "
|
||||
const robotsTxt = "User-agent: *\r\n"
|
||||
|
||||
func startPot() {
|
||||
addr := os.Getenv("HONEYADDR")
|
||||
if addr == "" {
|
||||
addr = "127.0.0.1"
|
||||
}
|
||||
|
||||
port := os.Getenv("HONEYPORT")
|
||||
if port == "" {
|
||||
port = "8080"
|
||||
}
|
||||
|
||||
path := os.Getenv("HONEYPATH")
|
||||
if path == "" {
|
||||
path = "/wp-login.php"
|
||||
}
|
||||
var paths string
|
||||
addr := config.BindAddr
|
||||
port := config.BindPort
|
||||
|
||||
// subscribe to SIGINT signals
|
||||
stopChan := make(chan os.Signal, 1)
|
||||
signal.Notify(stopChan, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
http.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
|
||||
DefaultHoneypot(w, r)
|
||||
})
|
||||
for _, p := range config.Paths {
|
||||
http.HandleFunc(p, func(w http.ResponseWriter, r *http.Request) {
|
||||
DefaultHoneypot(w, r)
|
||||
})
|
||||
paths = paths + "Disallow: " + p + "\r\n"
|
||||
}
|
||||
|
||||
http.HandleFunc("/robots.txt", func(w http.ResponseWriter, r *http.Request) {
|
||||
if _, err := io.WriteString(w, robotsTxt+path+"\r\n"); err != nil {
|
||||
if _, err := io.WriteString(w, robotsTxt+paths+"\r\n"); err != nil {
|
||||
log.Error().Err(err).Msg("SERVE_ROBOTS_ERROR")
|
||||
}
|
||||
})
|
||||
|
@ -45,6 +38,8 @@ func startPot() {
|
|||
srv := &http.Server{Addr: addr + ":" + port, Handler: http.DefaultServeMux}
|
||||
|
||||
go func() {
|
||||
log.Info().Str("bind_addr", addr).Str("bind_port", port).
|
||||
Msg("Listening and serving HTTP...")
|
||||
// service connections
|
||||
err := srv.ListenAndServe()
|
||||
log.Warn().Err(err).Msg("HTTP_STOP")
|
||||
|
|
4
main.go
4
main.go
|
@ -18,10 +18,6 @@ import (
|
|||
|
||||
var log zerolog.Logger
|
||||
|
||||
// TODO:
|
||||
//// optional bitcask database initialization
|
||||
//// fix default config file writing
|
||||
|
||||
func init() {
|
||||
// configuration engine
|
||||
config.Blueprint()
|
||||
|
|
|
@ -47,14 +47,15 @@ var appLabel string = Title + " " + Version
|
|||
|
||||
*/
|
||||
var (
|
||||
Debug bool = false
|
||||
LogDir string
|
||||
Banner string
|
||||
DataDir string
|
||||
Debug bool = false
|
||||
LogDir string
|
||||
Banner string
|
||||
DataDir string
|
||||
Databases []string
|
||||
//Color bool
|
||||
//BindAddr string
|
||||
//BindPort int
|
||||
BindAddr string
|
||||
BindPort string
|
||||
Paths []string
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
@ -202,25 +203,35 @@ func Blueprint() {
|
|||
"log_directory": "./.logs/",
|
||||
}
|
||||
|
||||
defHTTP := map[string]interface{}{
|
||||
"bind_addr": "127.0.0.1",
|
||||
"bind_port": "8080",
|
||||
"paths": []string{
|
||||
"wp-login.php",
|
||||
"wp-login",
|
||||
},
|
||||
}
|
||||
|
||||
/*
|
||||
defData := map[string]interface{}{
|
||||
"directory": "./.data/",
|
||||
}
|
||||
|
||||
/*
|
||||
// here we are defining a generic category as an example
|
||||
defCategory := map[string]interface{}{
|
||||
"shouldistay": true,
|
||||
"shouldigo": false,
|
||||
"optics": "ironsights",
|
||||
"fucksgiven": 0,
|
||||
// e.g: /home/fuckhole/.jonesapp/config.toml
|
||||
//"admins": []string{"Satan", "Yahweh", "FuckholeJones"},
|
||||
}
|
||||
*/
|
||||
// here we are defining a generic category as an example
|
||||
defCategory := map[string]interface{}{
|
||||
"shouldistay": true,
|
||||
"shouldigo": false,
|
||||
"optics": "ironsights",
|
||||
"fucksgiven": 0,
|
||||
"admins": []string{"Satan", "Yahweh", "FuckholeJones"},
|
||||
}
|
||||
*/
|
||||
|
||||
Config.SetDefault("name", defName)
|
||||
Config.SetDefault("logger", defLogger)
|
||||
Config.SetDefault("database", defData)
|
||||
Config.SetDefault("http", defHTTP)
|
||||
//Config.SetDefault("database", defData)
|
||||
//Config.SetDefault("category", defCategory)
|
||||
|
||||
Config.SetConfigType("toml")
|
||||
Config.SetConfigName("config")
|
||||
|
@ -272,7 +283,11 @@ func associate() {
|
|||
LogDir = Config.GetString("logger.log_directory")
|
||||
|
||||
// bitcask database parameters (casket)
|
||||
DataDir = Config.GetString("database.directory")
|
||||
Databases = Config.GetStringSlice("database.databases")
|
||||
//DataDir = Config.GetString("database.directory")
|
||||
//Databases = Config.GetStringSlice("database.databases")
|
||||
|
||||
// HellPot specific directives
|
||||
BindAddr = Config.GetString("http.bind_addr")
|
||||
BindPort = Config.GetString("http.bind_port")
|
||||
Paths = Config.GetStringSlice("http.paths")
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue