# Port Scan Templates

**Example URL:** <https://pentest.ws/e/{engagement.id}/import>

Port Scan Templates are available on the *Scan & Import XML* page. Scan templates work using copy-and-paste from the web application to your terminal.

1. Enter a Target IP or Hostname
2. Click on a template to copy the command to your clipboard
3. Open a bash or powershell terminal
4. Paste and execute

## Single Host Port Scans

![Single Host Port Scan Templates](https://1013683115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHecEAvxd6Z8cSug6DhWr%2Fuploads%2FSkr2RUot7haY8ta05L7i%2Fimage.png?alt=media\&token=c6099c04-c12b-4fcd-b378-a0b58d84f640)

Scan Templates can include variables such as %tip% to insert your Target IP / Hostname.

![Template Variables](https://1013683115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHecEAvxd6Z8cSug6DhWr%2Fuploads%2FSWGI8UzEldDSi0Q1pUGi%2Fimage.png?alt=media\&token=665e4a2a-98ab-4de3-b37c-a4a119d78de9)

{% hint style="info" %}
**Level Up!**

Scan a target and automatically import the results into your current Engagement using the [PenTest.WS API](https://docs.pentest.ws/automation-and-integration/api). The *%apikey%* variable will be replaced with your API key once you have confirmed your account password.

*Do not put your API key directly into templates!*

```
nmap -sC -sV -oA tcp -vv %tip% && curl -X POST "https://pentest.ws/api/v1/e/%eid%/import/nmap" -H  "X-API-KEY: %apikey%" -F "file=@tcp.xml"
```

{% endhint %}

## Subnet Port Scans

![Subnet Port Scan Templates](https://1013683115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHecEAvxd6Z8cSug6DhWr%2Fuploads%2FaJtBqLlIff25rATA29IS%2Fimage.png?alt=media\&token=8ffec076-5f28-46f0-9ee6-7076a8b756b7)

Subnet Port Scans work similar to Single Host Port Scans, with the added field of a DNS Server to resolve hostnames from an IP address range. The Subnet field can be a single IP address (10.1.2.3), an IP range (10.1.2.100-140) or CIDR notation (10.1.2.0/24)

## Creating & Modifying Scan Templates

Click the *Edit Templates* button to enter *Change Mode*. Here you will be able to create new scan templates or modify existing templates.

![Modifying A Scan Template](https://1013683115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHecEAvxd6Z8cSug6DhWr%2Fuploads%2FroTC4b3pBjVNcLOJjuJN%2Fimage.png?alt=media\&token=0dfe57f6-e204-4a66-a4e5-646a0b379e8b)

Save your changes and click the *Use Templates* button to exit *Change Mode*.

## Tier Availability

**Port Scan Templates** are available on all tiers.
