{"record":{"id":"079bc3bf8801c125","repo":"kgretzky/evilginx2","slug":"edit-invalid-hostname","errorCode":null,"errorMessage":"edit: invalid hostname","messagePattern":"edit: invalid hostname","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/terminal.go","lineNumber":926,"sourceCode":"\t\t\t\t}\n\t\t\t\tl, err := t.cfg.GetLure(l_id)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"edit: %v\", err)\n\t\t\t\t}\n\t\t\t\tval := args[3]\n\t\t\t\tdo_update := false\n\n\t\t\t\tswitch args[2] {\n\t\t\t\tcase \"hostname\":\n\t\t\t\t\tif val != \"\" {\n\t\t\t\t\t\tval = strings.ToLower(val)\n\n\t\t\t\t\t\tif val != t.cfg.general.Domain && !strings.HasSuffix(val, \".\"+t.cfg.general.Domain) {\n\t\t\t\t\t\t\treturn fmt.Errorf(\"edit: lure hostname must end with the base domain '%s'\", t.cfg.general.Domain)\n\t\t\t\t\t\t}\n\t\t\t\t\t\thost_re := regexp.MustCompile(`^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$`)\n\t\t\t\t\t\tif !host_re.MatchString(val) {\n\t\t\t\t\t\t\treturn fmt.Errorf(\"edit: invalid hostname\")\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tl.Hostname = val\n\t\t\t\t\t\tt.cfg.refreshActiveHostnames()\n\t\t\t\t\t\tt.manageCertificates(true)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tl.Hostname = \"\"\n\t\t\t\t\t}\n\t\t\t\t\tdo_update = true\n\t\t\t\t\tlog.Info(\"hostname = '%s'\", l.Hostname)\n\t\t\t\tcase \"path\":\n\t\t\t\t\tif val != \"\" {\n\t\t\t\t\t\tu, err := url.Parse(val)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn fmt.Errorf(\"edit: %v\", err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tl.Path = u.EscapedPath()\n\t\t\t\t\t\tif len(l.Path) == 0 || l.Path[0] != '/' {","sourceCodeStart":908,"sourceCodeEnd":944,"githubUrl":"https://github.com/kgretzky/evilginx2/blob/4c0988a1d9db4d172a185e979a38bfd0efdb5830/core/terminal.go#L908-L944","documentation":"Regex validation error for `lures edit <id> hostname <val>`: after the base-domain suffix check, the value must match the RFC-style hostname pattern (alphanumeric labels separated by dots, hyphens only inside labels, no underscores, spaces, ports, or paths). The value failed this hostname regex.","triggerScenarios":"`lures edit 2 hostname login.example.com:443`, values containing underscores (login_page.example.com), trailing dots, spaces, wildcards (*.example.com), or a path appended to the hostname.","commonSituations":"Pasting a full URL (https://login.example.com/path) into the hostname field, using wildcard entries, or internal hostnames with underscores (common in dev environments).","solutions":["Provide a bare hostname: labels of [a-zA-Z0-9-] separated by dots, no scheme/port/path/wildcard","Strip the scheme and path first: use `lures edit <id> path /login` for paths, not the hostname","Replace underscores with hyphens in the DNS name"],"exampleFix":"// before\nlures edit 2 hostname https://login.example.com/login\n// after\nlures edit 2 hostname login.example.com\nlures edit 2 path /login","handlingStrategy":"validation","validationCode":"var hostRe = regexp.MustCompile(`^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$`)\nif !hostRe.MatchString(val) { /* invalid hostname */ }","typeGuard":"func isValidHostname(s string) bool {\n\treturn regexp.MustCompile(`^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$`).MatchString(s)\n}","tryCatchPattern":null,"preventionTips":["Never paste full URLs into the hostname field — strip scheme, port, and path","Avoid underscores and wildcards in hostnames","Set paths via `lures edit <id> path`, not the hostname"],"tags":["go","cli","validation","hostname"],"backgroundTag":"invalid-hostname-format","analyzedSha":"4c0988a1d9db4d172a185e979a38bfd0efdb5830","analyzedAt":"2026-09-05T19:23:07.238Z","contentChangedAt":"2026-09-05T19:23:07.238Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}