Hack Forums
[.NET] [VB.NET]Check Windows Password - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [VB.NET]Check Windows Password (/showthread.php?tid=397058)



[VB.NET]Check Windows Password - codepoet - May 1, 2010

originally posted on dotnet-snippets.com

Description:

This function checks a windows user password whether it is valid and matching to the given username.
Code
Private Declare Auto Function LogonUser Lib "advapi32.dll" ( _
    ByVal lpszUsername As String, _
    ByVal lpszDomain As String, _
    ByVal lpszPassword As String, _
    ByVal dwLogonType As LogonType, _
    ByVal dwLogonProvider As Integer, _
    ByRef phToken As IntPtr) _
As Integer

Private Declare Auto Function CloseHandle Lib "kernel32.dll" ( _
    ByVal hObject As IntPtr) _
As Boolean

Public Enum LogonType As Integer
    LOGON32_LOGON_INTERACTIVE = 2
    LOGON32_LOGON_NETWORK = 3
    LOGON32_LOGON_BATCH = 4
    LOGON32_LOGON_SERVICE = 5
    LOGON32_LOGON_UNLOCK = 7
    LOGON32_LOGON_NETWORK_CLEARTEXT = 8
    LOGON32_LOGON_NEW_CREDENTIALS = 9
End Enum

Public Function IsNTPasswordValid(ByVal Username As String, ByVal Password As String, Optional ByVal Domain As String = "") As Boolean
    Dim Token As New IntPtr
    LogonUser(Username, Domain, Password, LogonType.LOGON32_LOGON_INTERACTIVE, 0, Token)
    CloseHandle(Token)
    If Token.ToInt32 <> 0 Then Return True
End Function


If You Like this tutorial, please check out my other tutorials by clicking ==> H3R3


* - .Nielz - May 2, 2010

But how do you get the info? I mean like saying it in a textbox?


* - µnKn0wn_H4CK3r - May 6, 2010

(May 2, 2010 06:48 AM)nielsje153 Wrote:  But how do you get the info? I mean like saying it in a textbox?
Up.

It interests me.


* - DeadCode - May 6, 2010

This could be useful for a fake logon. Say running an exe which requests login info. Useful for harvesting user/pass.


* - codepoet - May 6, 2010

(May 6, 2010 11:49 AM)DeadCode Wrote:  This could be useful for a fake logon. Say running an exe which requests login info. Useful for harvesting user/pass.

well if you know what you are doomg... ot can be rewritten and uses in many different ways.