# Pynt with Prerecorded Har Files

{% hint style="success" %}
🚀 **At a Glance**: Pynt allows you to use **Prerecorded HAR Files** for API security testing, providing a powerful way to assess testing environments or real-world API traffic. By importing HAR files into Pynt, you can run comprehensive security scans on captured traffic data, ensuring the Pynt's security tests leverages actual API usage.
{% endhint %}

***

## What is HAR File

A HAR (HTTP Archive) file is a JSON-formatted file that logs a web browser's interaction with a site. It records all web requests and responses, including URLs, headers, body content, and the timing information for each resource. HAR files are used for analyzing network performance issues and troubleshooting website errors.

<figure><img src="https://3462681674-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZKwBF6q0tAGXlIih38HL%2Fuploads%2FWn71GEIiuzfmcYQCwj06%2Fimage.png?alt=media&#x26;token=6a7b9bfc-2966-43cd-994a-32ef2d8a2c5f" alt="" width="64"><figcaption><p>har</p></figcaption></figure>

***

## How to Record HAR Files

Recording HAR files can be done using various methods, depending on the browser or tool you are using. Here are the most common ways:

***

### **Using Google Chrome**

1. Open the Chrome menu (three dots) and select **More tools > Developer tools**.
2. Go to the **Network** tab.
3. Check the **Preserve log** box to save all interactions.
4. Reproduce the issue you are encountering.
5. Right-click within the Network tab and choose **Save all as HAR with content**.

***

### **Using Mozilla Firefox**

1. Open the menu (three horizontal bars) and select **Web Developer > Network**, or press `Ctrl+Shift+E`.
2. Reproduce the issue on the site.
3. Click the **Save all as HAR** icon to export the HAR file.

***

### **Using Safari**

1. Go to **Safari > Preferences > Advanced** and check the **Show Develop menu in menu bar**.
2. From the **Develop** menu, select **Show Web Inspector**.
3. Click the **Network** tab and reproduce the issue.
4. Right-click the network items and select **Export HAR**.

***

### **Using Other Tools**

* **WebPageTest**: When running a test, select the **Chrome** tab and check the **Capture Network Log** option.
* **Fiddler**: Can capture network traffic and export it as a HAR file.
* **Charles Proxy**: Can also be used to generate HAR files from captured network traffic.

Each method varies slightly but ultimately serves the purpose of capturing web interactions to troubleshoot or analyze website performance issues.

***

## Setup

1. First, make sure Pynt's [prerequisites](https://docs.pynt.io/documentation/api-security-testing/prerequisites-for-running-pynt-scans) are met.
2. Follow the instructions to install Pynt container [here](https://docs.pynt.io/documentation/api-security-testing/how-to-install-pynt-cli).

***

## **Run Pynt CLI Command for HAR**

### Basic usage

```
pynt har --har <path to har file> --captured-domains <domain>
```

### Required arguments

{% code overflow="wrap" %}

```
--har - Path to har file
--captured-domains - Pynt will scan only these domains and subdomains. For all domains write "*"
```

{% endcode %}

### Optional arguments

{% code overflow="wrap" %}

```
--reporters - Output results to json
--application-id - Attach the scan to an application, you can find the ID in your applications area at app.pynt.io
--host-ca - Path to the CA file in PEM format to enable SSL certificate verification for pynt when running through a VPN.
```

{% endcode %}

***

## **How to run Pynt with HAR file**

For example, running Pynt on a HAR file of goat:

get the `goat.har` file [here](https://raw.githubusercontent.com/pynt-io/pynt/main/goat_functional_tests/goat.har)

Run Pynt:

```bash
pynt har --har goat.har --captured-domains  "*"
```

<figure><img src="https://3462681674-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZKwBF6q0tAGXlIih38HL%2Fuploads%2FERDNMPamu1yZkyaqle6p%2Fimage.png?alt=media&#x26;token=b4065d8c-94ec-41ae-8f46-03d697c2ed76" alt=""><figcaption><p>Pynt with HAR example</p></figcaption></figure>

***

{% hint style="info" %}
💡 **Pynt CLI Troubleshooting**: If you're encountering issues with Pynt's CLI, visit the [**Pynt CLI Troubleshooting Guide**](https://docs.pynt.io/documentation/api-security-testing/pynt-scans-troubleshooting/pynt-cli-troubleshooting) for solutions and troubleshooting tips.
{% endhint %}

{% hint style="info" %}
💡 **Still Need Help?** For any questions or troubleshooting, reach out to the [**Pynt Community Support**](https://www.pynt.io/community).
{% endhint %}
