leechcorepyc 2.18.0__tar.gz → 2.18.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. {leechcorepyc-2.18.0/leechcorepyc.egg-info → leechcorepyc-2.18.4}/PKG-INFO +1 -1
  2. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/includes/leechcore.h +21 -1
  3. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/device_file.c +1 -1
  4. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/device_fpga.c +1 -1
  5. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/device_hibr.c +9 -9
  6. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/device_vmm.c +18 -40
  7. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/leechcore.h +21 -1
  8. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/oscompatibility.c +0 -3
  9. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/version.h +2 -2
  10. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4/leechcorepyc.egg-info}/PKG-INFO +1 -1
  11. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/setup.py +1 -1
  12. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/MANIFEST.in +0 -0
  13. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/Makefile +0 -0
  14. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/README +0 -0
  15. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/files/dummy +0 -0
  16. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/includes/leechcore_device.h +0 -0
  17. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/includes/libpdbcrust.h +0 -0
  18. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/includes/vmmdll.h +0 -0
  19. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/includes/vmmyara.h +0 -0
  20. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/Makefile +0 -0
  21. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/device_pmem.c +0 -0
  22. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/device_tmd.c +0 -0
  23. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/device_usb3380.c +0 -0
  24. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/device_vmware.c +0 -0
  25. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/leechcore.c +0 -0
  26. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/leechcore.rc +0 -0
  27. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/leechcore_device.h +0 -0
  28. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/leechcore_internal.h +0 -0
  29. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/leechrpc.h +0 -0
  30. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/leechrpc.idl +0 -0
  31. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/leechrpc_c.c +0 -0
  32. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/leechrpc_h.h +0 -0
  33. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/leechrpcclient.c +0 -0
  34. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/leechrpcshared.c +0 -0
  35. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/memmap.c +0 -0
  36. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/ob/ob.h +0 -0
  37. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/ob/ob_bytequeue.c +0 -0
  38. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/ob/ob_core.c +0 -0
  39. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/ob/ob_map.c +0 -0
  40. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/ob/ob_set.c +0 -0
  41. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/oscompatibility.h +0 -0
  42. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/util.c +0 -0
  43. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore/util.h +0 -0
  44. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore_device_qemu/Makefile +0 -0
  45. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore_device_qemu/leechcore_device_qemu.c +0 -0
  46. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore_device_rawtcp/Makefile +0 -0
  47. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore_device_rawtcp/leechcore_device_rawtcp.c +0 -0
  48. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore_device_rawtcp/oscompatibility.c +0 -0
  49. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore_device_rawtcp/oscompatibility.h +0 -0
  50. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore_device_rawtcp/plugin.rc +0 -0
  51. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore_device_rawtcp/resource.h +0 -0
  52. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore_device_rawtcp/version.h +0 -0
  53. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore_ft601_driver_linux/Makefile +0 -0
  54. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore_ft601_driver_linux/fpga_libusb.c +0 -0
  55. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore_ft601_driver_linux/fpga_libusb.h +0 -0
  56. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore_ft601_driver_linux/leechcore_ft601_driver_linux.c +0 -0
  57. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcore_ft601_driver_linux/leechcore_ft601_driver_linux.h +0 -0
  58. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcorepyc/__init__.py +0 -0
  59. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcorepyc.c +0 -0
  60. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcorepyc.egg-info/SOURCES.txt +0 -0
  61. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcorepyc.egg-info/dependency_links.txt +0 -0
  62. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcorepyc.egg-info/top_level.txt +0 -0
  63. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcorepyc.h +0 -0
  64. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/leechcorepyc_barrequest.c +0 -0
  65. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/Makefile +0 -0
  66. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/lznt1.h +0 -0
  67. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/mscomp/Array.h +0 -0
  68. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/mscomp/Bitstream.h +0 -0
  69. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/mscomp/CircularBuffer.h +0 -0
  70. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/mscomp/HuffmanDecoder.h +0 -0
  71. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/mscomp/HuffmanEncoder.h +0 -0
  72. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/mscomp/LZNT1Dictionary.h +0 -0
  73. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/mscomp/LZNT1Dictionary_SA.h +0 -0
  74. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/mscomp/XpressDictionary.h +0 -0
  75. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/mscomp/config.h +0 -0
  76. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/mscomp/general.h +0 -0
  77. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/mscomp/internal.h +0 -0
  78. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/mscomp/sorting.h +0 -0
  79. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/mscomp.h +0 -0
  80. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/xpress.h +0 -0
  81. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/include/xpress_huff.h +0 -0
  82. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/src/lznt1_compress.cpp +0 -0
  83. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/src/lznt1_decompress.cpp +0 -0
  84. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/src/mscomp.cpp +0 -0
  85. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/src/xpress_compress.cpp +0 -0
  86. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/src/xpress_decompress.cpp +0 -0
  87. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/src/xpress_huff_compress.cpp +0 -0
  88. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/ms-compress/src/xpress_huff_decompress.cpp +0 -0
  89. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/oscompatibility.c +0 -0
  90. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/oscompatibility.h +0 -0
  91. {leechcorepyc-2.18.0 → leechcorepyc-2.18.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.2
2
2
  Name: leechcorepyc
3
- Version: 2.18.0
3
+ Version: 2.18.4
4
4
  Summary: LeechCore for Python
5
5
  Home-page: https://github.com/ufrisk/LeechCore
6
6
  Author: Ulf Frisk
@@ -14,7 +14,7 @@
14
14
  // (c) Ulf Frisk, 2020-2024
15
15
  // Author: Ulf Frisk, pcileech@frizk.net
16
16
  //
17
- // Header Version: 2.17
17
+ // Header Version: 2.18.4
18
18
  //
19
19
 
20
20
  #ifndef __LEECHCORE_H__
@@ -568,6 +568,26 @@ typedef VOID(*PLC_TLP_FUNCTION_CALLBACK)(
568
568
 
569
569
 
570
570
 
571
+ //-----------------------------------------------------------------------------
572
+ // VMM (VM) LOOPBACK SUPPORT:
573
+ // Functionality is used to create a VMM loopback device which is used by VMM
574
+ // to read and write memory to/from a virtual machine. See VMM for an example.
575
+ // Struct is passed in the 'hlcvmm' parameter to LcCreate() and will be copied.
576
+ //-----------------------------------------------------------------------------
577
+
578
+ #define LC_VMM_VERSION 0x1eef0001
579
+
580
+ typedef struct tdLC_VMM {
581
+ DWORD dwVersion;
582
+ HANDLE hVMM;
583
+ HANDLE hVMMVM;
584
+ PVOID pfnVMMDLL_ConfigGet;
585
+ PVOID pfnVMMDLL_VmMemReadScatter;
586
+ PVOID pfnVMMDLL_VmMemWriteScatter;
587
+ } LC_VMM, *PLC_VMM;
588
+
589
+
590
+
571
591
  //-----------------------------------------------------------------------------
572
592
  // PCIE BAR SUPPORT:
573
593
  //-----------------------------------------------------------------------------
@@ -883,7 +883,7 @@ BOOL DeviceFile_Open(_Inout_ PLC_CONTEXT ctxLC, _Out_opt_ PPLC_CONFIG_ERRORINFO
883
883
  // check if file is hibernation file, in which case delegate open to hibr device:
884
884
  _fseeki64(ctx->File[0].h, 0, SEEK_SET);
885
885
  fread(&dwFileMagic, 1, sizeof(DWORD), ctx->File[0].h);
886
- if(dwFileMagic == 0x52424948) { // 'HIBR'
886
+ if((dwFileMagic == 0x52424948) || (dwFileMagic == 0x454b4157)) { // 'HIBR' or 'WAKE'
887
887
  strncpy_s(ctxLC->Config.szDevice, _countof(ctxLC->Config.szDevice), "hibr://file=", _TRUNCATE);
888
888
  strncpy_s(ctxLC->Config.szDevice + 12, _countof(ctxLC->Config.szDevice) - 12, ctx->szFileName, _TRUNCATE);
889
889
  strncpy_s(ctxLC->Config.szDeviceName, _countof(ctxLC->Config.szDeviceName), "hibr", _TRUNCATE);
@@ -2273,7 +2273,7 @@ VOID DeviceFPGA_Synch_ReadScatter_Impl(_In_ PLC_CONTEXT ctxLC, _In_ DWORD cMEMs,
2273
2273
  continue;
2274
2274
  }
2275
2275
  if(cbTotalInCycle >= ctx->perf.MAX_SIZE_RX) { break; } // over max size -> break loop and read result
2276
- cbTotalInCycle += pDMA->cb;
2276
+ cbTotalInCycle += (pDMA->cb == 0x1000) ? 0x1000 : (pDMA->cb + 48);
2277
2277
  o = 0;
2278
2278
  while(o < pDMA->cb) {
2279
2279
  cb = fTiny ? min(0x80, pDMA->cb - o) : pDMA->cb;
@@ -70,6 +70,7 @@ const HIBR_OFFSET HIBR_OFFSET_PROFILES[] = {
70
70
  #define VMM_PTR_OFFSET(f32, pb, o) ((f32) ? *(PDWORD)((o) + (PBYTE)(pb)) : *(PQWORD)((o) + (PBYTE)(pb)))
71
71
 
72
72
  #define HIBR_MAGIC 0x52424948
73
+ #define WAKE_MAGIC 0x454b4157
73
74
 
74
75
  #define COMPRESS_ALGORITHM_NONE 0
75
76
  #define COMPRESS_ALGORITHM_XPRESS 3
@@ -168,6 +169,7 @@ NTSTATUS OSCOMPAT_RtlDecompressBufferEx(USHORT CompressionFormat, PUCHAR Uncompr
168
169
  static BOOL fFirst = TRUE;
169
170
  static SRWLOCK LockSRW = SRWLOCK_INIT;
170
171
  static int(*pfn_xpress_decompress)(PBYTE pbIn, SIZE_T cbIn, PBYTE pbOut, SIZE_T *pcbOut) = NULL;
172
+ static int(*pfn_xpress_decompress_huff)(PBYTE pbIn, SIZE_T cbIn, PBYTE pbOut, SIZE_T * pcbOut) = NULL;
171
173
  CHAR szPathLib[MAX_PATH] = { 0 };
172
174
  Util_GetPathLib(szPathLib);
173
175
  strncat_s(szPathLib, sizeof(szPathLib), "libMSCompression.so", _TRUNCATE);
@@ -178,20 +180,18 @@ NTSTATUS OSCOMPAT_RtlDecompressBufferEx(USHORT CompressionFormat, PUCHAR Uncompr
178
180
  fFirst = FALSE;
179
181
  lib_mscompress = dlopen(szPathLib, RTLD_NOW);
180
182
  if(lib_mscompress) {
181
- if(CompressionFormat == 3) { // COMPRESS_ALGORITHM_XPRESS
182
- pfn_xpress_decompress = (int(*)(PBYTE, SIZE_T, PBYTE, SIZE_T *))dlsym(lib_mscompress, "xpress_decompress");
183
- }
184
- if(CompressionFormat == 4) { // COMPRESS_ALGORITHM_XPRESS_HUFF
185
- pfn_xpress_decompress = (int(*)(PBYTE, SIZE_T, PBYTE, SIZE_T *))dlsym(lib_mscompress, "xpress_huff_decompress");
186
- }
183
+ pfn_xpress_decompress = (int(*)(PBYTE, SIZE_T, PBYTE, SIZE_T *))dlsym(lib_mscompress, "xpress_decompress");
184
+ pfn_xpress_decompress_huff = (int(*)(PBYTE, SIZE_T, PBYTE, SIZE_T *))dlsym(lib_mscompress, "xpress_huff_decompress");
187
185
  }
188
186
  }
189
187
  ReleaseSRWLockExclusive(&LockSRW);
190
188
  }
191
189
  *FinalUncompressedSize = 0;
192
- if(pfn_xpress_decompress) {
190
+ if(pfn_xpress_decompress && pfn_xpress_decompress_huff) {
193
191
  cbOut = UncompressedBufferSize;
194
- rc = pfn_xpress_decompress(CompressedBuffer, CompressedBufferSize, UncompressedBuffer, &cbOut);
192
+ rc = (CompressionFormat == 4) ?
193
+ pfn_xpress_decompress_huff(CompressedBuffer, CompressedBufferSize, UncompressedBuffer, &cbOut) :
194
+ pfn_xpress_decompress(CompressedBuffer, CompressedBufferSize, UncompressedBuffer, &cbOut);
195
195
  if(rc == 0) {
196
196
  *FinalUncompressedSize = cbOut;
197
197
  return HIBR_STATUS_SUCCESS;
@@ -410,7 +410,7 @@ BOOL DeviceHibr_HibrInitialize(_In_ PLC_CONTEXT ctxLC)
410
410
  // 1: fetch header:
411
411
  if(_fseeki64(ctx->hFile, 0, SEEK_SET)) { goto fail; }
412
412
  if(fread(pb, 1, sizeof(pb), ctx->hFile) != sizeof(pb)) { goto fail; }
413
- if(*(PDWORD)(pb + 0x000) != HIBR_MAGIC) { goto fail; }
413
+ if((*(PDWORD)(pb + 0x000) != HIBR_MAGIC) && (*(PDWORD)(pb + 0x000) != WAKE_MAGIC)) { goto fail; }
414
414
  // 2: fetch offsets to use by looking at struct length:
415
415
  cbPO_MEMORY_IMAGE = *(PDWORD)(pb + 0x00c);
416
416
  for(i = 0; i < _countof(HIBR_OFFSET_PROFILES); i++) {
@@ -17,76 +17,54 @@ typedef BOOL(*FN_VMMDLL_ConfigGet)(_In_ VMM_HANDLE hVMM, _In_ ULONG64 fOption, _
17
17
  typedef DWORD(*FN_VMMDLL_VmMemReadScatter)(_In_ VMM_HANDLE hVMM, _In_ VMMVM_HANDLE hVM, _Inout_ PPMEM_SCATTER ppMEMsGPA, _In_ DWORD cpMEMsGPA, _In_ DWORD flags);
18
18
  typedef DWORD(*FN_VMMDLL_VmMemWriteScatter)(_In_ VMM_HANDLE hVMM, _In_ VMMVM_HANDLE hVM, _Inout_ PPMEM_SCATTER ppMEMsGPA, _In_ DWORD cpMEMsGPA);
19
19
 
20
- typedef struct tdDEVICE_CONTEXT_VMM {
21
- HMODULE hModuleVMM;
22
- VMM_HANDLE hVMM;
23
- VMMVM_HANDLE hVM;
24
- FN_VMMDLL_ConfigGet pfnFN_VMMDLL_ConfigGet;
25
- FN_VMMDLL_VmMemReadScatter pfnVMMDLL_VmMemReadScatter;
26
- FN_VMMDLL_VmMemWriteScatter pfnVMMDLL_VmMemWriteScatter;
27
- } DEVICE_CONTEXT_VMM , *PDEVICE_CONTEXT_VMM;
28
-
29
20
  //-----------------------------------------------------------------------------
30
21
  // GENERAL FUNCTIONALITY BELOW:
31
22
  //-----------------------------------------------------------------------------
32
23
 
33
24
  VOID DeviceVMM_ReadScatter(_In_ PLC_CONTEXT ctxLC, _In_ DWORD cpMEMs, _Inout_ PPMEM_SCATTER ppMEMs)
34
25
  {
35
- PDEVICE_CONTEXT_VMM ctx = (PDEVICE_CONTEXT_VMM)ctxLC->hDevice;
36
- ctx->pfnVMMDLL_VmMemReadScatter(ctx->hVMM, ctx->hVM, ppMEMs, cpMEMs, 0);
26
+ PLC_VMM ctx = (PLC_VMM)ctxLC->hDevice;
27
+ ((FN_VMMDLL_VmMemReadScatter)ctx->pfnVMMDLL_VmMemReadScatter)(ctx->hVMM, ctx->hVMMVM, ppMEMs, cpMEMs, 0);
37
28
  }
38
29
 
39
30
  VOID DeviceVMM_WriteScatter(_In_ PLC_CONTEXT ctxLC, _In_ DWORD cpMEMs, _Inout_ PPMEM_SCATTER ppMEMs)
40
31
  {
41
- PDEVICE_CONTEXT_VMM ctx = (PDEVICE_CONTEXT_VMM)ctxLC->hDevice;
42
- ctx->pfnVMMDLL_VmMemWriteScatter(ctx->hVMM, ctx->hVM, ppMEMs, cpMEMs);
32
+ PLC_VMM ctx = (PLC_VMM)ctxLC->hDevice;
33
+ ((FN_VMMDLL_VmMemWriteScatter)ctx->pfnVMMDLL_VmMemWriteScatter)(ctx->hVMM, ctx->hVMMVM, ppMEMs, cpMEMs);
43
34
  }
44
35
 
45
36
  VOID DeviceVMM_Close(_Inout_ PLC_CONTEXT ctxLC)
46
37
  {
47
- PDEVICE_CONTEXT_VMM ctx = (PDEVICE_CONTEXT_VMM)ctxLC->hDevice;
48
- if(ctx) {
49
- ctxLC->hDevice = 0;
50
- if(ctx->hModuleVMM) { FreeLibrary(ctx->hModuleVMM); }
51
- LocalFree(ctx);
52
- }
38
+ PLC_VMM ctx = (PLC_VMM)ctxLC->hDevice;
39
+ ctxLC->hDevice = 0;
40
+ LocalFree(ctx);
53
41
  }
54
42
 
55
- #define VMM_PARAMETER_HANDLE_VMM "hvmm"
56
- #define VMM_PARAMETER_HANDLE_VM "hvm"
43
+ #define VMM_PARAMETER_HANDLE_LCVMM "hlcvmm"
57
44
 
58
45
  _Success_(return)
59
46
  BOOL DeviceVMM_Open(_Inout_ PLC_CONTEXT ctxLC, _Out_opt_ PPLC_CONFIG_ERRORINFO ppLcCreateErrorInfo)
60
47
  {
61
- PDEVICE_CONTEXT_VMM ctx;
48
+ PLC_VMM ctx, ctxSrc;
62
49
  QWORD qwReadOnly = 0, qwVolatile = 0;
63
50
  if(ppLcCreateErrorInfo) { *ppLcCreateErrorInfo = NULL; }
64
51
  // 1: initialize core context:
65
- if(sizeof(PVOID) < 8) { return FALSE; } // only supported on 64-bit os (due to resource constraints)
66
- ctx = (PDEVICE_CONTEXT_VMM)LocalAlloc(LMEM_ZEROINIT, sizeof(DEVICE_CONTEXT_VMM));
52
+ if(sizeof(PVOID) != 8) { return FALSE; } // only supported on 64-bit os (due to resource constraints)
53
+ ctx = (PLC_VMM)LocalAlloc(LMEM_ZEROINIT, sizeof(LC_VMM));
67
54
  if(!ctx) { return FALSE; }
68
- ctxLC->hDevice = (HANDLE)ctx;
69
- // 2: initialize vmm references:
70
- ctx->hModuleVMM = LoadLibraryA("vmm.dll");
71
- if(!ctx->hModuleVMM) {
72
- lcprintfv(ctxLC, "DEVICE: VMM: Unable to open loopback device #1.\n");
73
- goto fail;
74
- }
75
- ctx->pfnFN_VMMDLL_ConfigGet = (FN_VMMDLL_ConfigGet)GetProcAddress(ctx->hModuleVMM, "VMMDLL_ConfigGet");
76
- ctx->pfnVMMDLL_VmMemReadScatter = (FN_VMMDLL_VmMemReadScatter)GetProcAddress(ctx->hModuleVMM, "VMMDLL_VmMemReadScatter");
77
- ctx->pfnVMMDLL_VmMemWriteScatter = (FN_VMMDLL_VmMemWriteScatter)GetProcAddress(ctx->hModuleVMM, "VMMDLL_VmMemWriteScatter");
78
- if(!ctx->pfnFN_VMMDLL_ConfigGet || !ctx->pfnVMMDLL_VmMemReadScatter || !ctx->pfnVMMDLL_VmMemWriteScatter) {
79
- lcprintfv(ctxLC, "DEVICE: VMM: Unable to open loopback device #2.\n");
55
+ // 2: initialize device
56
+ ctxSrc = (PLC_VMM)LcDeviceParameterGetNumeric(ctxLC, VMM_PARAMETER_HANDLE_LCVMM);
57
+ if(!ctxSrc || (ctxSrc->dwVersion != LC_VMM_VERSION) || !ctxSrc->hVMM || !ctxSrc->hVMMVM || !ctxSrc->pfnVMMDLL_ConfigGet || !ctxSrc->pfnVMMDLL_VmMemReadScatter || !ctxSrc->pfnVMMDLL_VmMemWriteScatter) {
58
+ lcprintfv(ctxLC, "DEVICE: VMM: Unable to open loopback device #1\n");
80
59
  goto fail;
81
60
  }
61
+ memcpy(ctx, ctxSrc, sizeof(LC_VMM));
82
62
  // 3: fetch config parameters:
83
- ctx->hVMM = (VMM_HANDLE)LcDeviceParameterGetNumeric(ctxLC, VMM_PARAMETER_HANDLE_VMM);
84
- ctx->hVM = (VMMVM_HANDLE)LcDeviceParameterGetNumeric(ctxLC, VMM_PARAMETER_HANDLE_VM);
85
- if(!ctx->pfnFN_VMMDLL_ConfigGet(ctx->hVMM, LC_OPT_CORE_VOLATILE, &qwVolatile)) { // inherit from vm parent vmm
63
+ if(!((FN_VMMDLL_ConfigGet)ctx->pfnVMMDLL_ConfigGet)(ctx->hVMM, LC_OPT_CORE_VOLATILE, &qwVolatile)) { // inherit from vm parent vmm
86
64
  lcprintfv(ctxLC, "DEVICE: VMM: Unable to communicate with loopback device #1.\n");
87
65
  goto fail;
88
66
  }
89
- if(!ctx->pfnFN_VMMDLL_ConfigGet(ctx->hVMM, LC_OPT_CORE_READONLY, &qwReadOnly)) { // inherit from vm parent vmm
67
+ if(!((FN_VMMDLL_ConfigGet)ctx->pfnVMMDLL_ConfigGet)(ctx->hVMM, LC_OPT_CORE_READONLY, &qwReadOnly)) { // inherit from vm parent vmm
90
68
  lcprintfv(ctxLC, "DEVICE: VMM: Unable to communicate with loopback device #2.\n");
91
69
  goto fail;
92
70
  }
@@ -14,7 +14,7 @@
14
14
  // (c) Ulf Frisk, 2020-2024
15
15
  // Author: Ulf Frisk, pcileech@frizk.net
16
16
  //
17
- // Header Version: 2.17
17
+ // Header Version: 2.18.4
18
18
  //
19
19
 
20
20
  #ifndef __LEECHCORE_H__
@@ -568,6 +568,26 @@ typedef VOID(*PLC_TLP_FUNCTION_CALLBACK)(
568
568
 
569
569
 
570
570
 
571
+ //-----------------------------------------------------------------------------
572
+ // VMM (VM) LOOPBACK SUPPORT:
573
+ // Functionality is used to create a VMM loopback device which is used by VMM
574
+ // to read and write memory to/from a virtual machine. See VMM for an example.
575
+ // Struct is passed in the 'hlcvmm' parameter to LcCreate() and will be copied.
576
+ //-----------------------------------------------------------------------------
577
+
578
+ #define LC_VMM_VERSION 0x1eef0001
579
+
580
+ typedef struct tdLC_VMM {
581
+ DWORD dwVersion;
582
+ HANDLE hVMM;
583
+ HANDLE hVMMVM;
584
+ PVOID pfnVMMDLL_ConfigGet;
585
+ PVOID pfnVMMDLL_VmMemReadScatter;
586
+ PVOID pfnVMMDLL_VmMemWriteScatter;
587
+ } LC_VMM, *PLC_VMM;
588
+
589
+
590
+
571
591
  //-----------------------------------------------------------------------------
572
592
  // PCIE BAR SUPPORT:
573
593
  //-----------------------------------------------------------------------------
@@ -240,9 +240,6 @@ HMODULE LoadLibraryA(LPSTR lpFileName)
240
240
  if(lpFileName && (0 == memcmp(lpFileName, "FTD2XX.dll", 10))) {
241
241
  lpFileName = "libftd2xx.so";
242
242
  }
243
- if(lpFileName && (0 == memcmp(lpFileName, "vmm.dll", 7))) {
244
- lpFileName = "vmm.so";
245
- }
246
243
  strncat(szFileName, lpFileName, MAX_PATH);
247
244
  return dlopen(szFileName, RTLD_NOW);
248
245
  }
@@ -3,8 +3,8 @@
3
3
 
4
4
  #define VERSION_MAJOR 2
5
5
  #define VERSION_MINOR 18
6
- #define VERSION_REVISION 0
7
- #define VERSION_BUILD 69
6
+ #define VERSION_REVISION 4
7
+ #define VERSION_BUILD 73
8
8
 
9
9
  #define VER_FILE_DESCRIPTION_STR "LeechCore Memory Acquisition Library"
10
10
  #define VER_FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.2
2
2
  Name: leechcorepyc
3
- Version: 2.18.0
3
+ Version: 2.18.4
4
4
  Summary: LeechCore for Python
5
5
  Home-page: https://github.com/ufrisk/LeechCore
6
6
  Author: Ulf Frisk
@@ -19,7 +19,7 @@ leechcorepyc = Extension(
19
19
 
20
20
  setup(
21
21
  name='leechcorepyc',
22
- version='2.18.0', # VERSION_END
22
+ version='2.18.4', # VERSION_END
23
23
  description='LeechCore for Python',
24
24
  long_description='LeechCore for Python : native extension for physical memory access',
25
25
  url='https://github.com/ufrisk/LeechCore',
File without changes
File without changes
File without changes
File without changes
File without changes