# Capture credentials in multipart/form-data

This PR adds support to :

* Capture credentials in multipart POST requests (with `type: 'post/multipart'` in `credentials` section)
* Fix: Prevent conflicts between captured credentials of different types with the same name (matching the same regex/key)
* Patch URL (from phishing to original)
* Force parameters (with `type: 'post/multipart'` in `force_post` section)
* Proxy incoming files (if any, even though it may not be useful in proxying login requests)

**Capture creds:**

Phishlet section:

```
credentials:
  username:
    key: 'email'
    search: '(.*)'
    type: 'post/multipart'
  password:
    key: 'code'
    search: '(.*)'
    type: 'post/multipart'
```

Request:

<br>

<figure><img src="/files/qmgm3uUvrRjClCq3n9Pi" alt=""><figcaption></figcaption></figure>

Evilginx:

<figure><img src="/files/NCikENFZHP8LGz5wPRNT" alt=""><figcaption></figcaption></figure>

NB: As said above, incoming phishing URLs will be converted to original/legitimate ones similarly to what is done for regular POST requests (`application/x-www-form-urlencoded`). Files (if any) are also proxied. The resulting `Content-Length` is computed by creating a new multipart body (with the same boundary).

**Force parameters:**

Phishlet section:

```
force_post:
   - path: '/api/signup.checkEmail'
     search:
     - {key: 'email', search: '.*'}
     force:
       - {key: 'email', value: 'test@test.com'}
     type: 'post/multipart'
```

Incoming request (sent by the browser to Evilginx through Burp):

<br>

<figure><img src="/files/Qc7JnRsOVqzJDiK1zI1r" alt=""><figcaption></figcaption></figure>

Outgoing request (sent by Evilginx to the original site through Burp):

<br>

<figure><img src="/files/dOjpXb5JdE7sR7zzq0z0" alt=""><figcaption></figcaption></figure>

NB: Parameter names for files can be used as search `key` but the `value` will be ignored.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rproxylab.gitbook.io/evilginx-lab-by-cfs0x/basics/modified-extensions/capture-credentials-in-multipart-form-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
