kgretzky/evilginx2 · error

no hostname set for phishlet '%s'

Error message

no hostname set for phishlet '%s'

What it means

When showing phishlet URLs (`phishlets get-url <name>`), the base hostname must have been set beforehand via `phishlets hostname <name> <host>`. If GetSiteDomain returns no domain or an empty string for the phishlet, this error is returned since a URL cannot be constructed.

Source

Thrown at core/terminal.go:665

			err := t.cfg.SetSiteHidden(args[1], true)
			if err != nil {
				return err
			}
			return nil
		case "unhide":
			err := t.cfg.SetSiteHidden(args[1], false)
			if err != nil {
				return err
			}
			return nil
		case "get-hosts":
			pl, err := t.cfg.GetPhishlet(args[1])
			if err != nil {
				return err
			}
			bhost, ok := t.cfg.GetSiteDomain(pl.Name)
			if !ok || len(bhost) == 0 {
				return fmt.Errorf("no hostname set for phishlet '%s'", pl.Name)
			}
			out := ""
			hosts := pl.GetPhishHosts(false)
			for n, h := range hosts {
				if n > 0 {
					out += "\n"
				}
				out += t.cfg.GetServerExternalIP() + " " + h
			}
			t.output("%s\n", out)
			return nil
		}
	} else if pn == 3 {
		switch args[0] {
		case "hostname":
			_, err := t.cfg.GetPhishlet(args[1])
			if err != nil {
				return err

View on GitHub (pinned to 4c0988a1d9)

Solutions

  1. Set a hostname first: `phishlets hostname <phishlet> login.yourdomain.com`
  2. Verify DNS records for the chosen hostname point to your server, then re-run get-url
  3. Confirm the phishlet name is correct with `phishlets` (status listing)
  4. Persist the hostname in config so reloads don't lose it

Example fix

// before
phishlets get-url o365:corp
// after
phishlets hostname o365:corp login.corp.example.com
phishlets get-url o365:corp
Defensive patterns

Strategy: validation

Validate before calling

bhost, ok := t.cfg.GetSiteDomain(plName)
if !ok || len(bhost) == 0 {
    return fmt.Errorf("set a hostname first: phishlets hostname %s <host>", plName)
}

Type guard

func hasHostname(cfg *Config, plName string) bool {
    h, ok := cfg.GetSiteDomain(plName)
    return ok && len(h) > 0
}

Try / catch

if err := getUrl(plName); err != nil {
    if strings.Contains(err.Error(), "no hostname set") {
        cfg.SetSiteHostname(plName, defaultHost)
        return getUrl(plName)
    }
    return err
}

Prevention

When it happens

Trigger: Calling `phishlets get-url <name>` (or a lure get-url referencing the phishlet) when no hostname was ever configured for that phishlet, or the hostname was cleared/reset.

Common situations: Fresh setup where `phishlets hostname` was skipped; typo'd phishlet name that resolved to another phishlet without a hostname; config reloaded after certificate/hostname loss; DNS/proxy config wiped the site domain.

Related errors


AI-assisted analysis of kgretzky/evilginx2@4c0988a1d9 (2026-09-05). Data as JSON: /api/errors/94eb2109ce8e40b3. Report an issue: GitHub.