Escaner de puertos By Aleks
Dejo otra aplicación para el Windows CUH el.hacker.com Edition, por el momento es algo que esta en fase de prueba, es un Escaner de puertos, y aun hay muchas cosas por mejorar:
El Formulario:
Option Explicit
Private Sub Cerrar_Click()
MsgBox "Made By Aleks 2008 GPL License", vbInformation
End
End Sub
Private Sub GrabaBannerActivo_Click()
If GrabaBannerPasivo.Value = 1 Then
GrabaBannerPasivo.Value = 0
End If
End Sub
Private Sub GrabaBannerPasivo_Click()
If GrabaBannerActivo.Value = 1 Then
GrabaBannerActivo.Value = 0
End If
End Sub
Private Sub Escanear_Click()
Dim Socket As Variant
Dim CurrentPort As Integer
Dim i As Integer
Dim MaxSockets As Integer
Dim List As ListItem
'Es Necesario que durante un escaneo el marco no esta cargado
On Error Resume Next
'Activa el Boton Parar
Escanear.Enabled = False
Parar.Enabled = True
'Necesitamos una Forma de Arrancar/Parar , para ello
'usaremos el estado del boton como referencia
If Parar.Enabled = True Then
'Limpia el ultimo resultado
lsvResultado.ListItems.Clear
'Resetea la barra de progreso a ceros
pbrScanStatus.Value = 0
'Blockea las cajas de texto vacias
TxtDestino.Enabled = False
txtMaxSockets.Enabled = False
PuertoInicial.Enabled = False
PuertoFinal.Enabled = False
'Lee el maximo de sockets
MaxSockets = txtMaxSockets.Text
' Carga los sockets a usa
For i = 1 To MaxSockets
'Carga una nueva instancia del socket i
Load wskTCPWinsock(i)
Next i
CurrentPort = PuertoInicial.Text
' De nuevo usamos el boton command1.caption como referencia para
' Arrancar / Parar
While Parar.Enabled = True
For Each Socket In wskTCPWinsock
' Defiitivamente necesita esto para que el sistema o se congele
DoEvents
' Checa si el socket esta intentando conectarse
' O si esta conectado
If Socket.State <> sckClosed Then
' Incrementa el Puerto
GoTo continue
End If
' Cierra el socket, para mayor seguridad
Socket.Close
' Si se llega hasta aca
' esta listo para probar
' el proximo puerto, solo despues
' de checar si hemos puesto
' el rangoa escanear
' y si el usuario no clica Parar
If CurrentPort = Val(PuertoFinal.Text) + 1 Then
lblScanStatus.Caption = "Escaneo Finalizado"
'Bloquea los campos de texto vacios
TxtDestino.Enabled = True
txtMaxSockets.Enabled = True
PuertoInicial.Enabled = True
PuertoFinal.Enabled = True
Escanear.Enabled = True
Parar.Enabled = False
Exit For
End If
'Pone el host
Socket.RemoteHost = TxtDestino.Text
' Pone el port
Socket.RemotePort = CurrentPort
lblScanStatus.Caption = "Escaneando Puerto " & CurrentPort
pbrScanStatus.Value = pbrScanStatus.Value + _
((PuertoFinal.Text - PuertoInicial.Text) / 100)
' Intenta conectarse
Socket.Connect
' Aqui, el socket hará una de dos cosas:
' 1) Si el puerto esta abierto se conecta
' 2) Si el puerto esta cerrado muestra errot
' Inecrementa el puerto actual
CurrentPort = CurrentPort + 1
' Si el socket no esta listo
continue:
' Va a la sigiente instancia del socket
Next Socket
Wend
Else ' el boton command1.caption es "Parar"
lblScanStatus.Caption = "Scan aborded"
'Bloquea los campos de texto vacios
TxtDestino.Enabled = True
txtMaxSockets.Enabled = True
PuertoInicial.Enabled = True
PuertoFinal.Enabled = True
End If
' Cierra todos los sockets y salva en memoria
For i = 1 To MaxSockets
Unload wskTCPWinsock(i)
Next i
End Sub
Private Function AddPortToList(Port As Integer, Optional Banner As String)
'--------------------------------------------
'* Esta Funcion Añade el Puerto a la lista **
'--------------------------------------------
Dim List As ListItem
Set List = lsvResultado.ListItems.Add(, , Time)
List.SubItems(1) = Port
List.SubItems(2) = "open"
List.SubItems(3) = Banner
LVColumnWidth lsvResultado
End Function
Private Sub Parar_Click()
Escanear.Enabled = True
Parar.Enabled = False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Set Interfaz = Nothing
End Sub
Private Sub wskTCPWinsock_Connect(Index As Integer)
' Puerto abierto, informa al usuario
AddPortToList wskTCPWinsock(Index).RemotePort
'Cierra el puerto si la opcion de grabar es seleccionada
If GrabaBannerPasivo.Value = 0 Then
wskTCPWinsock(Index).Close
ElseIf GrabaBannerActivo.Value = 0 Then
wskTCPWinsock(Index).Close
End If
End Sub
Private Sub wskTCPWinsock_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim DataStr As String
Dim i As Integer
If GrabaBannerPasivo.Value = 1 Then
'Lee el dato entrante y lo escribe en DataStr$
Call wskTCPWinsock(Index).GetData(DataStr$, vbString)
'Desactiva todas las ventanas relacionadas con el plugin
For i = 1 To lsvResultado.ListItems.Count
If lsvResultado.ListItems.Item(i).SubItems(1) = _
wskTCPWinsock(Index).RemotePort Then
lsvResultado.ListItems.Remove (lsvResultado.ListItems(i).Index)
End If
Next i
AddPortToList wskTCPWinsock(Index).RemotePort, DataStr
ElseIf GrabaBannerActivo.Value = 1 Then
wskTCPWinsock(Index).SendData (vbCrLf & vbCrLf)
'Lee el dato entrante y lo escribe en DataStr$
Call wskTCPWinsock(Index).GetData(DataStr$, vbString)
'Desactiva todas las ventanas relacionadas con el plugin
For i = 1 To lsvResultado.ListItems.Count
If lsvResultado.ListItems.Item(i).SubItems(1) = _
wskTCPWinsock(Index).RemotePort Then
lsvResultado.ListItems.Remove (lsvResultado.ListItems(i).Index)
End If
Next i
AddPortToList wskTCPWinsock(Index).RemotePort, DataStr
Else
'Cierra la conexion si la opcion de grabar es seleccionada
wskTCPWinsock(Index).Close
End If
End Sub
Private Sub wskTCPWinsock_Error(Index As Integer, ByVal Number As Integer, _
Description As String, ByVal Scode As Long, ByVal Source As String, _
ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
' Cierra el puerto, cierra el socket que se incrementará
wskTCPWinsock(Index).Close
End Sub
El Modulo:
Option Explicit
Private Const LVM_SETCOLUMNWIDTH As Integer = &H1000 + 30
Private Const LVSCW_AUTOSIZE As Integer = -1
Private Const LVSCW_AUTOSIZE_USEHEADER As Integer = -2
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
'Pone el ancho de las columnas del list view
Public Sub LVColumnWidth(oListView As MSComctlLib.ListView, _
Optional AccountForHeaders As Boolean = False)
Dim col As Long
Dim LParm As Long
On Error GoTo error
If AccountForHeaders Then
LParm = LVSCW_AUTOSIZE_USEHEADER
Else
LParm = LVSCW_AUTOSIZE
End If
For col = 0 To oListView.ColumnHeaders.Count - 1
SendMessage oListView.hwnd, LVM_SETCOLUMNWIDTH, _
col, ByVal LParm
Next col
error:
End Sub
Source Code:Para ver los enlaces debes ser usuario
Crear Usuario o
Hacer SesionEjecutable1, no se puede mover, ya que tiene el form tiene la propiedad BorderStyle=None:
Para ver los enlaces debes ser usuario
Crear Usuario o
Hacer SesionEjecutable2, BorderStyle=2-Sizable
Para ver los enlaces debes ser usuario
Crear Usuario o
Hacer SesionPD. Se me olvido el Control MSWINSCK.OCX, lo anexo entonces, para los que no lo tengan, ya que sin este no funciona el programa. ademas he de decir que lo anexo como comprimido, por que esta en lista negra,

.
MSWINSCK.zip --> MSWINSCK.OCX
Para ver los enlaces debes ser usuario
Crear Usuario o
Hacer Sesion