// Command preview-honeypot 把全部伪装家族渲染成静态 HTML,供人工核对外观。 // // 用法:go run ./dev/preview-honeypot // 产物:outputs/honeypot-preview/index.html(9 个 iframe 并排) // // 改动 internal/security/honeypot/family.go 的皮肤后重新跑一次, // 比对着源码想象 CSS 可靠得多 —— 上一版就是靠它发现 Tomcat 按钮没背景色。 package main import ( "fmt" "os" "path/filepath" "strings" "github.com/tamakyi/TamaBox/internal/security/honeypot" ) type item struct { fam honeypot.Family action string note string } func main() { dir := "outputs/honeypot-preview" if err := os.MkdirAll(dir, 0o755); err != nil { panic(err) } items := []item{ {honeypot.FamilyWordPress, "/wp-login.php", "/wp-login.php · /wp-admin"}, {honeypot.FamilyPhpMyAdmin, "/phpmyadmin/index.php", "/phpmyadmin · /pma"}, {honeypot.FamilyTomcat, "/manager/html", "/manager/html · 401 Basic"}, {honeypot.FamilyJenkins, "/jenkins/login", "/jenkins"}, {honeypot.FamilyGrafana, "/grafana/login", "/grafana"}, {honeypot.FamilyGitLab, "/users/sign_in", "/users/sign_in"}, {honeypot.FamilyLuCI, "/cgi-bin/luci", "/cgi-bin/luci"}, {honeypot.FamilyJoomla, "/administrator/index.php", "/administrator"}, {honeypot.FamilyGeneric, "/admin", "/admin · /console"}, } var cards strings.Builder for _, it := range items { name := it.fam.String() body := honeypot.RenderFamily(it.fam, honeypot.LoginPageVars{ Action: it.action, Redir: "/wp-admin/", Failed: false, }) if err := os.WriteFile(filepath.Join(dir, name+".html"), body, 0o644); err != nil { panic(err) } fmt.Fprintf(&cards, `
%s%s
`, name, it.note, name, name) } page := ` 蜜罐伪装家族预览

蜜罐:9 个伪装家族

每个 iframe 是 /wp-admin 这类诱饵路径的真实响应(同一份 RenderFamily 输出,未做任何美化)。Tomcat 家族在真实响应里是 401 + Basic Auth,这里有页面是为了看内容。

` + cards.String() + `
` if err := os.WriteFile(filepath.Join(dir, "index.html"), []byte(page), 0o644); err != nil { panic(err) } fmt.Println("预览已生成:", filepath.Join(dir, "index.html")) }