# Service Command Library

The Service Command Library (SCL) contains command templates associated with a specific service such as HTTP, SMB, FTP, etc. When a service with a matching SCL entry is added to a Host, the Service Commands list is populated on the [Port Page](https://docs.pentest.ws/hosts-and-services/port-page).

## Service Commands - Port Page

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

![Service Commands on the Port Page](https://1013683115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHecEAvxd6Z8cSug6DhWr%2Fuploads%2Fz0QxFcWGYMtNPXpNTjdO%2Fimage.png?alt=media\&token=d358776c-18ed-47c5-a3e6-3d59ec7a061d)

The Service Commands listed on the Port Page display the command name, command content, and any attached notes.

### Copy & Paste Functionality

SCL works by copy-and-pasting a command from SCL to your terminal. By using variables such as $ip and $port in your templates, the commands are customized for the current Host and Port.&#x20;

{% hint style="info" %}
**Expert Example:**

Run a dirsearch directory brute force attack against the current service ($service), host (ip) and port ($port) and output the results to a timestamped port specific file.

```
/opt/dirsearch/dirsearch.py -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -t 50 -e '',html,php,txt -f --plain-text-report=log.$port.dirsearch.$(date +%s) -u $service://$ip:$port
```

{% endhint %}

To add, edit and delete command templates from you SCL, click the SCL Manager in the upper right corner of the Service Commands section on the Port Page, or use the Service Command Library link from your User Menu.

### Target & Additional Hostnames

On the [Host Page](https://docs.pentest.ws/hosts-and-services/host-page), you can add additional hostnames associated with the current target. For example, if you have specified an IP address as your main target for the current host, add:

`target.local www.target.local app.target.local`

to the hostnames field. These additional hostnames will be available to your Service Commands. Simply use the drop down list at the top of the Service Commands section to attack the host using different hostname values.

## Service Command Library Manager

**URL:** <https://pentest.ws/scl>

![Service Command Library Manager](https://1013683115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHecEAvxd6Z8cSug6DhWr%2Fuploads%2FuMA3PqxrpUav9HoLKy27%2Fimage.png?alt=media\&token=8360a860-77db-4db2-a857-27e07ee45c85)

The Service Command Library Manager contains your repository of service command templates. Add, edit and delete command templates for existing service names, or add a new service name to pre-populate your list.

### Add / Edit Service Command Templates

Click an existing command template to bring up the Edit Service Command screen or click the Add Command button to create new service command templates.

![](https://1013683115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHecEAvxd6Z8cSug6DhWr%2Fuploads%2FzRLNNO6gXl2YV1meowCw%2Fimage.png?alt=media\&token=59095c73-f69b-4f19-b18b-a7163b9dec7e)

**Service(s):** enter the corresponding service name such as HTTP, SMB, FTP, etc. This is used to match your service when adding ports to your Host.

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

Attach service command templates to multiple service names by using aliases. The Service(s) field can be a single service name, or a comma separated list of service names. If your command applies to more than one service, such as both HTTP and HTTPS, enter a value of "http, https".&#x20;

Aliases are indicated in the service list with indented bullets.&#x20;

:exclamation: Be sure to use the $service variable to attack the appropriate service.
{% endhint %}

**Name:** give you service command template a descriptive name to identify the command in your Service Commands list on the Port Page.

**Command:** create a command template using variables such as $ip and $port. Use the available buttons to insert variables at your cursor's current location.

**Notes:** these notes appear in the Service Commands list right below the mutated command

### Merge Services

Select a service and click the ![](https://1013683115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHecEAvxd6Z8cSug6DhWr%2Fuploads%2FoJeytbKC4cHsY6Hm9x7i%2Fimage.png?alt=media\&token=1b776e1e-4a64-4cb5-9086-bdb565f8a745) icon in the top right. You will be prompted to select a second service to merge the command templates with.

![Merge Services](https://1013683115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHecEAvxd6Z8cSug6DhWr%2Fuploads%2Fo7gwntTol1fSdmeG0NFU%2Fimage.png?alt=media\&token=4f632ae7-ed29-4cdf-8afd-4b231adc53c3)

The result is a single Service Command Library entry with an alias of the second service containing both the original command templates and the templates of the second service.

### Print All

Use the Print All button in the top right to generate an HTML report listing all of your services and associated service command templates. This is a great way to backup your command templates or share your list with fellow hackers.

### Delete Service vs Delete Service Command

Be aware there are two different delete buttons in the Service Command Library Manager, the **Delete Service** button and the **Delete Service Command** button.

When viewing the list of command templates for a service, the trash can icon in the service header is the Delete Service button: ![](https://1013683115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHecEAvxd6Z8cSug6DhWr%2Fuploads%2FEJYPCM3s63OY9Qidacle%2Fimage.png?alt=media\&token=4d765aa0-3de7-4f10-8525-abeb309d705e). This will remove the current service from you SCL and delete all attached command templates.

![Delete Service](https://1013683115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHecEAvxd6Z8cSug6DhWr%2Fuploads%2FrkluEDERGSE2I0y1wNxm%2Fimage.png?alt=media\&token=710b3499-9d40-4df5-afdd-2364afc3f1a1)

When viewing an individual command, the Delete button will remove the current command template only: ![](https://1013683115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHecEAvxd6Z8cSug6DhWr%2Fuploads%2F4AxjLMMdOzZ5dY6WRSWA%2Fimage.png?alt=media\&token=a4c02c55-507f-4925-9b25-16f8232ca633)

![Delete Service Command Template](https://1013683115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHecEAvxd6Z8cSug6DhWr%2Fuploads%2FPcuvp7Y0oqKjmuwBA6Uv%2Fimage.png?alt=media\&token=4ef77c52-9c9c-48d4-b69b-4cc95fa0c342)

## Tier Availability

**Service Command Library** is available on **Hobby Tier** and **Pro Tier**, and limited to two (2) command templates per service on **Free Tier**.
