Package leechcore
Interface ILeechCore
public interface ILeechCore
The main LeechCore implementation for Java.
LeechCore for Java requires JNA - https://github.com/java-native-access/jna which must be on the classpath.
Check out the example code to get started! https://github.com/ufrisk/LeechCore/
LeechCore for Java requires JNA - https://github.com/java-native-access/jna which must be on the classpath.
Check out the example code to get started! https://github.com/ufrisk/LeechCore/
- Author:
- Ulf Frisk - pcileech@frizk.net
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final int
static final int
static final int
static final int
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the active instance of LeechCorebyte[]
command
(long fCommand, byte[] data) Execute a command.Retrieve info about the 6 PCIe BARs.Retrieve the memory map in use by LeechCore.Retrieve the native library path set at initialization time.long
getOption
(long fOption) Get a device specific option value.static ILeechCore
initializeLeechCore
(String lcNativeLibraryPath, String strDevice) Initialize a new LeechCore instance.static ILeechCore
initializeLeechCore
(String lcNativeLibraryPath, String strDevice, String strRemote, int flagsVerbose, long paMax) Initialize a new LeechCore instance.static ILeechCore
initializeLeechCore
(IVmm vmmInstance) Initialize a LeechCore instance from an already initialized Vmm instance.boolean
isValid()
Check whether the current LeechCore instance is active/valid or not.byte[]
memRead
(long pa, int size) Read a single chunk of memory.void
memWrite
(long pa, byte[] data) Write data to the memory.void
Set the memory map in use by LeechCorevoid
setOption
(long fOption, long qw) Set a device specific option value.setPCIeBarCallback
(ILeechCoreBarCallback callback) Set/Activate a BAR callback.setPCIeTlpCallback
(ILeechCoreTlpCallback callback) Set/Activate a TLP callback.void
writePCIeTLP
(byte[] tlp) Write a PCIe TLP (best effort).
-
Field Details
-
LC_CONFIG_PRINTF_ENABLED
static final int LC_CONFIG_PRINTF_ENABLED- See Also:
-
LC_CONFIG_PRINTF_V
static final int LC_CONFIG_PRINTF_V- See Also:
-
LC_CONFIG_PRINTF_VV
static final int LC_CONFIG_PRINTF_VV- See Also:
-
LC_CONFIG_PRINTF_VVV
static final int LC_CONFIG_PRINTF_VVV- See Also:
-
LC_OPT_CORE_PRINTF_ENABLE
static final long LC_OPT_CORE_PRINTF_ENABLE- See Also:
-
LC_OPT_CORE_VERBOSE
static final long LC_OPT_CORE_VERBOSE- See Also:
-
LC_OPT_CORE_VERBOSE_EXTRA
static final long LC_OPT_CORE_VERBOSE_EXTRA- See Also:
-
LC_OPT_CORE_VERBOSE_EXTRA_TLP
static final long LC_OPT_CORE_VERBOSE_EXTRA_TLP- See Also:
-
LC_OPT_CORE_VERSION_MAJOR
static final long LC_OPT_CORE_VERSION_MAJOR- See Also:
-
LC_OPT_CORE_VERSION_MINOR
static final long LC_OPT_CORE_VERSION_MINOR- See Also:
-
LC_OPT_CORE_VERSION_REVISION
static final long LC_OPT_CORE_VERSION_REVISION- See Also:
-
LC_OPT_CORE_ADDR_MAX
static final long LC_OPT_CORE_ADDR_MAX- See Also:
-
LC_OPT_CORE_STATISTICS_CALL_COUNT
static final long LC_OPT_CORE_STATISTICS_CALL_COUNT- See Also:
-
LC_OPT_CORE_STATISTICS_CALL_TIME
static final long LC_OPT_CORE_STATISTICS_CALL_TIME- See Also:
-
LC_OPT_CORE_VOLATILE
static final long LC_OPT_CORE_VOLATILE- See Also:
-
LC_OPT_CORE_READONLY
static final long LC_OPT_CORE_READONLY- See Also:
-
LC_OPT_MEMORYINFO_VALID
static final long LC_OPT_MEMORYINFO_VALID- See Also:
-
LC_OPT_MEMORYINFO_FLAG_32BIT
static final long LC_OPT_MEMORYINFO_FLAG_32BIT- See Also:
-
LC_OPT_MEMORYINFO_FLAG_PAE
static final long LC_OPT_MEMORYINFO_FLAG_PAE- See Also:
-
LC_OPT_MEMORYINFO_ARCH
static final long LC_OPT_MEMORYINFO_ARCH- See Also:
-
LC_OPT_MEMORYINFO_OS_VERSION_MINOR
static final long LC_OPT_MEMORYINFO_OS_VERSION_MINOR- See Also:
-
LC_OPT_MEMORYINFO_OS_VERSION_MAJOR
static final long LC_OPT_MEMORYINFO_OS_VERSION_MAJOR- See Also:
-
LC_OPT_MEMORYINFO_OS_DTB
static final long LC_OPT_MEMORYINFO_OS_DTB- See Also:
-
LC_OPT_MEMORYINFO_OS_PFN
static final long LC_OPT_MEMORYINFO_OS_PFN- See Also:
-
LC_OPT_MEMORYINFO_OS_PsLoadedModuleList
static final long LC_OPT_MEMORYINFO_OS_PsLoadedModuleList- See Also:
-
LC_OPT_MEMORYINFO_OS_PsActiveProcessHead
static final long LC_OPT_MEMORYINFO_OS_PsActiveProcessHead- See Also:
-
LC_OPT_MEMORYINFO_OS_MACHINE_IMAGE_TP
static final long LC_OPT_MEMORYINFO_OS_MACHINE_IMAGE_TP- See Also:
-
LC_OPT_MEMORYINFO_OS_NUM_PROCESSORS
static final long LC_OPT_MEMORYINFO_OS_NUM_PROCESSORS- See Also:
-
LC_OPT_MEMORYINFO_OS_SYSTEMTIME
static final long LC_OPT_MEMORYINFO_OS_SYSTEMTIME- See Also:
-
LC_OPT_MEMORYINFO_OS_UPTIME
static final long LC_OPT_MEMORYINFO_OS_UPTIME- See Also:
-
LC_OPT_MEMORYINFO_OS_KERNELBASE
static final long LC_OPT_MEMORYINFO_OS_KERNELBASE- See Also:
-
LC_OPT_MEMORYINFO_OS_KERNELHINT
static final long LC_OPT_MEMORYINFO_OS_KERNELHINT- See Also:
-
LC_OPT_MEMORYINFO_OS_KdDebuggerDataBlock
static final long LC_OPT_MEMORYINFO_OS_KdDebuggerDataBlock- See Also:
-
LC_OPT_FPGA_PROBE_MAXPAGES
static final long LC_OPT_FPGA_PROBE_MAXPAGES- See Also:
-
LC_OPT_FPGA_MAX_SIZE_RX
static final long LC_OPT_FPGA_MAX_SIZE_RX- See Also:
-
LC_OPT_FPGA_MAX_SIZE_TX
static final long LC_OPT_FPGA_MAX_SIZE_TX- See Also:
-
LC_OPT_FPGA_DELAY_PROBE_READ
static final long LC_OPT_FPGA_DELAY_PROBE_READ- See Also:
-
LC_OPT_FPGA_DELAY_PROBE_WRITE
static final long LC_OPT_FPGA_DELAY_PROBE_WRITE- See Also:
-
LC_OPT_FPGA_DELAY_WRITE
static final long LC_OPT_FPGA_DELAY_WRITE- See Also:
-
LC_OPT_FPGA_DELAY_READ
static final long LC_OPT_FPGA_DELAY_READ- See Also:
-
LC_OPT_FPGA_RETRY_ON_ERROR
static final long LC_OPT_FPGA_RETRY_ON_ERROR- See Also:
-
LC_OPT_FPGA_DEVICE_ID
static final long LC_OPT_FPGA_DEVICE_ID- See Also:
-
LC_OPT_FPGA_FPGA_ID
static final long LC_OPT_FPGA_FPGA_ID- See Also:
-
LC_OPT_FPGA_VERSION_MAJOR
static final long LC_OPT_FPGA_VERSION_MAJOR- See Also:
-
LC_OPT_FPGA_VERSION_MINOR
static final long LC_OPT_FPGA_VERSION_MINOR- See Also:
-
LC_OPT_FPGA_ALGO_TINY
static final long LC_OPT_FPGA_ALGO_TINY- See Also:
-
LC_OPT_FPGA_ALGO_SYNCHRONOUS
static final long LC_OPT_FPGA_ALGO_SYNCHRONOUS- See Also:
-
LC_OPT_FPGA_CFGSPACE_XILINX
static final long LC_OPT_FPGA_CFGSPACE_XILINX- See Also:
-
LC_OPT_FPGA_TLP_READ_CB_WITHINFO
static final long LC_OPT_FPGA_TLP_READ_CB_WITHINFO- See Also:
-
LC_OPT_FPGA_TLP_READ_CB_FILTERCPL
static final long LC_OPT_FPGA_TLP_READ_CB_FILTERCPL- See Also:
-
LC_CMD_FPGA_PCIECFGSPACE
static final long LC_CMD_FPGA_PCIECFGSPACE- See Also:
-
LC_CMD_FPGA_CFGREGPCIE
static final long LC_CMD_FPGA_CFGREGPCIE- See Also:
-
LC_CMD_FPGA_CFGREGCFG
static final long LC_CMD_FPGA_CFGREGCFG- See Also:
-
LC_CMD_FPGA_CFGREGDRP
static final long LC_CMD_FPGA_CFGREGDRP- See Also:
-
LC_CMD_FPGA_CFGREGCFG_MARKWR
static final long LC_CMD_FPGA_CFGREGCFG_MARKWR- See Also:
-
LC_CMD_FPGA_CFGREGPCIE_MARKWR
static final long LC_CMD_FPGA_CFGREGPCIE_MARKWR- See Also:
-
LC_CMD_FPGA_CFGREG_DEBUGPRINT
static final long LC_CMD_FPGA_CFGREG_DEBUGPRINT- See Also:
-
LC_CMD_FPGA_PROBE
static final long LC_CMD_FPGA_PROBE- See Also:
-
LC_CMD_FPGA_CFGSPACE_SHADOW_RD
static final long LC_CMD_FPGA_CFGSPACE_SHADOW_RD- See Also:
-
LC_CMD_FPGA_CFGSPACE_SHADOW_WR
static final long LC_CMD_FPGA_CFGSPACE_SHADOW_WR- See Also:
-
LC_CMD_FPGA_TLP_WRITE_SINGLE
static final long LC_CMD_FPGA_TLP_WRITE_SINGLE- See Also:
-
LC_CMD_FPGA_TLP_WRITE_MULTIPLE
static final long LC_CMD_FPGA_TLP_WRITE_MULTIPLE- See Also:
-
LC_CMD_FPGA_TLP_TOSTRING
static final long LC_CMD_FPGA_TLP_TOSTRING- See Also:
-
LC_CMD_FPGA_TLP_CONTEXT
static final long LC_CMD_FPGA_TLP_CONTEXT- See Also:
-
LC_CMD_FPGA_TLP_CONTEXT_RD
static final long LC_CMD_FPGA_TLP_CONTEXT_RD- See Also:
-
LC_CMD_FPGA_TLP_FUNCTION_CALLBACK
static final long LC_CMD_FPGA_TLP_FUNCTION_CALLBACK- See Also:
-
LC_CMD_FPGA_TLP_FUNCTION_CALLBACK_RD
static final long LC_CMD_FPGA_TLP_FUNCTION_CALLBACK_RD- See Also:
-
LC_CMD_FPGA_BAR_CONTEXT
static final long LC_CMD_FPGA_BAR_CONTEXT- See Also:
-
LC_CMD_FPGA_BAR_CONTEXT_RD
static final long LC_CMD_FPGA_BAR_CONTEXT_RD- See Also:
-
LC_CMD_FPGA_BAR_FUNCTION_CALLBACK
static final long LC_CMD_FPGA_BAR_FUNCTION_CALLBACK- See Also:
-
LC_CMD_FPGA_BAR_FUNCTION_CALLBACK_RD
static final long LC_CMD_FPGA_BAR_FUNCTION_CALLBACK_RD- See Also:
-
LC_CMD_FPGA_BAR_INFO
static final long LC_CMD_FPGA_BAR_INFO- See Also:
-
LC_CMD_FILE_DUMPHEADER_GET
static final long LC_CMD_FILE_DUMPHEADER_GET- See Also:
-
LC_CMD_STATISTICS_GET
static final long LC_CMD_STATISTICS_GET- See Also:
-
LC_CMD_MEMMAP_GET
static final long LC_CMD_MEMMAP_GET- See Also:
-
LC_CMD_MEMMAP_SET
static final long LC_CMD_MEMMAP_SET- See Also:
-
LC_CMD_MEMMAP_GET_STRUCT
static final long LC_CMD_MEMMAP_GET_STRUCT- See Also:
-
LC_CMD_MEMMAP_SET_STRUCT
static final long LC_CMD_MEMMAP_SET_STRUCT- See Also:
-
LC_CMD_AGENT_EXEC_PYTHON
static final long LC_CMD_AGENT_EXEC_PYTHON- See Also:
-
LC_CMD_AGENT_EXIT_PROCESS
static final long LC_CMD_AGENT_EXIT_PROCESS- See Also:
-
LC_CMD_AGENT_VFS_LIST
static final long LC_CMD_AGENT_VFS_LIST- See Also:
-
LC_CMD_AGENT_VFS_READ
static final long LC_CMD_AGENT_VFS_READ- See Also:
-
LC_CMD_AGENT_VFS_WRITE
static final long LC_CMD_AGENT_VFS_WRITE- See Also:
-
LC_CMD_AGENT_VFS_OPT_GET
static final long LC_CMD_AGENT_VFS_OPT_GET- See Also:
-
LC_CMD_AGENT_VFS_OPT_SET
static final long LC_CMD_AGENT_VFS_OPT_SET- See Also:
-
LC_CMD_AGENT_VFS_INITIALIZE
static final long LC_CMD_AGENT_VFS_INITIALIZE- See Also:
-
LC_CMD_AGENT_VFS_CONSOLE
static final long LC_CMD_AGENT_VFS_CONSOLE- See Also:
-
-
Method Details
-
initializeLeechCore
Initialize a LeechCore instance from an already initialized Vmm instance.- Parameters:
vmmInstance
-- Returns:
-
initializeLeechCore
Initialize a new LeechCore instance.- Parameters:
lcNativeLibraryPath
- path to vmm.dll / vmm.so native binaries, ex: "C:\\Program FIles\\MemProcFS".strDevice
- LeechCore device, i.e. dump file name or fpga://- Returns:
-
initializeLeechCore
static ILeechCore initializeLeechCore(String lcNativeLibraryPath, String strDevice, String strRemote, int flagsVerbose, long paMax) Initialize a new LeechCore instance.- Parameters:
lcNativeLibraryPath
-strDevice
-strRemote
-flagsVerbose
-paMax
-- Returns:
-
isValid
boolean isValid()Check whether the current LeechCore instance is active/valid or not.- Returns:
-
getNativeLibraryPath
String getNativeLibraryPath()Retrieve the native library path set at initialization time.- Returns:
-
close
void close()Close the active instance of LeechCore -
memRead
byte[] memRead(long pa, int size) Read a single chunk of memory.- Parameters:
pa
- physical address to read.size
- number of bytes to read.- Returns:
-
memWrite
void memWrite(long pa, byte[] data) Write data to the memory. NB! writing may fail silently. If important it's recommended to verify a write with a subsequent read.- Parameters:
pa
- physical address to read.data
- data to write.
-
getMemMap
String getMemMap()Retrieve the memory map in use by LeechCore.- Returns:
-
setMemMap
Set the memory map in use by LeechCore- Parameters:
strMemMap
-
-
getOption
long getOption(long fOption) Get a device specific option value. Please see defines LC_OPT_* for information about valid option values. Please note that option values may overlap between different device types with different meanings.- Parameters:
fOption
-- Returns:
-
setOption
void setOption(long fOption, long qw) Set a device specific option value. Please see defines LC_OPT_* for information about valid option values. Please note that option values may overlap between different device types with different meanings.- Parameters:
fOption
-qw
-
-
command
byte[] command(long fCommand, byte[] data) Execute a command. See defines LC_CMD_* for information about valid commands.- Parameters:
fCommand
-data
-- Returns:
-
getBarInfo
LeechCoreBar[] getBarInfo()Retrieve info about the 6 PCIe BARs. [PCIe FPGA backend only].- Returns:
- an array of 6 PCIe BARs.
-
setPCIeBarCallback
Set/Activate a BAR callback. When a BAR access is requested by the host system this callback will be called. Only one callback may be active at a given time. Close callback by calling close() on the returned context.- Parameters:
callback
-- Returns:
-
setPCIeTlpCallback
Set/Activate a TLP callback. When a PCIe TLP packet is received this callback will be called. Only one callback may be active at a given time. Close callback by calling close() on the returned context.- Parameters:
callback
-- Returns:
-
writePCIeTLP
void writePCIeTLP(byte[] tlp) Write a PCIe TLP (best effort).- Parameters:
tlp
-
-