diff --git a/README.md b/README.md index c3e2c9c5..49b4f10b 100644 --- a/README.md +++ b/README.md @@ -602,6 +602,7 @@ Index page for http server can be customized while running custom interactsh ser interactsh-server -d hackwithautomation.com -http-index banner.html ``` +`{REFLECTION}` placeholder is supported in index file to replace with the inverted ID in case it exists. `{DOMAIN}` placeholder is also supported in index file to replace with server domain name. ![image](https://user-images.githubusercontent.com/8293321/179397016-f6ee12e0-5b0b-42b6-83e7-f0972a804655.png) diff --git a/pkg/server/http_server.go b/pkg/server/http_server.go index 20310aeb..d8561e5a 100644 --- a/pkg/server/http_server.go +++ b/pkg/server/http_server.go @@ -277,12 +277,11 @@ func (h *HTTPServer) defaultHandler(w http.ResponseWriter, req *http.Request) { } } h.staticHandler.ServeHTTP(w, req) + } else if req.URL.Path == "/" && h.customBanner != "" { + b := strings.ReplaceAll(h.customBanner, "{REFLECTION}", reflection) + fmt.Fprint(w, strings.ReplaceAll(b, "{DOMAIN}", domain)) } else if req.URL.Path == "/" && reflection == "" { - if h.customBanner != "" { - fmt.Fprint(w, strings.ReplaceAll(h.customBanner, "{DOMAIN}", domain)) - } else { - fmt.Fprintf(w, banner, domain) - } + fmt.Fprintf(w, banner, domain) } else if strings.EqualFold(req.URL.Path, "/robots.txt") { fmt.Fprintf(w, "User-agent: *\nDisallow: / # %s", reflection) } else if stringsutil.HasSuffixI(req.URL.Path, ".json") {