kgretzky/evilginx2 · error

export format can only be 'text', 'csv' or 'json'

Error message

export format can only be 'text', 'csv' or 'json'

What it means

exportPhishUrls validates the requested export format against a whitelist of 'text', 'csv' and 'json' and rejects anything else. The format string is chosen when invoking the lure URL export command, so an unsupported or misspelled format aborts the export before any file is written.

Source

Thrown at core/terminal.go:1670

							}


						}
					}
				}
			} else {
				return ret, ret_params, fmt.Errorf("array of parameters not found")
			}*/
	}
	return ret, ret_params, nil
}

func (t *Terminal) exportPhishUrls(export_path string, phish_urls []string, phish_params []map[string]string, format string) error {
	if len(phish_urls) != len(phish_params) {
		return fmt.Errorf("phishing urls and phishing parameters count do not match")
	}
	if !stringExists(format, []string{"text", "csv", "json"}) {
		return fmt.Errorf("export format can only be 'text', 'csv' or 'json'")
	}

	f, err := os.OpenFile(export_path, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
	if err != nil {
		return err
	}
	defer f.Close()

	if format == "text" {
		for n, phish_url := range phish_urls {
			var params string
			m := 0
			params_row := phish_params[n]
			for k, v := range params_row {
				if m > 0 {
					params += " "
				}
				params += fmt.Sprintf("%s=\"%s\"", k, v)

View on GitHub (pinned to 4c0988a1d9)

Solutions

  1. Use exactly one of: 'text', 'csv', 'json' (lowercase).
  2. Fix casing — the check is case-sensitive, so 'JSON' fails.
  3. Verify the scripted variable resolves to a supported value before invoking the export.

Example fix

// before
lures export urls out.txt txt
// after
lures export urls out.txt text
Defensive patterns

Strategy: validation

Validate before calling

var allowed = map[string]bool{"text": true, "csv": true, "json": true}
format = strings.ToLower(format)
if !allowed[format] {
    return fmt.Errorf("unsupported export format %q; use text, csv or json", format)
}
err := t.exportPhishUrls(path, urls, params, format)

Try / catch

if err := t.exportPhishUrls(path, urls, params, format); err != nil {
    if strings.Contains(err.Error(), "export format") {
        log.Printf("%q is not supported; pick text, csv or json", format)
        return
    }
    return err
}

Prevention

When it happens

Trigger: Calling exportPhishUrls (via the lures export command) with format values like 'txt', 'JSON' (uppercase), 'yaml', or an empty string.

Common situations: Typing 'txt' instead of 'text', assuming case-insensitive matching (stringExists is case-sensitive), or scripting with a variable that defaults to a different format name.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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