kgretzky/evilginx2 · error

please disable the proxy before making changes to its config

Error message

please disable the proxy before making changes to its configuration

What it means

handleProxy ('proxy type' command) refuses to change proxy settings (type/address/port/credentials) while the proxy is currently enabled, because live configuration changes would leave the running proxy in an inconsistent state. It is a state-validation guard requiring the user to disable the proxy first.

Source

Thrown at core/terminal.go:352

			if err != nil {
				return err
			}
			t.cfg.EnableProxy(true)
			log.Important("you need to restart evilginx for the changes to take effect!")
			return nil
		case "disable":
			err := t.p.setProxy(false, t.p.cfg.proxyConfig.Type, t.p.cfg.proxyConfig.Address, t.p.cfg.proxyConfig.Port, t.p.cfg.proxyConfig.Username, t.p.cfg.proxyConfig.Password)
			if err != nil {
				return err
			}
			t.cfg.EnableProxy(false)
			return nil
		}
	} else if pn == 2 {
		switch args[0] {
		case "type":
			if t.cfg.proxyConfig.Enabled {
				return fmt.Errorf("please disable the proxy before making changes to its configuration")
			}
			t.cfg.SetProxyType(args[1])
			return nil
		case "address":
			if t.cfg.proxyConfig.Enabled {
				return fmt.Errorf("please disable the proxy before making changes to its configuration")
			}
			t.cfg.SetProxyAddress(args[1])
			return nil
		case "port":
			if t.cfg.proxyConfig.Enabled {
				return fmt.Errorf("please disable the proxy before making changes to its configuration")
			}
			port, err := strconv.Atoi(args[1])
			if err != nil {
				return err
			}
			t.cfg.SetProxyPort(port)

View on GitHub (pinned to 4c0988a1d9)

Solutions

  1. Run 'proxy off' first, then 'proxy type <type>', then 'proxy on'
  2. Verify current state with 'proxy' (no args) before editing
  3. Reorder automation scripts to apply proxy config before enabling

Example fix

// before
proxy type socks5
// after
proxy off
proxy type socks5
proxy on
Defensive patterns

Strategy: validation

Validate before calling

if cfg.GetProxyEnabled() {
	return errors.New("disable proxy first: run 'proxy off' before 'proxy type'")
}

Try / catch

if err := t.handleProxy(args); err != nil {
	if strings.Contains(err.Error(), "disable the proxy") {
		t.handleProxy([]string{"off"}); err = t.handleProxy(args); t.handleProxy([]string{"on"})
	}
}

Prevention

When it happens

Trigger: Running 'proxy type <type>' (e.g. 'proxy type http' or 'proxy type socks5') while proxy is enabled (cfg.proxyConfig.Enabled == true).

Common situations: Trying to switch proxy type mid-engagement after 'proxy on'; scripted terminal automation that reconfigures proxy without checking state.

Related errors


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