• EnglishSpanishGermanFrenchPolishChinese (Traditional)


EnglishSpanishGermanFrenchPolishChinese (Traditional)

Operating systems, scripting, PowerShell and security

Operating systems, software development, scripting, PowerShell tips, network and security

Menú principal
  • Categorías
  • Cursos
  • Libro de PowerShell
  • Lo mejor
  • Lo último
  • Proyectos
  • Contactar
Ir al contenido

Realizar un login entre un cliente y servidor por UDP en PowerShell (comprobar el usuario y la contraseña en el servidor)

Contenidos

  • Servidor
  • Cliente

Servidor

PowerShell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
##Server
$port=2021
$endpoint = new-object System.Net.IPEndPoint ([IPAddress]::Any,$port)
$udpclient=new-Object System.Net.Sockets.UdpClient $port
$content=$udpclient.Receive([ref]$endpoint)
$convert=[Text.Encoding]::ASCII.GetString($content)
 
$spli=$convert.Split("*")
$user=$spli[0]
$pass=$spli[1]
 
if($user -eq "user" -and $pass -eq "pass")
{
    Write-Host "Login"
}
else
{
    Write-Host "No login"
}
 
$udpclient.Close()

Cliente

PowerShell
1
2
3
4
5
6
7
8
9
##Client
 
$port=2021
$endpoint = new-object System.Net.IPEndPoint ([IPAddress]::Loopback,$port)
$udpclient=new-Object System.Net.Sockets.UdpClient
$val="user*pass"
$b=[Text.Encoding]::ASCII.GetBytes($val.ToString())
$bytesSent=$udpclient.Send($b,$b.length,$endpoint)
$udpclient.Close()
Publicado el día 22 de enero de 2021

CATEGORÍAS

PowerShell, Red, Seguridad

ETIQUETAS

.NET, ASCII.GetBytes, client, IPAddress, Jesús Niño, Jesús Niño Camazón, Length, New-Object, Server, Sockets, Split, System.Net.IPEndPoint, System.Net.Sockets.UdpClient, Text.Encoding, ToString, UDP, User, Write-Host

MÁS

  • Enviar un mensajes cifrado con Cryptographic Message Syntax (CMS) entre un cliente y un servidor mediante UDP desde PowerShell
  • Listado de prácticas sobre temas de seguridad
  • Enviar un fichero junto con su hash entre un cliente y un servidor por UDP desde PowerShell y verificar que el hash es correcto cuando lo recibe el servidor además realizar un login y…
  • Ejercicios de PowerShell: enviar el código de una página web mediante UDP entre un cliente y un servidor después de realizar una comprobación del nombre de usuario
  • Ejercicios de seguridad: simular el funcionamiento de un proxy caché mediante una conexión UDP entre un cliente y un servidor que solicitan una imagen y si la imagen ya se ha descargado se…
  • 11. Gestión del Directorio Activo (nivel intermedio)