Retrieving Windows Password Hint from the registry

Ishan

I have been trying to extract the Windows login password hint for Windows 7 programmatically and I came to know it can be retrieved from the following location in the registry HKLM\SAM\SAM\Domains\Account\Users\"userkey"\UserPasswordHint However, I am not able to figure out is there any way to find out userkey for the currently logged-on user programmatically?

Piotr Zierhoffer

If you can get the current user name, it's quite easy, using the same registry tree.

Take a look in HKLM\SAM\SAM\Domains\Account\Users\Names\{username}. The value of the entry would relate to the proper userkey.

Of course remember the hint may not exist.

EDIT

Ha! Nailed it!

주석에서 말했듯이 적절한 값을 포함하는 노드의 값이 아니라 해당 노드의 기본 항목 유형입니다. 이 유형은 표준이 아니므로 C #으로 얻는 것은 불가능하지는 않지만 어렵습니다. 이 접근 방식에 문제가있어서 변경했습니다.

userkey실제로 호출하는 16 진수 값 은 사용자 SID의 마지막 부분입니다 (이 부분을 RID라고 함). 내가 아는 한 모든 관리자는 RID = 500, 모든 게스트 = 501, 1000 또는 1001로 시작하는 일반 사용자는 지금 기억할 수 없습니다.

그리고 그것은 16 진수로 무엇입니까?

500 = 0x1f4
501 = 0x1f5
1000= 0x3e9
...

익숙해 보입니까?

그래서 우리가해야 할 일은 사용자의이 SID를 얻고, 흥미로운 부분을 추출하고, 그것을 패딩 된 16 진수 문자열로 변환하고 값을 검색하는 것입니다.

static void Main(string[] args)
{
    SecurityIdentifier sid = System.Security.Principal.WindowsIdentity.GetCurrent().User;
    var rid = sid.ToString().Split('-').Last();
    var hexValue = int.Parse(rid).ToString("X").PadLeft(8, '0');
    RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SAM\SAM\Domains\Account\Users\"+hexValue);
    try
    {
        var hint = key.GetValue("UserPasswordHint");
        //...
    }
    catch (Exception)
    {
        Console.WriteLine("Could not access value");
    }
}

조심해!

내가 아는 한 충분한 권한이 없으면 SAM 데이터베이스에 액세스 할 수 없습니다. 시스템 사용자 (예 :)로 실행하면 psexec -s yourbinary.exe도움이되지만 현재 사용자가 변경되고 프로그램이 실패합니다. 따라서 흥미로운 사용자를 위해 실행하는 방법을 스스로 해결해야합니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

the hint and saved password overlap on the login page

분류에서Dev

How can i use Salt with a password in codeigniter when retrieving salt from the db

분류에서Dev

How to set Windows not to prompt for password on resume from sleep

분류에서Dev

In Windows 10 How To Keep Password Prompt From Appearing On Sleep?

분류에서Dev

Windows Registry | how to open .lnk

분류에서Dev

Searching for Windows registry entries by permissions

분류에서Dev

Retrieving autosearch values from MySQL

분류에서Dev

Retrieving an element from a created list

분류에서Dev

Add plugin to firefox using windows registry

분류에서Dev

Edit another Windows install's registry

분류에서Dev

Change Windows permissions on single registry key

분류에서Dev

Are Windows 10 Personalization settings available in Registry?

분류에서Dev

Saving and retrieving values from memory location

분류에서Dev

Retrieving multiple data from db and grouping them

분류에서Dev

Retrieving date from SQLite database via cursor

분류에서Dev

Retrieving the id from Model to Controller in Angular JS

분류에서Dev

Retrieving an instance from the Angular injector at runtime

분류에서Dev

Retrieving a JSON.parse() string from a server

분류에서Dev

set size of image after retrieving from json

분류에서Dev

Retrieving values from a multidimensional JSON array

분류에서Dev

Replacing registry default value from command line

분류에서Dev

Remove or reset Windows 10 password

분류에서Dev

Use Windows password in WinSCP script

분류에서Dev

setting sudo password different from login password

분류에서Dev

How do you change permissions on a registry key in Windows 7?

분류에서Dev

Cannot Create Key: Error Writing to the Windows 7 Registry

분류에서Dev

How to reset a password from kwallet?

분류에서Dev

Block BIOS password from recovery

분류에서Dev

retrieving images from server using ajax, jQuery. code not working

Related 관련 기사

  1. 1

    the hint and saved password overlap on the login page

  2. 2

    How can i use Salt with a password in codeigniter when retrieving salt from the db

  3. 3

    How to set Windows not to prompt for password on resume from sleep

  4. 4

    In Windows 10 How To Keep Password Prompt From Appearing On Sleep?

  5. 5

    Windows Registry | how to open .lnk

  6. 6

    Searching for Windows registry entries by permissions

  7. 7

    Retrieving autosearch values from MySQL

  8. 8

    Retrieving an element from a created list

  9. 9

    Add plugin to firefox using windows registry

  10. 10

    Edit another Windows install's registry

  11. 11

    Change Windows permissions on single registry key

  12. 12

    Are Windows 10 Personalization settings available in Registry?

  13. 13

    Saving and retrieving values from memory location

  14. 14

    Retrieving multiple data from db and grouping them

  15. 15

    Retrieving date from SQLite database via cursor

  16. 16

    Retrieving the id from Model to Controller in Angular JS

  17. 17

    Retrieving an instance from the Angular injector at runtime

  18. 18

    Retrieving a JSON.parse() string from a server

  19. 19

    set size of image after retrieving from json

  20. 20

    Retrieving values from a multidimensional JSON array

  21. 21

    Replacing registry default value from command line

  22. 22

    Remove or reset Windows 10 password

  23. 23

    Use Windows password in WinSCP script

  24. 24

    setting sudo password different from login password

  25. 25

    How do you change permissions on a registry key in Windows 7?

  26. 26

    Cannot Create Key: Error Writing to the Windows 7 Registry

  27. 27

    How to reset a password from kwallet?

  28. 28

    Block BIOS password from recovery

  29. 29

    retrieving images from server using ajax, jQuery. code not working

뜨겁다태그

보관