# 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](/files/Kk0wWZEmF7Pay1n99JkJ)

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

![Template Variables](/files/y2XkQDVM94X6Ir2jlgRQ)

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

Scan a target and automatically import the results into your current Engagement using the [PenTest.WS API](/automation-and-integration/api.md). 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](/files/ukcWrxpd8BCiEDYespRa)

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](/files/jNmn6jjeSns17n0ThOQO)

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

## Tier Availability

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


---

# 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://docs.pentest.ws/getting-started/port-scan-templates.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.
