From 5bcd0f3d8ec4c7d297a95680fea6b422036b4a4e Mon Sep 17 00:00:00 2001 From: Diogo Silva Date: Thu, 6 Nov 2025 11:46:23 +0000 Subject: [PATCH] Allow custom banner on attack domains --- README.md | 1 + pkg/server/http_server.go | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) 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") {