kgretzky/evilginx2 · error

invalid syntax: %s

Error message

invalid syntax: %s

What it means

handleConfig validates arguments to the 'config' terminal command; when the subcommand/argument pattern matches none of the accepted forms (e.g. config domain, config ipv4, config unfurl, config tls ...), it returns this error echoing the raw args slice. It is a CLI syntax error, not a runtime failure.

Source

Thrown at core/terminal.go:273

			case "admin_url":
				t.cfg.SetGoPhishAdminUrl(args[2])
				return nil
			case "api_key":
				t.cfg.SetGoPhishApiKey(args[2])
				return nil
			case "insecure":
				switch args[2] {
				case "true":
					t.cfg.SetGoPhishInsecureTLS(true)
					return nil
				case "false":
					t.cfg.SetGoPhishInsecureTLS(false)
					return nil
				}
			}
		}
	}
	return fmt.Errorf("invalid syntax: %s", args)
}

func (t *Terminal) handleBlacklist(args []string) error {
	pn := len(args)
	if pn == 0 {
		mode := t.cfg.GetBlacklistMode()
		ip_num, mask_num := t.p.bl.GetStats()
		log.Info("blacklist mode set to: %s", mode)
		log.Info("blacklist: loaded %d ip addresses and %d ip masks", ip_num, mask_num)

		return nil
	} else if pn == 1 {
		switch args[0] {
		case "all":
			t.cfg.SetBlacklistMode(args[0])
			return nil
		case "unauth":
			t.cfg.SetBlacklistMode(args[0])

View on GitHub (pinned to 4c0988a1d9)

Solutions

  1. Run 'help config' to list accepted syntaxes
  2. Use exact subcommands: domain, ip/ipv4, https/insecure, unfurl, etc., with the required value
  3. Check argument count: most forms need exactly 2 args (subcommand + value)

Example fix

// before (shell)
config domains evil.example.com
// after
config domain evil.example.com
Defensive patterns

Strategy: validation

Validate before calling

validConfigArgs := map[string]int{"domain":1,"ip":1,"ipv4":1,"unfurl":1,"https":1,"insecure":1}
// check: len(args)==2 && validConfigArgs[args[0]]==1

Try / catch

if err := t.handleConfig(args); err != nil {
	fmt.Fprintln(os.Stderr, "usage: config <domain|ip|unfurl|...> <value>", err)
}

Prevention

When it happens

Trigger: Running a 'config' command in the goPhish terminal with an unrecognized subcommand or wrong argument count, e.g. 'config domain' with no value, 'config foo bar', or extra tokens so no switch/if branch matches.

Common situations: Typing 'config domains example.com' (plural), forgetting the value argument ('config ipv4' without true/false), typos in subcommands like 'config tls_domain'.

Related errors


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