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

 

 


Tema destacado: Recopilación Tutoriales y Manuales Hacking, Seguridad, Privacidad, Hardware, etc


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Introducir valor binario en registro usando VB script
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Introducir valor binario en registro usando VB script  (Leído 6,238 veces)
‭‭‭‭jackl007


Desconectado Desconectado

Mensajes: 1.403


[UserRPL]


Ver Perfil WWW
Introducir valor binario en registro usando VB script
« en: 21 Enero 2008, 19:55 pm »

Aun no consigo modificar un valor en el registro de windows, en el cual pueda introducir un valor ("00 00 00 00" y "01 00 00 00") del tipo "REG_BINARY"
Se que lo puedo lograr con esto, que estuve buscando:
Código
  1. dim Num as Interger
  2. Num = 1 'es el valor que se introducira en forma binaria
  3. Dim WshShell, bKey
  4. Set WshShell = CreateObject("WScript.Shell")
  5. WshShell.RegWrite "HKEY_CURRENT_USER\SOFTWARE\...\llave", Num, "REG_BINARY"
  6.  

pero el problema es que no consigo dar con el valor que me de: "00 00 00 00" y "01 00 00 00".

He usado un traductor de binario: http://www.guardaqua.it/risorse/binario.php
y alli si coloco: "01 00 00 00";
me dice que pertenece a "@" (no es entero :S)

¿Como lo logro?
imagen de lo que quiero llegar a hacer:


En línea

Mad Antrax
Colaborador
***
Desconectado Desconectado

Mensajes: 2.164


Cheats y Trainers para todos!


Ver Perfil WWW
Re: Introducir valor binario en registro usando VB script
« Respuesta #1 en: 21 Enero 2008, 21:28 pm »

Código
  1. Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
  2. Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
  3. Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
  4. Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
  5. Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As String, lpcbData As Long) As Long
  6. Declare Function RegQueryValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByRef lpData As Long, lpcbData As Long) As Long
  7. Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
  8. Declare Function RegSetValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Long, ByVal cbData As Long) As Long
  9. Declare Function RegSetValueExB Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Byte, ByVal cbData As Long) As Long
  10.  
  11. Const ERROR_SUCCESS = 0&
  12. Const ERROR_BADDB = 1009&
  13. Const ERROR_BADKEY = 1010&
  14. Const ERROR_CANTOPEN = 1011&
  15. Const ERROR_CANTREAD = 1012&
  16. Const ERROR_CANTWRITE = 1013&
  17. Const ERROR_OUTOFMEMORY = 14&
  18. Const ERROR_INVALID_PARAMETER = 87&
  19. Const ERROR_ACCESS_DENIED = 5&
  20. Const ERROR_NO_MORE_ITEMS = 259&
  21. Const ERROR_MORE_DATA = 234&
  22.  
  23. Const REG_NONE = 0&
  24. Const REG_SZ = 1&
  25. Const REG_EXPAND_SZ = 2&
  26. Const REG_BINARY = 3&
  27. Const REG_DWORD = 4&
  28. Const REG_DWORD_LITTLE_ENDIAN = 4&
  29. Const REG_DWORD_BIG_ENDIAN = 5&
  30. Const REG_LINK = 6&
  31. Const REG_MULTI_SZ = 7&
  32. Const REG_RESOURCE_LIST = 8&
  33. Const REG_FULL_RESOURCE_DESCRIPTOR = 9&
  34. Const REG_RESOURCE_REQUIREMENTS_LIST = 10&
  35.  
  36. Const KEY_QUERY_VALUE = &H1&
  37. Const KEY_SET_VALUE = &H2&
  38. Const KEY_CREATE_SUB_KEY = &H4&
  39. Const KEY_ENUMERATE_SUB_KEYS = &H8&
  40. Const KEY_NOTIFY = &H10&
  41. Const KEY_CREATE_LINK = &H20&
  42. Const READ_CONTROL = &H20000
  43. Const WRITE_DAC = &H40000
  44. Const WRITE_OWNER = &H80000
  45. Const SYNCHRONIZE = &H100000
  46. Const STANDARD_RIGHTS_REQUIRED = &HF0000
  47. Const STANDARD_RIGHTS_READ = READ_CONTROL
  48. Const STANDARD_RIGHTS_WRITE = READ_CONTROL
  49. Const STANDARD_RIGHTS_EXECUTE = READ_CONTROL
  50. Const KEY_READ = STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY
  51. Const KEY_WRITE = STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY
  52. Const KEY_EXECUTE = KEY_READ
  53.  
  54. Dim hKey As Long, MainKeyHandle As Long
  55.  
  56. Function SetBinaryValue(SubKey As String, Entry As String, Value As String)
  57. Dim i
  58. Call ParseKey(SubKey, MainKeyHandle)
  59.  
  60. If MainKeyHandle Then
  61.   rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_WRITE, hKey) 'open the key
  62.   If rtn = ERROR_SUCCESS Then 'if the key was open successfully then
  63.      lDataSize = Len(Value)
  64.      ReDim ByteArray(lDataSize)
  65.      For i = 1 To lDataSize
  66.      ByteArray(i) = Asc(Mid$(Value, i, 1))
  67.      Next
  68.      rtn = RegSetValueExB(hKey, Entry, 0, REG_BINARY, ByteArray(1), lDataSize) 'write the value
  69.      If Not rtn = ERROR_SUCCESS Then   'if the was an error writting the value
  70.         If DisplayErrorMsg = True Then 'if the user want errors displayed
  71.            'MsgBox ErrorMsg(rtn)        'display the error
  72.         End If
  73.      End If
  74.      rtn = RegCloseKey(hKey) 'close the key
  75.   Else 'if there was an error opening the key
  76.      If DisplayErrorMsg = True Then 'if the user wants errors displayed
  77.         'MsgBox ErrorMsg(rtn) 'display the error
  78.      End If
  79.   End If
  80. End If

El código, por supuesto, no lo he escrito yo. Lo saqué del source de un server del troyano Black Dream, no lo he probado pero tiene que funcionar, llamas a la función con estos parametros y listos, analiza el código si tienes dudas, saludos!!

SetBinaryValue(SubKey As String, Entry As String, Value As String)


En línea

No hago hacks/cheats para juegos Online.
Tampoco ayudo a nadie a realizar hacks/cheats para juegos Online.
‭‭‭‭jackl007


Desconectado Desconectado

Mensajes: 1.403


[UserRPL]


Ver Perfil WWW
Re: Introducir valor binario en registro usando VB script
« Respuesta #2 en: 21 Enero 2008, 21:36 pm »

hay cosas que van en el modulo, y hay una funcion que falta:
Call ParseKey
la puedes postear Mad?
En línea

‭‭‭‭jackl007


Desconectado Desconectado

Mensajes: 1.403


[UserRPL]


Ver Perfil WWW
Re: Introducir valor binario en registro usando VB script
« Respuesta #3 en: 21 Enero 2008, 21:43 pm »

Para Mad: (supongo que leiste el privado)
Luego de que encuentre la manera de hacer esto; te mando el source completo para que lo implementes a tu kick msn; y creo que es mejor que no subas el source del nuevo (si es q lo haces) para evitar copy & paste; y se queden con la duda de como lo hacen ...
aunq lo he probado (haciendolo manualmnte) en el windows live msn 8; nose si servira para los otras versiones del msn; pero en caso de que no funcione asi ...
pues ya se como encontrarla y se podria implementarla tambien :D
En línea

Mad Antrax
Colaborador
***
Desconectado Desconectado

Mensajes: 2.164


Cheats y Trainers para todos!


Ver Perfil WWW
Re: Introducir valor binario en registro usando VB script
« Respuesta #4 en: 21 Enero 2008, 22:18 pm »

Código
  1. Private Sub ParseKey(KeyName As String, Keyhandle As Long)
  2.  
  3. rtn = InStr(KeyName, "\") 'return if "\" is contained in the Keyname
  4.  
  5. If Left(KeyName, 5) <> "HKEY_" Or Right(KeyName, 1) = "\" Then 'if the is a "\" at the end of the Keyname then
  6.   'MsgBox "Incorrect Format:" + Chr(10) + Chr(10) + KeyName 'display error to the user
  7.   Exit Sub 'exit the procedure
  8. ElseIf rtn = 0 Then 'if the Keyname contains no "\"
  9.   Keyhandle = GetMainKeyHandle(KeyName)
  10.   KeyName = "" 'leave Keyname blank
  11. Else 'otherwise, Keyname contains "\"
  12.   Keyhandle = GetMainKeyHandle(Left(KeyName, rtn - 1)) 'seperate the Keyname
  13.   KeyName = Right(KeyName, Len(KeyName) - rtn)
  14. End If
  15.  
  16. End Sub
  17.  
  18. Function GetMainKeyHandle(MainKeyName As String) As Long
  19.  
  20. Const HKEY_CLASSES_ROOT = &H80000000
  21. Const HKEY_CURRENT_USER = &H80000001
  22. Const HKEY_LOCAL_MACHINE = &H80000002
  23. Const HKEY_USERS = &H80000003
  24. Const HKEY_PERFORMANCE_DATA = &H80000004
  25. Const HKEY_CURRENT_CONFIG = &H80000005
  26. Const HKEY_DYN_DATA = &H80000006
  27.  
  28. Select Case MainKeyName
  29.       Case "HKEY_CLASSES_ROOT"
  30.            GetMainKeyHandle = HKEY_CLASSES_ROOT
  31.       Case "HKEY_CURRENT_USER"
  32.            GetMainKeyHandle = HKEY_CURRENT_USER
  33.       Case "HKEY_LOCAL_MACHINE"
  34.            GetMainKeyHandle = HKEY_LOCAL_MACHINE
  35.       Case "HKEY_USERS"
  36.            GetMainKeyHandle = HKEY_USERS
  37.       Case "HKEY_PERFORMANCE_DATA"
  38.            GetMainKeyHandle = HKEY_PERFORMANCE_DATA
  39.       Case "HKEY_CURRENT_CONFIG"
  40.            GetMainKeyHandle = HKEY_CURRENT_CONFIG
  41.       Case "HKEY_DYN_DATA"
  42.            GetMainKeyHandle = HKEY_DYN_DATA
  43. End Select
  44.  
  45. End Function
  46.  
  47.  

Aqui está la PerseKey, y más abajo te dejo otros metodos para trabajar con el registro:

Código
  1. Function SetDWORDValue(SubKey As String, Entry As String, Value As Long)
  2.  
  3. Call ParseKey(SubKey, MainKeyHandle)
  4.  
  5. If MainKeyHandle Then
  6.   rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_WRITE, hKey) 'open the key
  7.   If rtn = ERROR_SUCCESS Then
  8.      rtn = RegSetValueExA(hKey, Entry, 0, REG_DWORD, Value, 4)
  9.      If Not rtn = ERROR_SUCCESS Then
  10.         If DisplayErrorMsg = True Then
  11.            'MsgBox ErrorMsg(rtn)
  12.         End If
  13.      End If
  14.      rtn = RegCloseKey(hKey) 'close the key
  15.   Else 'if there was an error opening the key
  16.      If DisplayErrorMsg = True Then 'if the user want errors displayed
  17.         'MsgBox ErrorMsg(rtn) 'display the error
  18.      End If
  19.   End If
  20. End If
  21.  
  22. End Function
  23.  
  24. Function SetBinaryValue(SubKey As String, Entry As String, Value As String)
  25. Dim i
  26. Call ParseKey(SubKey, MainKeyHandle)
  27.  
  28. If MainKeyHandle Then
  29.   rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_WRITE, hKey) 'open the key
  30.   If rtn = ERROR_SUCCESS Then 'if the key was open successfully then
  31.      lDataSize = Len(Value)
  32.      ReDim ByteArray(lDataSize)
  33.      For i = 1 To lDataSize
  34.      ByteArray(i) = Asc(Mid$(Value, i, 1))
  35.      Next
  36.      rtn = RegSetValueExB(hKey, Entry, 0, REG_BINARY, ByteArray(1), lDataSize) 'write the value
  37.      If Not rtn = ERROR_SUCCESS Then   'if the was an error writting the value
  38.         If DisplayErrorMsg = True Then 'if the user want errors displayed
  39.            'MsgBox ErrorMsg(rtn)        'display the error
  40.         End If
  41.      End If
  42.      rtn = RegCloseKey(hKey) 'close the key
  43.   Else 'if there was an error opening the key
  44.      If DisplayErrorMsg = True Then 'if the user wants errors displayed
  45.         'MsgBox ErrorMsg(rtn) 'display the error
  46.      End If
  47.   End If
  48. End If
  49.  
  50. End Function
  51.  
  52. Function CreateKey(SubKey As String)
  53.  
  54. Call ParseKey(SubKey, MainKeyHandle)
  55.  
  56. If MainKeyHandle Then
  57.   rtn = RegCreateKey(MainKeyHandle, SubKey, hKey) 'create the key
  58.   If rtn = ERROR_SUCCESS Then 'if the key was created then
  59.      rtn = RegCloseKey(hKey)  'close the key
  60.   End If
  61. End If

espero que ahora te sirva
« Última modificación: 21 Enero 2008, 22:20 pm por ||MadAntrax|| » En línea

No hago hacks/cheats para juegos Online.
Tampoco ayudo a nadie a realizar hacks/cheats para juegos Online.
‭‭‭‭jackl007


Desconectado Desconectado

Mensajes: 1.403


[UserRPL]


Ver Perfil WWW
Re: Introducir valor binario en registro usando VB script
« Respuesta #5 en: 22 Enero 2008, 00:06 am »

Gracias, pero no consigo lograr eso ...
Seguire buscando ...
En línea

‭‭‭‭jackl007


Desconectado Desconectado

Mensajes: 1.403


[UserRPL]


Ver Perfil WWW
Re: Introducir valor binario en registro usando VB script
« Respuesta #6 en: 24 Enero 2008, 01:07 am »

bueno ya lo solucione :D
lo que estaba haciendo al principio esta bien para lo que necsito :D
Gracias igualmnte Mad!
En línea

Zaraki_lkenpachi

Desconectado Desconectado

Mensajes: 54



Ver Perfil
Re: Introducir valor binario en registro usando VB script
« Respuesta #7 en: 19 Julio 2008, 21:08 pm »

hola amigos queria preguntarles en donde hay informacion sobre esas librerias que usan en Visual Basic soy nuevo en esto pero la estoy aprendiendo pero lo que no entiendo es eso de

Código
  1. Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
  2. Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
  3. Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
  4. Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
  5. Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As String, lpcbData As Long) As Long
  6. Declare Function RegQueryValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByRef lpData As Long, lpcbData As Long) As Long
  7. Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
  8. Declare Function RegSetValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Long, ByVal cbData As Long) As Long
  9. Declare Function RegSetValueExB Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Byte, ByVal cbData As Long) As Long
  10.  
  11. [/quote]
  12.  
  13. pues de donde sacan esas librerias algo de informacion es lo que quiero por ejemplo
  14.  
  15. advapi32.dll ... que funciones me brinda o que cosa ??
  16. :o
  17.  
En línea


Lambda


Desconectado Desconectado

Mensajes: 371



Ver Perfil WWW
Re: Introducir valor binario en registro usando VB script
« Respuesta #8 en: 19 Julio 2008, 21:44 pm »

en la MSDN esta todo

http://msdn.microsoft.com/en-us/library/ms724897(VS.85).aspx
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines