Ayuda Scanner de Puertos!

Iniciado por LaMBo, 20 Febrero 2004, 18:02 PM

0 Miembros y 1 Visitante están viendo este tema.

LaMBo

Hola amigos, a ver si pueden ayudarme...
Veran, resulta que estoy terminando un escaner de puertos remotos.

Este escaner realiza todo correctamente, pero es un escaner de puertos locales,
quisiera hacerlo para puertos remotos, que conecte por IP (Usando Winsock).
Este escaner sirve de mucho, analiza los puertos que los troyanos suelen abrir y nos dá el nombre del troyano.

         
        Este proyecto no está pensado para buscar victimas infectadas por troyanos,
        aunque en manos de muchos lammers, puede ser beneficioso...


        AYUDENME! Gracias anticipadas...


Aki va el code general...(CHEQUEENLO SI PUEDEN Y DIGANME EL ERROR)


---------------------------------------------------------



Private Sub btnComenzar_Click()

Dim X As Long
Dim RutaTroyano As String
Dim IndexIcono As Integer
Dim DescribeTroyano As String

Static Desde As Long
Static Hasta As Long

RutaTroyano = App.Path & "\Trojans.ini"


   If btnComenzar.Caption = "Comenzar" Then
       
       If Not IsNumeric(txtHasta) Or Val(txtHasta) > 65000 Then
           MsgBox "Error en el puerto", vbCritical, "Error"
           txtHasta.SetFocus
           txtHasta.SelStart = 0
           txtHasta.SelLength = Len(txtHasta)
           Exit Sub
       End If
       If Not IsNumeric(txtDesde) Or Val(txtDesde) > 65000 Then
           MsgBox "Error en el puerto", vbCritical, "Error"
           txtDesde.SetFocus
           txtDesde.SelStart = 0
           txtDesde.SelLength = Len(txtDesde)
           Exit Sub
       End If
       If Val(txtDesde) >= Val(txtHasta) Then
           MsgBox "El puerto final tiene que ser mayor que el inicial", vbExclamation, "Error"
           Exit Sub
       End If
       
       btnComenzar.Caption = "Pausar"
       Salir = False
       Desde = txtDesde.Text
       Hasta = txtHasta.Text
       Arbolito.Nodes.Clear
       BarraDeProgreso.Min = Desde
       BarraDeProgreso.Max = Hasta
       
   ElseIf btnComenzar.Caption = "Pausar" Then
       Salir = True
       btnComenzar.Caption = "Continuar"
 
   Else
       btnComenzar.Caption = "Pausar"
       Salir = False
   End If


   For X = Desde To Hasta
       
       BarraDeProgreso.Value = X
       
       If Salir Then
           Desde = X
           Exit Sub
       End If
   
       StatusBar1.SimpleText = "[Escaneando puerto " & X & "]"
       On Error GoTo PuertoAbierto
       DoEvents
       Socket.LocalPort = X
       Socket.Listen
       Socket.Close
       
   Next


PuertoAbierto:
   
   If X >= Hasta Then
   btnComenzar.Caption = "Comenzar"
   Exit Sub
   End If
   
   Dim Nodo As Node
   Set Nodo = Arbolito.Nodes.Add(, , "Port" & X, "Puerto abierto: " & X, 1)
   Arbolito.Nodes("Port" & X).Bold = True
           
   DescribeTroyano = sGetINI(RutaTroyano, "Troyanos", Str(X), "Desconocido")
       
       If DescribeTroyano <> "Desconocido" And CheckTroyanos.Value Then
       txtTotalTroyanos = Val(txtTotalTroyanos) + 1
       Set Nodo = Arbolito.Nodes.Add("Port" & X, tvwChild, "Child2" & X, "Posible Troyano: " & DescribeTroyano, 9)
       Arbolito.Nodes("Child2" & X).ForeColor = &HFF&
   End If
Resume Next
       
End Sub