# Cliente-Servidor
## Comunicación entre cliente y servidor
* https://www.jesusninoc.com/2015/02/25/creating-reverse-shell/
* https://www.jesusninoc.com/2015/02/26/creating-shell/
* https://www.jesusninoc.com/2017/10/18/crear-una-comunicacion-entre-un-cliente-en-bash-de-linux-y-un-servidor-en-powershell-de-windows-utilizando-tcpip/
* https://www.jesusninoc.com/2017/10/26/crear-una-comunicacion-entre-un-cliente-en-powershell-de-windows-y-un-servidor-en-bash-de-linux-utilizando-tcpip/
* https://www.jesusninoc.com/2016/04/30/simular-el-funcionamiento-de-un-servidor-web-utilizando-netcat-en-linux/
* https://www.jesusninoc.com/2009/06/06/ejecutar-nc-exe-cmd-exe-remotamente/

## Servidor desde PowerShell
https://www.jesusninoc.com/2017/05/06/crear-un-servidor-web-al-que-se-pueda-acceder-desde-cualquier-parte-de-la-red-privada-con-powershell/

## Tcpdump desde PowerShell
http://www.thegeekstuff.com/2010/08/tcpdump-command-examples

## JVM Post-Exploitation One-Liners
### Reverse Shell
https://gist.github.com/frohoff/a976928e3c1dc7c359f8

## Utilizando la comunicación remota entre cliente y servidor simular una conexión a una shell y una reverse shell
* https://www.jesusninoc.com/01/27/ejecutar-un-cmdlet-remotamente-en-un-equipo-utilizando-sockets-udp/
* https://www.jesusninoc.com/2015/02/25/creating-reverse-shell/
* https://www.jesusninoc.com/2015/02/26/creating-shell/

## Ejecutar un comando remotamente utilizando un servidor web creado en PowerShell
```Powershell
$routes = @{
    "/" = { return '<html><body>Servidor web funcionando</body></html>' }
}

#Importante poner la IP de la red privada
$url = 'http://192.168.204.222:8027/'
$listener = New-Object System.Net.HttpListener
$listener.Prefixes.Add($url)
$listener.Start()

Write-Host "Funcionando $url..."

while ($listener.IsListening)
{
    $context = $listener.GetContext()
    $requestUrl = $context.Request.Url
    $response = $context.Response

    Write-Host ''
    Write-Host "Petición: $requestUrl"

    $localPath = $requestUrl.LocalPath
    $route = $routes.Get_Item($requestUrl.LocalPath)

    if ($route -eq $null)
    {
        $response.StatusCode = 404
    }
    else
    {
        
        $content = & $route
        $buffer = [System.Text.Encoding]::UTF8.GetBytes($content)
        $response.ContentLength64 = $buffer.Length
        $response.OutputStream.Write($buffer, 0, $buffer.Length)
    }
    
    $response.Close()
    start-process ($context.Request.RawUrl -replace "/")
    $context.Request.RawUrl
    $responseStatus = $response.StatusCode
    Write-Host "Respuesta: $responseStatus"
}
```
