Ir a contenido


MENSAJE DE BIENVENIDA Foro vínculado con Twitter, más info aquí.

“El secreto para progresar es empezar por algún lugar. El secreto para empezar por algún lugar es fragmentar tus complejas y abrumadoras tareas de tal manera que queden convertidas en pequeñas tareas que puedas realizar y entonces simplemente comenzar por la primera.” - Mark Twain

Foto

Comprobar Puertos AD con PortQry


  • Please log in to reply
No replies to this topic

#1 Alberto Dominguez

Alberto Dominguez

    Gurú

  • Administradores
  • 1.059 Mensajes:
  • LocationMadrid

Escrito 27 noviembre 2013 - 12:25

Dejo script para comprobar algunos puertos de AD, necesita tener en la misma carpeta portqry:

'****************************************************************************************
'*   Programa: ComprobacionPuertosDA.vbs 				                *
'*   Descripcion: Script que comprueba conectividad con PortQry  de los puertos de DA.  *
'*                                                      				*
'*   Autor:  Alberto Dominguez                                                          *
'****************************************************************************************


'***************************
'*   Constantes            *
'***************************

Const ESCRITURA = 2                   

'***************************
'*   Variables             *
'***************************

Dim oWSH : Set oWSH = CreateObject( "WScript.Shell" )
Dim t, objFSO, objFichero
Set objFSO = CreateObject("scripting.filesystemobject")
Dim arrPuertosTCP(4)
Dim arrPuertosUDP(0)
Dim arrPuertosAnalizados()
Dim nombreFicheroPuertosFallando
Dim wshNetwork, computerName


'***************************
'*   Programa Principal    *
'***************************

Set wshNetwork = CreateObject("WScript.Network")
computerName = wshNetwork.ComputerName


arrPuertosTCP(0) = "389" 
arrPuertosTCP(1) = "636"
arrPuertosTCP(2) = "3268"
arrPuertosTCP(3) = "135"
arrPuertosTCP(4) = "53"
arrPuertosUDP(0) = "123"

servidor=WScript.Arguments.Unnamed(0)

WScript.Echo "Comprobando puertos... "
WScript.Echo

t=0
For Each puerto in arrPuertosTCP
  
  'Se necesita tener ubicada la aplicacion PortQry en el server desde el que se lance este script.
    
  nRet = oWSH.Run( "PortQry.exe -n " & servidor & " -p tcp -e " & puerto, 0, True )
  If (nRet = 0) Then
    ReDim Preserve arrPuertosAnalizados(t)
    arrPuertosAnalizados(t) = "OK (LISTENING): Puerto "&puerto&" TCP desde "& computerName &" hacia "& servidor
    WScript.Echo "OK (LISTENING): Puerto "&puerto&" TCP desde "& computerName &" hacia "& servidor
    t = t + 1
  ElseIf (nRet =2) Then
    ReDim Preserve arrPuertosAnalizados(t)
    arrPuertosAnalizados(t) = "OK (LISTENING OR FILTERED): Puerto "&puerto&" TCP desde "& computerName &" hacia "& servidor
    WScript.Echo "OK (LISTENING OR FILTERED): Puerto "&puerto&" TCP desde "& computerName &" hacia "& servidor
    t = t + 1
  ElseIf (nRet =1) Then
    ReDim Preserve arrPuertosAnalizados(t)
    arrPuertosAnalizados(t) = "FALLO (NOT LISTENING): Puerto "&puerto&" TCP desde "& computerName &" hacia "& servidor
    WScript.Echo "FALLO (NOT LISTENING): Puerto "&puerto&" TCP desde "& computerName &" hacia "& servidor
    t = t + 1
  Else
    ReDim Preserve arrPuertosAnalizados(t)
    arrPuertosAnalizados(t) = "INDETERMINADO: Puerto "&puerto&" TCP desde "& computerName &" hacia "& servidor
    WScript.Echo "INDETERMINADO: Puerto "&puerto&" TCP desde "& computerName &" hacia "& servidor
    t = t + 1
  End If 
Next

For Each puerto in arrPuertosUDP
  
  'Se necesita tener ubicada la aplicacion PortQry en el server desde el que se lance este script.
    
  nRet = oWSH.Run( "PortQry.exe -n " & servidor & " -p udp -e " & puerto, 0, True )
  If (nRet = 0) Then
    ReDim Preserve arrPuertosAnalizados(t)
    arrPuertosAnalizados(t) = "OK (LISTENING): Puerto "&puerto&" UDP desde "& computerName &" hacia "& servidor
    WScript.Echo "OK (LISTENING): Puerto "&puerto&" UDP desde "& computerName &" hacia "& servidor
    t = t + 1
  ElseIf (nRet =2) Then
    ReDim Preserve arrPuertosAnalizados(t)
    arrPuertosAnalizados(t) = "OK (LISTENING OR FILTERED): Puerto "&puerto&" UDP desde "& computerName &" hacia "& servidor
    WScript.Echo "OK (LISTENING OR FILTERED): Puerto "&puerto&" UDP desde "& computerName &" hacia "& servidor
    t = t + 1
  ElseIf (nRet =1) Then
    ReDim Preserve arrPuertosAnalizados(t)
    arrPuertosAnalizados(t) = "FALLO (NOT LISTENING): Puerto "&puerto&" UDP desde "& computerName &" hacia "& servidor
    WScript.Echo "FALLO (NOT LISTENING): Puerto "&puerto&" UDP desde "& computerName &" hacia "& servidor
    t = t + 1
  Else
    ReDim Preserve arrPuertosAnalizados(t)
    arrPuertosAnalizados(t) = "INDETERMINADO: Puerto "&puerto&" UDP desde "& computerName &" hacia "& servidor
    WScript.Echo "INDETERMINADO: Puerto "&puerto&" UDP desde "& computerName &" hacia "& servidor
    t = t + 1
  End If 
Next

nombreFicheroPuertosFallando="Analisis_Puertos_Desde_"&computerName&"_Hacia_"&servidor&".txt"

Set objFichero = objFSO.opentextfile(nombreFicheroPuertosFallando, ESCRITURA, True)
For Each puerto in arrPuertosAnalizados
  objFichero.WriteLine(puerto)
Next
objFichero.Close  
	
WScript.Quit

Saludos,

Alberto Dominguez

Enterprise Architect y Trainer
MCT, MCPD, MCITP, MCITP Dynamics, MCSE, MCSA, MCTS, MCP...
ITIL V3 Foundation Qualification in IT Service Management
Imagen enviadaPerfil Profesional Imagen enviadaTwitter
Imagen enviadaImagen enviadaImagen enviadaImagen enviada

#2 porsercok

porsercok

    Experto

  • Miembros
  • PipPipPipPip
  • 442 Mensajes:
  • LocationParis

Escrito 12 julio 2017 - 21:39

Change Laga Madhoshi Ka Sama Mp3 Song Download

Blue Exorcist
IOBit Game Booster 3 5 beta exe


The Path

Подробнее...
Download
NBA 16 17 RS Minnesota Cleveland 720p 60f 2017 02 01.
The Leftovers HDTV 720p AC3 5.1
Polisiye Suc filmleri izle



El Hombre Hormiga (Ant-Man)

Download
Боевик
101 - 150


Peggy Cummins

Naruto Shippuden – The Last Dublado
Timeflies Say Something Mp3
http://nitroflare.com/view/ 09D8C407EA24778 / 09edg.ZESV1.4.4.DVD.R.tut2u.part4.rar

#3 porsercok

porsercok

    Experto

  • Miembros
  • PipPipPipPip
  • 442 Mensajes:
  • LocationParis

Escrito 17 julio 2017 - 22:47

Royal Navy At War And Peace 1967-1972 2006 DVDRip x264-FiCO[1337x][SN]

Documentario
Queens Blade
Skazani na sukces PDF do pobrania


Gilmore Girls: A Year in the Life (TV Series 2016)

Tyrant (season 3)
Valerian and the City of a Thousand Planets (2017)
The Real Ghostbusters
DJ Khaled ft. Justin Bieber "I'm the One" PARODY



Kaufberatung

Mars Needs Moms! (2011) Marte necesita mamas (madres)
Hora de Aventura
12 Oz Mouse


9 Found Footage Films

Humiliated Hotel Maid
Lirik Lagu Api Naitiri Wae
Supersonic


Mythological

Disclaimer
El jugador de ajedrez Torrent El jugador de ajedrez Torrent
2016 8.0 Sully 2016 BLURAY 480P 381MB 5 Dec - by bliztcinema - 0 - In Biography BLURAY Drama United States
Naruto Stagione 6 Download ITA – (2005)
Solty Rei





0 usuarios están leyendo este tema

0 miembro/s, 0 invitado/s, 0 usuario/s anónimo/s