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

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  [Duda] Registro con password.
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Duda] Registro con password.  (Leído 3,186 veces)
LukaCrosszeria

Desconectado Desconectado

Mensajes: 79


Lets go baby~


Ver Perfil
[Duda] Registro con password.
« en: 22 Octubre 2013, 03:45 am »

Quiero hacer un registro con Password que sencillamente el programa al cliquearle va abrir una ventana donde pedia una contrasenha, pero quiero que esa contrasenha la saque de un archivo TXT o DLL que tendre oculto en windows. Al poner la contrasenha el programa ejecutara otro programa.


Como lo haria?


En línea

Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.813



Ver Perfil
Re: [Duda] Registro con password.
« Respuesta #1 en: 22 Octubre 2013, 08:24 am »

Creo que la época de manejar contraseñas desde archivos de texto ya quedó muy en el pasado :-/

¿No te parece mejor usar el registro?

1. El user escribe por primera vez el password en la UI
2. Escribes ese password en un valor del registro. ("HKCU\Software\Tu Programa" "Pass" "String") y si quieres le metes un sencillo Base64, o algo mucho más compejo.
3. Al siguiente inicio de la aplicación verificas si existe el valor, y lo lees.

Saludos!


En línea

LukaCrosszeria

Desconectado Desconectado

Mensajes: 79


Lets go baby~


Ver Perfil
Re: [Duda] Registro con password.
« Respuesta #2 en: 22 Octubre 2013, 18:36 pm »

Creo que la época de manejar contraseñas desde archivos de texto ya quedó muy en el pasado :-/

¿No te parece mejor usar el registro?

1. El user escribe por primera vez el password en la UI
2. Escribes ese password en un valor del registro. ("HKCU\Software\Tu Programa" "Pass" "String") y si quieres le metes un sencillo Base64, o algo mucho más compejo.
3. Al siguiente inicio de la aplicación verificas si existe el valor, y lo lees.

Saludos!

Saludos.

gracias por la idea pero lo que queria comentar es que no se cual es la sintaxis para crear el registro con password y mucho menos que compare con el registro. Si pudieras darme un ejemplo te lo agradeceria
En línea

Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.813



Ver Perfil
Re: [Duda] Registro con password.
« Respuesta #3 en: 22 Octubre 2013, 19:02 pm »

Este "ayudante" de operaciones de registro lo escribí hace bastante tiempo, el código necesita un repaso para simplificar un poco más el código, pero se puede usar perféctamente, ahi puedes ver ejemplos para crear claves y obtener el valor.

Saludos

Código
  1. #Region " RegEdit "
  2.  
  3. ' [ RegEdit Functions ]
  4. '
  5. ' // By Elektro H@cker
  6. '
  7. ' Examples :
  8. '
  9. ' -----------
  10. ' Create Key:
  11. ' -----------
  12. ' RegEdit.Create_Key("HKCU\Software\MyProgram")                        ' Creates "HKCU\Software\MyProgram"
  13. ' RegEdit.Create_Key("HKEY_CURRENT_USER\Software\MyProgram\Settings\") ' Creates "HKCU\Software\MyProgram\Settings"
  14. '
  15. ' -----------
  16. ' Delete Key:
  17. ' -----------
  18. ' RegEdit.Delete_Key("HKLM\Software\7-zip")                ' Deletes the "7-zip" tree including subkeys
  19. ' RegEdit.Delete_Key("HKEY_LOCAL_MACHINE\Software\7-zip\") ' Deletes the "7-zip" tree including subkeys
  20. '
  21. ' -------------
  22. ' Delete Value:
  23. ' -------------
  24. ' RegEdit.Delete_Value("HKCU\Software\7-Zip", "Lang")               ' Deletes "Lang" Value
  25. ' RegEdit.Delete_Value("HKEY_CURRENT_USER\Software\7-Zip\", "Lang") ' Deletes "Lang" Value
  26. '
  27. ' ----------
  28. ' Get Value:
  29. ' ----------
  30. ' Dim Data As String = RegEdit.Get_Value("HKCU\Software\MyProgram", "Value name"))
  31. ' Dim Data As String = RegEdit.Get_Value("HKEY_CURRENT_USER\Software\MyProgram", "Value name"))
  32. '
  33. ' ----------
  34. ' Set Value:
  35. ' ----------
  36. ' RegEdit.Set_Value("HKCU\Software\MyProgram", "Value name", "Data", Microsoft.Win32.RegistryValueKind.String)               ' Create/Replace "Value Name" with "Data" as string data
  37. ' RegEdit.Set_Value("HKEY_CURRENT_USER\Software\MyProgram\", "Value name", "Data", Microsoft.Win32.RegistryValueKind.String) ' Create/Replace "Value Name" with "Data" as string data
  38. '
  39. ' -----------
  40. ' Export Key:
  41. ' -----------
  42. ' RegEdit.Export_Key("HKLM", "C:\HKLM.reg")                  ' Export entire "HKEY_LOCAL_MACHINE" Tree to "C:\HKLM.reg" file.
  43. ' RegEdit.Export_Key("HKLM\Software\7-zip\", "C:\7-zip.reg") ' Export entire "7-zip" Tree to "C:\7-zip.reg" file.
  44. '
  45. ' ------------
  46. ' Import File:
  47. ' ------------
  48. ' RegEdit.Import_RegFile("C:\Registry_File.reg") ' Install a registry file.
  49. '
  50. ' ------------
  51. ' Jump To Key:
  52. ' ------------
  53. ' RegEdit.Jump_To_Key("HKLM")                               ' Opens Regedit at "HKEY_LOCAL_MACHINE" Root.
  54. ' RegEdit.Jump_To_Key("HKEY_LOCAL_MACHINE\Software\7-zip\") ' Opens Regedit at "HKEY_LOCAL_MACHINE\Software\7-zip" tree.
  55. '
  56. ' -----------
  57. ' Exist Key?:
  58. ' -----------
  59. ' MsgBox(RegEdit.Exist_Key("HKCU\software") ' Checks if "Software" Key exist.
  60.  
  61. ' -------------
  62. ' Exist Value?:
  63. ' -------------
  64. ' MsgBox(RegEdit.Exist_Value("HKLM\software\7-zip", "Path") ' Checks if "Path" value exist.
  65. '
  66. ' ------------
  67. ' Exist Data?:
  68. ' ------------
  69. ' MsgBox(RegEdit.Exist_Data("HKLM\software\7-zip", "Path") ' Checks if "Path" value have empty data.
  70. '
  71. ' ---------
  72. ' Copy Key:
  73. ' ---------
  74. ' RegEdit.Copy_Key("HKCU", "Software", "7-Zip", "HKLM", "Software", "7-zip")          ' Copies "HKCU\Software\7-Zip" to "HKLM\Software\7-Zip"
  75. ' RegEdit.Copy_Key("HKCU", "Software", "7-Zip", Nothing, "Software", "7-zip")         ' Copies "HKCU\Software\7-Zip" to "HKCU\Software\7-Zip"
  76. ' RegEdit.Copy_Key("HKCU", "Software", "7-Zip", "HKLM", "Software", Nothing)          ' Copies "HKCU\Software\7-Zip" to "HKLM\Software\"
  77. ' RegEdit.Copy_Key("HKCU", "Software", "7-Zip", "HKLM", Nothing, Nothing)             ' Copies "HKCU\Software\7-Zip" to "HKLM\"
  78. ' RegEdit.Copy_Key("HKCU", "\Software\", "\7-Zip\", "HKLM", "\Software\", "\7-zip\")  ' Copies "HKCU\Software\7-Zip" to "HKLM\Software\7-Zip"
  79. '
  80. ' -----------
  81. ' Copy Value:
  82. ' -----------
  83. ' RegEdit.Copy_Value("HKLM\software\7-zip", "path", "HKLM\software\7-zip", "path_backup") ' Copies "Path" value with their data to "HKLM\software\7-zip" "path_backup".
  84. '
  85. ' -------------------
  86. ' Set_UserAccess_Key:
  87. ' -------------------
  88. ' RegEdit.Set_UserAccess_Key("HKCU\Software\7-Zip", {RegEdit.RegUserAccess.Administrators_Full_Access})
  89. ' RegEdit.Set_UserAccess_Key("HKEY_CURRENT_USER\Software\7-Zip", {RegEdit.RegUserAccess.Administrators_Full_Access, RegEdit.RegUserAccess.Creator_Full_Access, RegEdit.RegUserAccess.System_Full_Access})
  90.  
  91. #Region " RegEdit Class "
  92.  
  93. Public Class RegEdit
  94.  
  95.    Private Shared RootKey As Microsoft.Win32.RegistryKey = Nothing
  96.    Private Shared KeyPath As String = String.Empty
  97.  
  98.    ''' <summary>
  99.    ''' Create a new registry key.
  100.    ''' </summary>
  101.    Public Shared Function Create_Key(ByVal RegKey As String) As Boolean
  102.  
  103.        RootKey = Get_Root_Key(RegKey)
  104.        KeyPath = Get_Key_Path(RegKey)
  105.  
  106.        Try
  107.            RootKey.CreateSubKey(KeyPath)
  108.            RootKey.Dispose()
  109.            Return True
  110.        Catch ex As Exception
  111.            ' MsgBox(ex.Message)
  112.            ' Throw New Exception(ex.Message)
  113.            Return False
  114.        End Try
  115.  
  116.    End Function
  117.  
  118.    ''' <summary>
  119.    ''' Delete a registry key.
  120.    ''' </summary>
  121.    Public Shared Function Delete_Key(ByVal RegKey As String) As Boolean
  122.  
  123.        RootKey = Get_Root_Key(RegKey)
  124.        KeyPath = Get_Key_Path(RegKey)
  125.  
  126.        Try
  127.            RootKey.DeleteSubKeyTree(KeyPath)
  128.            RootKey.Dispose()
  129.            Return True
  130.        Catch ex As Exception
  131.            ' MsgBox(ex.Message)
  132.            ' Throw New Exception(ex.Message)
  133.            Return False
  134.        End Try
  135.  
  136.    End Function
  137.  
  138.    ''' <summary>
  139.    ''' Delete a registry key.
  140.    ''' </summary>
  141.    Public Shared Function Delete_Value(ByVal RegKey As String, ByVal RegValue As String) As Boolean
  142.  
  143.        RootKey = Get_Root_Key(RegKey)
  144.        KeyPath = Get_Key_Path(RegKey)
  145.  
  146.        Try
  147.            RootKey.OpenSubKey(KeyPath, True).DeleteValue(RegValue)
  148.            RootKey.Dispose()
  149.            Return True
  150.        Catch ex As Exception
  151.            ' MsgBox(ex.Message)
  152.            ' Throw New Exception(ex.Message)
  153.            Return False
  154.        End Try
  155.  
  156.    End Function
  157.  
  158.    ''' <summary>
  159.    ''' Get the data of a registry value.
  160.    ''' </summary>
  161.    Public Shared Function Get_Value(ByVal RegKey As String, ByVal RegValue As String) As String
  162.  
  163.        RootKey = Get_Root_Key(RegKey)
  164.        KeyPath = RootKey.ToString & "\" & Get_Key_Path(RegKey)
  165.        RootKey.Dispose()
  166.  
  167.        Try
  168.            Return My.Computer.Registry.GetValue(KeyPath, RegValue, Nothing)
  169.        Catch ex As Exception
  170.            ' MsgBox(ex.Message)
  171.            ' Throw New Exception(ex.Message)
  172.            Return False
  173.        End Try
  174.    End Function
  175.  
  176.    ''' <summary>
  177.    ''' Set the data of a registry value.
  178.    ''' If the Key or value don't exist it will be created automatically.
  179.    ''' </summary>
  180.    Public Shared Function Set_Value(ByVal RegKey As String, _
  181.                                     ByVal RegValue As String, _
  182.                                     ByVal RegData As String, _
  183.                                     ByVal RegDataType As Microsoft.Win32.RegistryValueKind) As Boolean
  184.  
  185.        RootKey = Get_Root_Key(RegKey)
  186.        KeyPath = RootKey.ToString & "\" & Get_Key_Path(RegKey)
  187.  
  188.        Try
  189.            If RegDataType = Microsoft.Win32.RegistryValueKind.Binary Then
  190.                My.Computer.Registry.SetValue(KeyPath, RegValue, System.Text.Encoding.ASCII.GetBytes(RegData), Microsoft.Win32.RegistryValueKind.Binary)
  191.                RootKey.Dispose()
  192.            Else
  193.                My.Computer.Registry.SetValue(KeyPath, RegValue, RegData, RegDataType)
  194.                RootKey.Dispose()
  195.            End If
  196.            Return True
  197.        Catch ex As Exception
  198.            ' MsgBox(ex.Message)
  199.            ' Throw New Exception(ex.Message)
  200.            Return False
  201.        End Try
  202.  
  203.    End Function
  204.  
  205.    ''' <summary>
  206.    ''' Export a registry key (including sub-keys) to a file.
  207.    ''' </summary>
  208.    Public Shared Function Export_Key(ByVal RegKey As String, ByVal OutputFile As String) As Boolean
  209.        Dim RootKey As String = Get_Root_Key(RegKey).ToString
  210.        Dim KeyPath As String = RootKey & "\" & Get_Key_Path(RegKey)
  211.        If KeyPath.EndsWith("\") Then KeyPath = KeyPath.Substring(0, KeyPath.Length - 1)
  212.  
  213.        Try
  214.            Dim Regedit As New Process()
  215.            Dim Regedit_Info As New ProcessStartInfo()
  216.  
  217.            Regedit_Info.FileName = "Reg.exe"
  218.            Regedit_Info.Arguments = "Export " & """" & KeyPath & """" & " " & """" & OutputFile & """" & " /y"
  219.            Regedit_Info.CreateNoWindow = True
  220.            Regedit_Info.WindowStyle = ProcessWindowStyle.Hidden
  221.            Regedit_Info.UseShellExecute = False
  222.            Regedit.StartInfo = Regedit_Info
  223.            Regedit.Start()
  224.            Regedit.WaitForExit()
  225.  
  226.            If Regedit.ExitCode <> 0 Then
  227.                Regedit.Dispose()
  228.                Return False
  229.            Else
  230.                Regedit.Dispose()
  231.                Return True
  232.            End If
  233.  
  234.        Catch ex As Exception
  235.            ' MsgBox(ex.Message)
  236.            ' Throw New Exception(ex.Message)
  237.            Return False
  238.        End Try
  239.  
  240.    End Function
  241.  
  242.    ''' <summary>
  243.    ''' Import a registry file.
  244.    ''' </summary>
  245.    Public Shared Function Import_RegFile(ByVal RegFile As String) As Boolean
  246.  
  247.        If IO.File.Exists(RegFile) Then
  248.  
  249.            Try
  250.                Dim Regedit As New Process()
  251.                Dim Regedit_Info As New ProcessStartInfo()
  252.  
  253.                Regedit_Info.FileName = "Reg.exe"
  254.                Regedit_Info.Arguments = "Import " & """" & RegFile & """"
  255.                Regedit_Info.CreateNoWindow = True
  256.                Regedit_Info.WindowStyle = ProcessWindowStyle.Hidden
  257.                Regedit_Info.UseShellExecute = False
  258.                Regedit.StartInfo = Regedit_Info
  259.                Regedit.Start()
  260.                Regedit.WaitForExit()
  261.  
  262.                If Regedit.ExitCode <> 0 Then
  263.                    Regedit.Dispose()
  264.                    Return False
  265.                Else
  266.                    Regedit.Dispose()
  267.                    Return True
  268.                End If
  269.  
  270.            Catch ex As Exception
  271.                ' MsgBox(ex.Message)
  272.                ' Throw New Exception(ex.Message)
  273.                Return False
  274.            End Try
  275.  
  276.        Else
  277.            ' MsgBox("File don't exist")
  278.            Return False
  279.  
  280.        End If
  281.  
  282.    End Function
  283.  
  284.    ''' <summary>
  285.    ''' Open Regedit at specific key.
  286.    ''' </summary>
  287.    Public Shared Function Jump_To_Key(ByVal RegKey As String) As Boolean
  288.  
  289.        RootKey = Get_Root_Key(RegKey)
  290.        KeyPath = RootKey.ToString & "\" & Get_Key_Path(RegKey)
  291.        If KeyPath.EndsWith("\") Then KeyPath = KeyPath.Substring(0, KeyPath.Length - 1)
  292.  
  293.        Try
  294.            Set_Value("HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit", "LastKey", "" & KeyPath & "", Microsoft.Win32.RegistryValueKind.String)
  295.            RootKey.Dispose()
  296.            Process.Start("Regedit.exe")
  297.            Return True
  298.        Catch ex As Exception
  299.            ' MsgBox(ex.Message)
  300.            ' Throw New Exception(ex.Message)
  301.            Return False
  302.        End Try
  303.  
  304.    End Function
  305.  
  306.    ''' <summary>
  307.    ''' Checks if a Key exist.
  308.    ''' </summary>
  309.    Public Shared Function Exist_Key(ByVal RegKey As String) As Boolean
  310.  
  311.        RootKey = Get_Root_Key(RegKey)
  312.        KeyPath = Get_Key_Path(RegKey)
  313.  
  314.        If RootKey Is Nothing OrElse KeyPath Is Nothing Then Return False
  315.  
  316.        If RootKey.OpenSubKey(KeyPath, False) Is Nothing Then
  317.            RootKey.Dispose()
  318.            Return False
  319.        Else
  320.            RootKey.Dispose()
  321.            Return True
  322.        End If
  323.  
  324.    End Function
  325.  
  326.    ''' <summary>
  327.    ''' Checks if a value exist.
  328.    ''' </summary>
  329.    Public Shared Function Exist_Value(ByVal RegKey As String, ByVal RegValue As String) As Boolean
  330.  
  331.        RootKey = Get_Root_Key(RegKey)
  332.        KeyPath = Get_Key_Path(RegKey)
  333.  
  334.        Try
  335.            If RootKey.OpenSubKey(KeyPath, False).GetValue(RegValue) = String.Empty Then
  336.                RootKey.Dispose()
  337.                Return False
  338.            Else
  339.                RootKey.Dispose()
  340.                Return True
  341.            End If
  342.        Catch ex As Exception
  343.            ' MsgBox(ex.Message)
  344.            ' Throw New Exception(ex.Message)
  345.            Return False
  346.        End Try
  347.  
  348.    End Function
  349.  
  350.    ''' <summary>
  351.    ''' Check if a value have empty data.
  352.    ''' </summary>
  353.    Public Shared Function Exist_Data(ByVal RegKey As String, ByVal RegValue As String) As Boolean
  354.  
  355.        RootKey = Get_Root_Key(RegKey)
  356.        KeyPath = RootKey.ToString & "\" & Get_Key_Path(RegKey)
  357.  
  358.        Try
  359.            If My.Computer.Registry.GetValue(KeyPath, RegValue, Nothing) = Nothing Then
  360.                RootKey.Dispose()
  361.                Return False
  362.            Else
  363.                RootKey.Dispose()
  364.                Return True
  365.            End If
  366.        Catch ex As Exception
  367.            ' MsgBox(ex.Message)
  368.            ' Throw New Exception(ex.Message)
  369.            Return False
  370.        End Try
  371.  
  372.    End Function
  373.  
  374.    ''' <summary>
  375.    ''' Copy a key tree to another location of the registry.
  376.    ''' </summary>
  377.    Public Shared Function Copy_Key(ByVal OldRootKey As String, _
  378.                        ByVal OldPath As String, _
  379.                        ByVal OldName As String, _
  380.                        ByVal NewRootKey As String, _
  381.                        ByVal NewPath As String, _
  382.                        ByVal NewName As String) As Boolean
  383.  
  384.        If OldPath Is Nothing Then OldPath = ""
  385.        If NewRootKey Is Nothing Then NewRootKey = OldRootKey
  386.        If NewPath Is Nothing Then NewPath = ""
  387.        If NewName Is Nothing Then NewName = ""
  388.  
  389.        If OldRootKey.EndsWith("\") Then OldRootKey = OldRootKey.Substring(0, OldRootKey.Length - 1)
  390.        If NewRootKey.EndsWith("\") Then NewRootKey = NewRootKey.Substring(0, NewRootKey.Length - 1)
  391.  
  392.        If OldPath.StartsWith("\") Then OldPath = OldPath.Substring(1, OldPath.Length - 1)
  393.        If OldPath.EndsWith("\") Then OldPath = OldPath.Substring(0, OldPath.Length - 1)
  394.        If NewPath.StartsWith("\") Then NewPath = NewPath.Substring(1, NewPath.Length - 1)
  395.        If NewPath.EndsWith("\") Then NewPath = NewPath.Substring(0, NewPath.Length - 1)
  396.  
  397.        If OldName.StartsWith("\") Then OldName = OldName.Substring(1, OldName.Length - 1)
  398.        If OldName.EndsWith("\") Then OldName = OldName.Substring(0, OldName.Length - 1)
  399.        If NewName.StartsWith("\") Then NewName = NewName.Substring(1, NewName.Length - 1)
  400.        If NewName.EndsWith("\") Then NewName = NewName.Substring(0, NewName.Length - 1)
  401.  
  402.        Dim OrigRootKey As Microsoft.Win32.RegistryKey = Get_Root_Key(OldRootKey)
  403.        Dim DestRootKey As Microsoft.Win32.RegistryKey = Get_Root_Key(NewRootKey)
  404.  
  405.        Dim oldkey As Microsoft.Win32.RegistryKey = OrigRootKey.OpenSubKey(OldPath + "\" + OldName, True)
  406.        Dim newkey As Microsoft.Win32.RegistryKey = DestRootKey.OpenSubKey(NewPath, True).CreateSubKey(NewName)
  407.        Reg_Copy_SubKeys(oldkey, newkey)
  408.        Return True
  409.  
  410.    End Function
  411.    Private Shared Sub Reg_Copy_SubKeys(OrigKey As Microsoft.Win32.RegistryKey, DestKey As Microsoft.Win32.RegistryKey)
  412.  
  413.        Dim ValueNames As String() = OrigKey.GetValueNames()
  414.        Dim SubKeyNames As String() = OrigKey.GetSubKeyNames()
  415.  
  416.        For i As Integer = 0 To ValueNames.Length - 1
  417.            Application.DoEvents()
  418.            DestKey.SetValue(ValueNames(i), OrigKey.GetValue(ValueNames(i)))
  419.        Next
  420.  
  421.        For i As Integer = 0 To SubKeyNames.Length - 1
  422.            Application.DoEvents()
  423.            Reg_Copy_SubKeys(OrigKey.OpenSubKey(SubKeyNames(i), True), DestKey.CreateSubKey(SubKeyNames(i)))
  424.        Next
  425.  
  426.    End Sub
  427.  
  428.    ''' <summary>
  429.    ''' Copy a value with their data to another location of the registry.
  430.    ''' If the Key don't exist it will be created automatically.
  431.    ''' </summary>
  432.    Public Shared Function Copy_Value(ByVal RegKey As String, ByVal RegValue As String, _
  433.                                      ByVal NewRegKey As String, ByVal NewRegValue As String) As Boolean
  434.  
  435.        Dim OldRootKey As String = Get_Root_Key(RegKey).ToString
  436.        Dim OldKeyPath As String = OldRootKey & "\" & Get_Key_Path(RegKey)
  437.  
  438.        Dim NewRootKey As String = Get_Root_Key(NewRegKey).ToString
  439.        Dim NewKeyPath As String = NewRootKey & "\" & Get_Key_Path(NewRegKey)
  440.  
  441.        Dim RegData = Get_Value(OldKeyPath, RegValue)
  442.  
  443.        Try
  444.            Set_Value(NewKeyPath, NewRegValue, RegData, Microsoft.Win32.RegistryValueKind.Unknown)
  445.            Return True
  446.        Catch ex As Exception
  447.            ' MsgBox(ex.Message)
  448.            ' Throw New Exception(ex.Message)
  449.            Return False
  450.        End Try
  451.  
  452.    End Function
  453.  
  454.    ''' <summary>
  455.    ''' Valid User identifiers for Regini.exe command.
  456.    ''' </summary>
  457.    Public Enum RegUserAccess As Short
  458.        Administrators_Full_Access = 1
  459.        Administrators_Read_Access = 2
  460.        Administrators_Read_and_Write_Access = 3
  461.        Administrators_Read_Write_and_Delete_Access4
  462.        Administrators_Read_Write_and_Execute_Access = 20
  463.        Creator_Full_Access = 5
  464.        Creator_Read_and_Write_Access = 6
  465.        Interactive_User_Full_Access = 21
  466.        Interactive_User_Read_and_Write_Access = 22
  467.        Interactive_User_Read_Write_and_Delete_Access = 23
  468.        Power_Users_Full_Access = 11
  469.        Power_Users_Read_and_Write_Access = 12
  470.        Power_Users_Read_Write_and_Delete_Access = 13
  471.        System_Full_Access = 17
  472.        System_Operators_Full_Access = 14
  473.        System_Operators_Read_and_Write_Access = 15
  474.        System_Operators_Read_Write_and_Delete_Access = 16
  475.        System_Read_Access = 19
  476.        System_Read_and_Write_Access = 18
  477.        World_Full_Access = 7
  478.        World_Read_Access = 8
  479.        World_Read_and_Write_Access = 9
  480.        World_Read_Write_and_Delete_Access = 10
  481.    End Enum
  482.  
  483.    ''' <summary>
  484.    ''' Modify the User permissions of a registry key.
  485.    ''' </summary>
  486.    Public Shared Function Set_UserAccess_Key(ByVal RegKey As String, ByVal RegUserAccess() As RegUserAccess) As Boolean
  487.  
  488.        Dim PermissionString As String = String.Empty
  489.        RootKey = Get_Root_Key(RegKey)
  490.  
  491.        KeyPath = RootKey.ToString & "\" & Get_Key_Path(RegKey)
  492.        If KeyPath.EndsWith("\") Then KeyPath = KeyPath.Substring(0, KeyPath.Length - 1)
  493.  
  494.        For Each user In RegUserAccess
  495.            ' Application.DoEvents()
  496.            PermissionString += " " & user
  497.        Next
  498.  
  499.        PermissionString = "[" & PermissionString & "]"
  500.        PermissionString = PermissionString.Replace("[ ", "[")
  501.  
  502.        Try
  503.  
  504.            Using TextFile As New IO.StreamWriter(System.IO.Path.GetTempPath() & "Regini.ini", False, System.Text.Encoding.Default)
  505.                TextFile.WriteLine("""" & KeyPath & """" & " " & PermissionString)
  506.            End Using
  507.  
  508.            Dim Regini As New Process()
  509.            Dim Regini_Info As New ProcessStartInfo()
  510.  
  511.            Regini_Info.FileName = "Regini.exe"
  512.            Regini_Info.Arguments = """" & System.IO.Path.GetTempPath() & "Regini.ini" & """"
  513.            Regini_Info.CreateNoWindow = True
  514.            Regini_Info.WindowStyle = ProcessWindowStyle.Hidden
  515.            Regini_Info.UseShellExecute = False
  516.            Regini.StartInfo = Regini_Info
  517.            Regini.Start()
  518.            Regini.WaitForExit()
  519.  
  520.            If Regini.ExitCode <> 0 Then
  521.                RootKey.Dispose()
  522.                Regini.Dispose()
  523.                Return False
  524.            Else
  525.                RootKey.Dispose()
  526.                Regini.Dispose()
  527.                Return True
  528.            End If
  529.  
  530.        Catch ex As Exception
  531.            ' MsgBox(ex.Message)
  532.            ' Throw New Exception(ex.Message)
  533.            Return False
  534.        End Try
  535.  
  536.    End Function
  537.  
  538.    ' Returns the RootKey formatted
  539.    Private Shared Function Get_Root_Key(ByVal RegKey As String) As Microsoft.Win32.RegistryKey
  540.        Select Case RegKey.ToUpper.Split("\").First
  541.            Case "HKCR", "HKEY_CLASSES_ROOT" : Return Microsoft.Win32.Registry.ClassesRoot
  542.            Case "HKCC", "HKEY_CURRENT_CONFIG" : Return Microsoft.Win32.Registry.CurrentConfig
  543.            Case "HKCU", "HKEY_CURRENT_USER" : Return Microsoft.Win32.Registry.CurrentUser
  544.            Case "HKLM", "HKEY_LOCAL_MACHINE" : Return Microsoft.Win32.Registry.LocalMachine
  545.            Case "HKEY_PERFORMANCE_DATA" : Return Microsoft.Win32.Registry.PerformanceData
  546.            Case Else : Return Nothing
  547.        End Select
  548.    End Function
  549.  
  550.    ' Returns the KeyPath formatted
  551.    Private Shared Function Get_Key_Path(ByVal RegKey As String) As String
  552.  
  553.        If RegKey Is Nothing Then Return Nothing
  554.  
  555.        Dim Path As String = String.Empty
  556.        For i As Integer = 1 To RegKey.Split("\").Length - 1
  557.            ' Application.DoEvents()
  558.            Path &= RegKey.Split("\")(i) & "\"
  559.        Next
  560.  
  561.        If Not Path.Contains("\") Then Path = Path & "\"
  562.        Path = Path.Substring(0, Path.LastIndexOf("\"))
  563.  
  564.        Return Path
  565.  
  566.    End Function
  567.  
  568. End Class
  569.  
  570. #End Region
  571.  
  572. #End Region
En línea

LukaCrosszeria

Desconectado Desconectado

Mensajes: 79


Lets go baby~


Ver Perfil
Re: [Duda] Registro con password.
« Respuesta #4 en: 23 Octubre 2013, 05:51 am »

Aun sigo sin entender, aunque pense algo mejor..... Osea se que para abrir un programa utilizo

.Shell


Bien.. pero ahora imaginemos que hago el formulario. Este formulario sera un sencillo cuadro donde tendra una password ya predefinida. Digamos [Pudin]. Quisiera saber como hago para que mi formulario verifique que la contrasenha escrita es Pudin y ademas de eso que compare el numero de serie de la pc con el numero serie de la pc que dejare almacenado en la memoria del programa. Si pasa esas dos cosas, que el formulario abra otro programa.

En resumen:

-Comando para comprar la variable con un registro
-Comando para verificar que lo que esta escrito es la contrasenha puesta en la memoria del formulario[programa]


Si pueden darme un sencillo ejemplo de ambos casos se lo agradeceria.
En línea

Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.813



Ver Perfil
Re: [Duda] Registro con password.
« Respuesta #5 en: 23 Octubre 2013, 06:25 am »

Hola

1. No te recomiendo usar Shell, dispones de la Class Process para personalizar los parámetros de un nuevo proceso y ejeuctarlo.

2.

Código
  1. ReadOnly DefaultPass As String = "Pudin"
  2. Private UserPass As String = "pudin"
  3.  
  4. If String.Compare(UserPass, DefaultPass, True) = 0 Then
  5.      MsgBox("Contraseña correcta")
  6. End If

3.

Código
  1.    #Region " Get CPU ID "
  2.  
  3.       ' [ Get CPU ID ]
  4.       '
  5.       '// By Elektro H@cker
  6.       '
  7.       ' INSTRUCTIONS:
  8.       ' 1. Add a reference to "System.Management"
  9.       '
  10.       ' Examples :
  11.       ' Dim ProcID As String = Get_CPU_ID()
  12.       ' MsgBox(Get_CPU_ID())
  13.  
  14.    Private Function Get_CPU_ID() As String
  15.  
  16.        Dim wmi As Management.ManagementObjectSearcher = _
  17.            New Management.ManagementObjectSearcher("select * from Win32_Processor")
  18.  
  19.        Dim val As String = wmi.Get(0)("ProcessorID")
  20.  
  21.        wmi.Dispose()
  22.  
  23.        Return val.ToString
  24.  
  25.    End Function
  26.  
  27.    #End Region

Código
  1.    #Region " Get Motherboard ID "
  2.  
  3.       ' [ Get Motherboard ID ]
  4.       '
  5.       '// By Elektro H@cker
  6.       '
  7.       ' INSTRUCTIONS:
  8.       ' 1. Add a reference to "System.Management"
  9.       '
  10.       ' Examples :
  11.       ' Dim MotherID As String = Get_Motherboard_ID()
  12.       ' MsgBox(Get_Motherboard_ID())
  13.  
  14.    Private Function Get_Motherboard_ID() As String
  15.  
  16.        Dim wmi As Management.ManagementObjectSearcher = _
  17.            New Management.ManagementObjectSearcher("select * from Win32_BaseBoard")
  18.  
  19.        Dim val As String = wmi.Get(0)("SerialNumber")
  20.  
  21.        wmi.Dispose()
  22.  
  23.        Return val
  24.  
  25.    End Function
  26.  
  27.    #End Region

Saludos!
« Última modificación: 23 Octubre 2013, 06:40 am por EleKtro H@cker » En línea

LukaCrosszeria

Desconectado Desconectado

Mensajes: 79


Lets go baby~


Ver Perfil
Re: [Duda] Registro con password.
« Respuesta #6 en: 23 Octubre 2013, 15:07 pm »

Intento pero ReadOnly y Private VB 2012 .NET me los cambia por Dim.
En línea

Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.813



Ver Perfil
Re: [Duda] Registro con password.
« Respuesta #7 en: 23 Octubre 2013, 15:39 pm »

Tienes que declarar las variables fuera de cualquier procedimiento.

Te recomiendo una lectura...:
-> Declaración de variable
-> Período de duración
-> Instrucción Dim

Saludos
« Última modificación: 23 Octubre 2013, 15:42 pm por EleKtro H@cker » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
duda de password wifi
Hacking Wireless
look.at.me007 3 2,283 Último mensaje 14 Mayo 2012, 15:55 pm
por look.at.me007
Duda Recorrer usuarios y password?
Java
Slider324 1 1,733 Último mensaje 11 Enero 2013, 06:55 am
por Slider324
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines