lunes, 8 de abril de 2019

Explorando la red con PowerShell: Escaneo de puertos TCP y barridos ping

A continuación comparto una recopilación de algunos comandos útiles a la hora de explorar la red utilizando PowerShell.

Barridos ping

Para descubrir todos los hosts activos de una red de forma rápida podemos realizar un barrido ping o ICMP. En este ejemplo se usa un operador de rango para hacer ping a todas las IP's de una red /24 y del resultado filtramos los que contienen la linea TTL, que son los que nos interesan (esto excluye las IP's que respondieron con tiempo de espera agotado)


PS C:\> 1..254 | % {echo "192.168.88.$_"; ping -n 1 -w 100 192.168.88.$_} | Select-String ttl

Respuesta desde 192.168.88.1: bytes=32 tiempo=2ms TTL=64
Respuesta desde 192.168.88.214: bytes=32 tiempo=2ms TTL=64
Respuesta desde 192.168.88.229: bytes=32 tiempo<1m TTL=128

PS C:\>

Escaneo de puertos TCP

Para probar si un puerto TCP está abierto, podemos usar el cmdlet Test-NetConnection

PS C:\> foreach ($ip in 1..254) {Test-NetConnection -Port 80 -InformationLevel "Detailed" 192.168.88.$ip}



ComputerName            : 192.168.88.1
RemoteAddress           : 192.168.88.1
RemotePort              : 80
NameResolutionResults   : 192.168.88.1
MatchingIPsecRules      :
NetworkIsolationContext : Private Network
InterfaceAlias          : vEthernet (Ether-wifi)
SourceAddress           : 192.168.88.229
NetRoute (NextHop)      : 0.0.0.0
TcpTestSucceeded        : True


ADVERTENCIA: TCP connect to (192.168.88.2 : 80) failed
ADVERTENCIA: Ping to 192.168.88.2 failed with status: TimedOut

ComputerName            : 192.168.88.2
RemoteAddress           : 192.168.88.2
RemotePort              : 80
NameResolutionResults   : 192.168.88.2
MatchingIPsecRules      :
NetworkIsolationContext : Private Network
InterfaceAlias          : vEthernet (Ether-wifi)
SourceAddress           : 192.168.88.229
NetRoute (NextHop)      : 0.0.0.0
PingSucceeded           : False
PingReplyDetails (RTT)  : 0 ms
TcpTestSucceeded        : False


El comando anterior arroja resultados muy verbose para mi gusto, la siguiente alternativa facilita probar un rango de puertos y da como resultado una salida mas limpia:

PS C:\> 1..1024 | % { echo ((new-object Net.Sockets.TcpClient).Connect("192.168.61.1",$_)) "$_ is open" } 2>$null
22 is open
80 is open
443 is open
PS C:\>

Eso es todo. En una próxima entrada analizaremos opciones para probar puertos UDP con PowerShell.

domingo, 7 de abril de 2019

Preparación para el examen AZ-500: Sesiones de Ignite

Recientemente se lanzó el examen beta AZ-500: Microsoft Azure Security Engineer, siendo el único necesario para obtener la certificación Microsoft Certified: Azure Security Engineer Associate. De momento no hay una guía de preparación oficial, por lo cual lo que voy a apoyarme exclusivamente en la documentación de Microsoft y en Sesiones de Ignite y Microsoft Mechanics.

Si quieres tomar este exámen beta, puedes conseguir un voucher con un 80% de descuento en este post de Microsoft Learning Blog.

A continuación, una lista de las sesiones de Ignite que estoy usando como preparación para este examen.

Azure Essentials: Defense in depth security



Azure Security Center | Azure Friday



Azure security & management - BRK2021



Azure Security fundamentals: Protecting infrastructure apps and data in the cloud - BRK2395



Built-in not bolted on - securing your Azure resources in practice - THR3064



Governing Azure subscriptions with auditing management groups and policies - BRK3268



Protect server workloads across datacenter and cloud with Azure Security Center and - BRK3235



Protect the keys to your kingdom with Privileged Identity Management - BRK3248



Securing your data with Azure SQL DB : Build 2018



Understanding how Microsoft Information Protection capabilities work together to - BRK3002



Accelerate deployment and adoption of Microsoft Information Protection solutions - BRK3009



Securing your hybrid cloud environments with Azure ATP and AAD Identity Protection - BRK3237



Securing web applications using Web Application Firewall



Securing Azure SQL Database Managed Instance: Overview and best practices - BRK3163



Secure customer identity and access management using Azure Active Directory B2C - BRK3240



Monitoring your networks in Azure - BRK3298



Monitor your infrastructure and analyze operational logs at scale with Azure Monitor - BRK3354



MNA 02/08/2019 - Azure DDoS



Common sense in the world of Azure governance - THR2102




Manage keys secrets and certificates for secure apps and data with Azure Key Vault - BRK3059



Lock down access to Azure using identity - BRK3383



Learn how to protect your data in Azure Storage with new features and capabilities - BRK3340



In the security trenches of Azure SQL Database and Azure SQL Data Warehouse - BRK3149



Identity and secure resource access in App Service and Azure Functions - Matthew Henderson



Granting partners and suppliers access to resources using Azure Active Directory B2B - BRK3249



From the trenches: Hardening your Azure Active Directory tenant - THR2214



Expose APIs with peace of mind when using Azure API Management - BRK2200



Enable Azure Active Directory Conditional Access to secure user access while - BRK3241



Deep dive into Implementing governance at scale through Azure Policy - BRK3085



CYA (covering your assets) with security and threat detection in Azure - BRK2421



Azure Update Inventory and Automation for Linux and Windows VM management - BRK3063



Azure Information Protection and Exchange Online - better together - THR3076



Azure Firewall and Best Practices in building an enterprise-grade DMZ in Azure - BRK4029



Azure Active Directory security insights with Conditional Access Identity Protection - BRK3401



Azure Active Directory best practices from around the world - BRK3408



Attack discovery and investigation with Azure Advanced Threat Protection - THR3037



AKS (Azure Kubernetes Service) Security & Identity updates | Best of Microsoft Ignite 2018



How to delegate administration in Azure AD - BRK3239



Early look at Microsoft Threat Protection