Advertisement
Guest User

Untitled

a guest
Apr 1st, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Windows.h>
  2. #include <stdio.h>
  3.  
  4. void _log(UINT64 data) {
  5.     char text[200];
  6.  
  7.     sprintf_s(text, "%p", data);
  8.  
  9.     MessageBoxA(0, text, "123", 0);
  10. }
  11.  
  12. typedef struct _PEB_LDR_DATA {
  13.     BYTE       Reserved1[8];
  14.     PVOID64      Reserved2[3];
  15.     LIST_ENTRY64 InMemoryOrderModuleList;
  16. } PEB_LDR_DATA;
  17.  
  18. typedef struct _UNICODE_STRING_WOW64 {
  19.     USHORT Length;
  20.     USHORT MaximumLength;
  21.     PVOID64 Buffer;
  22. } UNICODE_STRING;
  23.  
  24. typedef struct _LDR_DATA_TABLE_ENTRY {
  25.     PVOID64 Reserved1[2];
  26.     LIST_ENTRY64 InMemoryOrderLinks;
  27.     PVOID64 Reserved2[2];
  28.     PVOID64 DllBase;
  29.     PVOID64 EntryPoint;
  30.     PVOID64 Reserved3;
  31.     UNICODE_STRING FullDllName;
  32.     BYTE Reserved4[8];
  33.     PVOID64 Reserved5[3];
  34.     union {
  35.         ULONG CheckSum;
  36.         PVOID64 Reserved6;
  37.     };
  38.     ULONG TimeDateStamp;
  39. } LDR_DATA_TABLE_ENTRY;
  40.  
  41. typedef struct _PEB64 {
  42.     BYTE Reserved[16];
  43.     PVOID64 ImageBaseAddress;
  44.     PVOID64 LdrData;
  45.     PVOID64 ProcessParameters;
  46. } PEB64;
  47.  
  48. void _logStr(CHAR* data) {
  49.     char text[200];
  50.  
  51.     sprintf_s(text, "%s", data);
  52.  
  53.     MessageBoxA(0, text, "123", 0);
  54. }
  55.  
  56. int main() {
  57.  
  58.     PEB64 ldr = *(PEB64*)(__readgsqword(0x60));
  59.     PEB_LDR_DATA ldrData = *(PEB_LDR_DATA*)ldr.LdrData;
  60.  
  61.     LIST_ENTRY64 headFlink = *(LIST_ENTRY64*)ldrData.InMemoryOrderModuleList.Flink;
  62.     LIST_ENTRY64 first = *(LIST_ENTRY64*)headFlink.Flink;
  63.  
  64.     UINT64 entryAddr = headFlink.Flink;
  65.  
  66.     LIST_ENTRY64 currentListEntry = *(LIST_ENTRY64*)entryAddr;
  67.  
  68.     while (currentListEntry.Flink != headFlink.Flink) {
  69.         currentListEntry = *(LIST_ENTRY64*)entryAddr;
  70.         entryAddr = currentListEntry.Flink;
  71.  
  72.         LDR_DATA_TABLE_ENTRY entry = *(LDR_DATA_TABLE_ENTRY*)(entryAddr + 0x10);
  73.  
  74.         /*
  75.        
  76.             Чекай entry.FullDllName
  77.             Парси от entry.DllBase
  78.  
  79.         */
  80.  
  81.     //  _log(entry.CheckSum);
  82.     }
  83.  
  84.     return 0;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement