mirror of
https://github.com/HyperDbg/HyperDbg.git
synced 2026-07-09 17:19:26 +00:00
add Intel PT libraries
This commit is contained in:
parent
9ad48d30dc
commit
e04ee4dcc3
11 changed files with 3315 additions and 30 deletions
|
|
@ -3,7 +3,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <dbghelp.h>
|
||||
#include <intel-pt.h>
|
||||
#include "../dependencies/libipt/intel-pt.h"
|
||||
#include <Zydis/Zydis.h>
|
||||
|
||||
#pragma comment(lib, "dbghelp.lib")
|
||||
|
|
@ -496,7 +496,7 @@ Cleanup:
|
|||
}
|
||||
|
||||
static int
|
||||
LoadVmm()
|
||||
LoadVmmAndTrace()
|
||||
{
|
||||
hyperdbg_u_set_text_message_callback((PVOID)ShowMessages);
|
||||
|
||||
|
|
@ -514,11 +514,22 @@ LoadVmm()
|
|||
}
|
||||
|
||||
printf("[+] HyperDbg VMM is running\n");
|
||||
|
||||
printf("[*] loading HyperTrace...\n");
|
||||
|
||||
if ( hyperdbg_u_load_hypertrace_module() == 1)
|
||||
{
|
||||
printf("[-] cannot load the HyperDbg HyperTrace\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("[+] HyperDbg HyperTrace is running\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char ** argv)
|
||||
main2(int argc, char ** argv)
|
||||
{
|
||||
const char * function = "main";
|
||||
BOOLEAN packets = FALSE;
|
||||
|
|
@ -546,7 +557,7 @@ main(int argc, char ** argv)
|
|||
function = argv[i];
|
||||
}
|
||||
|
||||
if (LoadVmm() != 0)
|
||||
if (LoadVmmAndTrace() != 0)
|
||||
return 1;
|
||||
|
||||
RunAndTrace(argv[1], function, packets, pinCore);
|
||||
|
|
|
|||
56
examples/user/hyperdbg_app/code/hyperdbg-ipt.cpp
Normal file
56
examples/user/hyperdbg_app/code/hyperdbg-ipt.cpp
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#include "pch.h"
|
||||
|
||||
static int
|
||||
ShowMessages(const char * Text)
|
||||
{
|
||||
printf("%s", Text);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
LoadVmm()
|
||||
{
|
||||
hyperdbg_u_set_text_message_callback((PVOID)ShowMessages);
|
||||
|
||||
if (!hyperdbg_u_detect_vmx_support())
|
||||
{
|
||||
printf("[-] VT-x (VMX) is not supported / enabled on this processor\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("[*] loading HyperDbg VMM...\n");
|
||||
if (hyperdbg_u_install_kd_driver() == 1 || hyperdbg_u_load_vmm() == 1)
|
||||
{
|
||||
printf("[-] cannot load the HyperDbg VMM\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("[+] HyperDbg VMM is running\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char ** argv)
|
||||
{
|
||||
if (LoadVmm() != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
hyperdbg_u_run_command((CHAR*)"lm");
|
||||
|
||||
printf("[*] unloading HyperDbg VMM...\n");
|
||||
|
||||
//
|
||||
// Unload the driver
|
||||
//
|
||||
hyperdbg_u_unload_vmm();
|
||||
hyperdbg_u_unload_kd();
|
||||
hyperdbg_u_stop_kd_driver();
|
||||
hyperdbg_u_uninstall_kd_driver();
|
||||
|
||||
printf("[+] done\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
16
examples/user/hyperdbg_app/header/example-ipt.h
Normal file
16
examples/user/hyperdbg_app/header/example-ipt.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* @file example-ipt.h
|
||||
* @author Sina Karvandi (sina@hyperdbg.org)
|
||||
* @brief Headers for Intel PT example
|
||||
* @details
|
||||
*
|
||||
* @version 0.20
|
||||
* @date 2026-06-13
|
||||
*
|
||||
* @copyright This project is released under the GNU Public License v3.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
int
|
||||
main2(int argc, char** argv);
|
||||
|
|
@ -38,3 +38,8 @@
|
|||
//
|
||||
#include "SDK/HyperDbgSdk.h"
|
||||
#include "SDK/imports/user/HyperDbgLibImports.h"
|
||||
|
||||
//
|
||||
// Other internal headers
|
||||
//
|
||||
#include "example-ipt.h"
|
||||
|
|
|
|||
|
|
@ -11,10 +11,12 @@
|
|||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="header\example-ipt.h" />
|
||||
<ClInclude Include="header\pch.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="code\hyperdbg-app.cpp" />
|
||||
<ClCompile Include="code\hyperdbg-ipt.cpp" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
|
|
@ -60,10 +62,12 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
|
||||
<OutDir>$(SolutionDir)build\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)build\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
||||
<PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
|
||||
<OutDir>$(SolutionDir)build\bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)build\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
||||
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
|
||||
<ClCompile>
|
||||
|
|
@ -81,12 +85,14 @@
|
|||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(LibIptDir)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(SolutionDir)build\bin\$(Configuration)\libhyperdbg.lib;$(SolutionDir)libraries\zydis\user\Zydis.lib;$(SolutionDir)libraries\zydis\user\Zycore.lib;libipt.lib</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(SolutionDir)build\bin\$(Configuration)\libhyperdbg.lib;$(SolutionDir)libraries\zydis\user\Zydis.lib;$(SolutionDir)libraries\zydis\user\Zycore.lib;$(SolutionDir)libraries\libipt\libipt.lib</AdditionalDependencies>
|
||||
<TreatLinkerWarningAsErrors>false</TreatLinkerWarningAsErrors>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /Y "$(LibIptDir)\bin\libipt.dll" "$(OutDir)libipt.dll"</Command>
|
||||
<Message>Copying libipt.dll (Intel PT decoder) to output directory</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
<Message>
|
||||
</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
|
||||
|
|
@ -110,12 +116,14 @@
|
|||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(LibIptDir)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(SolutionDir)build\bin\$(Configuration)\libhyperdbg.lib;$(SolutionDir)libraries\zydis\user\Zydis.lib;$(SolutionDir)libraries\zydis\user\Zycore.lib;libipt.lib</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(SolutionDir)build\bin\$(Configuration)\libhyperdbg.lib;$(SolutionDir)libraries\zydis\user\Zydis.lib;$(SolutionDir)libraries\zydis\user\Zycore.lib;$(SolutionDir)libraries\libipt\libipt.lib</AdditionalDependencies>
|
||||
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /Y "$(LibIptDir)\bin\libipt.dll" "$(OutDir)libipt.dll"</Command>
|
||||
<Message>Copying libipt.dll (Intel PT decoder) to output directory</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
<Message>
|
||||
</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
|||
|
|
@ -15,10 +15,16 @@
|
|||
<ClInclude Include="header\pch.h">
|
||||
<Filter>header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="header\example-ipt.h">
|
||||
<Filter>header</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="code\hyperdbg-app.cpp">
|
||||
<Filter>code</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="code\hyperdbg-ipt.cpp">
|
||||
<Filter>code</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
3177
hyperdbg/dependencies/libipt/intel-pt.h
Normal file
3177
hyperdbg/dependencies/libipt/intel-pt.h
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -82,15 +82,16 @@
|
|||
<PostBuildEvent>
|
||||
<Command>if exist "$(OutDir)SDK\" rd /q /s "$(OutDir)SDK\"
|
||||
xcopy /E /I /Y "$(SolutionDir)include\SDK" "$(OutDir)SDK"
|
||||
xcopy /E /I /Y "$(SolutionDir)..\examples" "$(OutDir)SDK\Examples"
|
||||
mkdir "$(OutDir)SDK\Libraries"
|
||||
copy "$(OutDir)pdbex.lib" "$(OutDir)SDK\Libraries\pdbex.lib"
|
||||
copy "$(OutDir)kdserial.lib" "$(OutDir)SDK\Libraries\kdserial.lib"
|
||||
copy "$(OutDir)libhyperdbg.dll" "$(OutDir)SDK\Libraries\libhyperdbg.dll"
|
||||
copy "$(OutDir)script-engine.dll" "$(OutDir)SDK\Libraries\script-engine.dll"
|
||||
copy "$(OutDir)symbol-parser.dll" "$(OutDir)SDK\Libraries\symbol-parser.dll"
|
||||
copy "$(OutDir)hyperlog.dll" "$(OutDir)SDK\Libraries\hyperlog.dll"
|
||||
copy "$(OutDir)hyperhv.dll" "$(OutDir)SDK\Libraries\hyperhv.dll"
|
||||
xcopy /E /I /Y "$(SolutionDir)..\examples" "$(OutDir)SDK\examples"
|
||||
mkdir "$(OutDir)SDK\libraries"
|
||||
copy "$(OutDir)pdbex.lib" "$(OutDir)SDK\libraries\pdbex.lib"
|
||||
copy "$(OutDir)kdserial.lib" "$(OutDir)SDK\libraries\kdserial.lib"
|
||||
copy "$(OutDir)libhyperdbg.dll" "$(OutDir)SDK\libraries\libhyperdbg.dll"
|
||||
copy "$(OutDir)script-engine.dll" "$(OutDir)SDK\libraries\script-engine.dll"
|
||||
copy "$(OutDir)symbol-parser.dll" "$(OutDir)SDK\libraries\symbol-parser.dll"
|
||||
copy "$(OutDir)hyperlog.dll" "$(OutDir)SDK\libraries\hyperlog.dll"
|
||||
copy "$(OutDir)hyperhv.dll" "$(OutDir)SDK\libraries\hyperhv.dll"
|
||||
copy "$(OutDir)libipt.dll" "$(OutDir)SDK\libraries\libipt.dll"
|
||||
if exist "$(OutDir)constants\" rd /q /s "$(OutDir)constants\"
|
||||
mkdir "$(OutDir)constants"
|
||||
copy "$(SolutionDir)miscellaneous\constants\pciid\pci.ids" "$(OutDir)constants\pci.ids"</Command>
|
||||
|
|
@ -126,15 +127,16 @@ copy "$(SolutionDir)miscellaneous\constants\pciid\pci.ids" "$(OutDir)constants\p
|
|||
<PostBuildEvent>
|
||||
<Command>if exist "$(OutDir)SDK\" rd /q /s "$(OutDir)SDK\"
|
||||
xcopy /E /I /Y "$(SolutionDir)include\SDK" "$(OutDir)SDK"
|
||||
xcopy /E /I /Y "$(SolutionDir)..\examples" "$(OutDir)SDK\Examples"
|
||||
mkdir "$(OutDir)SDK\Libraries"
|
||||
copy "$(OutDir)pdbex.lib" "$(OutDir)SDK\Libraries\pdbex.lib"
|
||||
copy "$(OutDir)kdserial.lib" "$(OutDir)SDK\Libraries\kdserial.lib"
|
||||
copy "$(OutDir)libhyperdbg.dll" "$(OutDir)SDK\Libraries\libhyperdbg.dll"
|
||||
copy "$(OutDir)script-engine.dll" "$(OutDir)SDK\Libraries\script-engine.dll"
|
||||
copy "$(OutDir)symbol-parser.dll" "$(OutDir)SDK\Libraries\symbol-parser.dll"
|
||||
copy "$(OutDir)hyperlog.dll" "$(OutDir)SDK\Libraries\hyperlog.dll"
|
||||
copy "$(OutDir)hyperhv.dll" "$(OutDir)SDK\Libraries\hyperhv.dll"
|
||||
xcopy /E /I /Y "$(SolutionDir)..\examples" "$(OutDir)SDK\examples"
|
||||
mkdir "$(OutDir)SDK\libraries"
|
||||
copy "$(OutDir)pdbex.lib" "$(OutDir)SDK\libraries\pdbex.lib"
|
||||
copy "$(OutDir)kdserial.lib" "$(OutDir)SDK\libraries\kdserial.lib"
|
||||
copy "$(OutDir)libhyperdbg.dll" "$(OutDir)SDK\libraries\libhyperdbg.dll"
|
||||
copy "$(OutDir)script-engine.dll" "$(OutDir)SDK\libraries\script-engine.dll"
|
||||
copy "$(OutDir)symbol-parser.dll" "$(OutDir)SDK\libraries\symbol-parser.dll"
|
||||
copy "$(OutDir)hyperlog.dll" "$(OutDir)SDK\libraries\hyperlog.dll"
|
||||
copy "$(OutDir)hyperhv.dll" "$(OutDir)SDK\libraries\hyperhv.dll"
|
||||
copy "$(OutDir)libipt.dll" "$(OutDir)SDK\libraries\libipt.dll"
|
||||
if exist "$(OutDir)constants\" rd /q /s "$(OutDir)constants\"
|
||||
mkdir "$(OutDir)constants"
|
||||
copy "$(SolutionDir)miscellaneous\constants\pciid\pci.ids" "$(OutDir)constants\pci.ids"</Command>
|
||||
|
|
|
|||
|
|
@ -87,7 +87,9 @@
|
|||
</Command>
|
||||
</PostBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Command>msbuild "$(SolutionDir)dependencies\zydis\msvc\Zydis.sln" /m /p:Configuration="Release MT" /p:Platform=$(Platform) /target:zydis /target:zycore /p:OutDir="$(SolutionDir)libraries\zydis\user"</Command>
|
||||
<Command>copy "$(SolutionDir)libraries\libipt\libipt.lib" "$(OutDir)"
|
||||
copy "$(SolutionDir)libraries\libipt\libipt.dll" "$(OutDir)"
|
||||
msbuild "$(SolutionDir)dependencies\zydis\msvc\Zydis.sln" /m /p:Configuration="Release MT" /p:Platform=$(Platform) /target:zydis /target:zycore /p:OutDir="$(SolutionDir)libraries\zydis\user"</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
|
||||
|
|
@ -123,7 +125,9 @@
|
|||
</Command>
|
||||
</PostBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Command>msbuild "$(SolutionDir)dependencies\zydis\msvc\Zydis.sln" /m /p:Configuration="Release MT" /p:Platform=$(Platform) /target:zydis /target:zycore /p:OutDir="$(SolutionDir)libraries\zydis\user"</Command>
|
||||
<Command>copy "$(SolutionDir)libraries\libipt\libipt.lib" "$(OutDir)"
|
||||
copy "$(SolutionDir)libraries\libipt\libipt.dll" "$(OutDir)"
|
||||
msbuild "$(SolutionDir)dependencies\zydis\msvc\Zydis.sln" /m /p:Configuration="Release MT" /p:Platform=$(Platform) /target:zydis /target:zycore /p:OutDir="$(SolutionDir)libraries\zydis\user"</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
|||
BIN
hyperdbg/libraries/libipt/libipt.dll
Normal file
BIN
hyperdbg/libraries/libipt/libipt.dll
Normal file
Binary file not shown.
BIN
hyperdbg/libraries/libipt/libipt.lib
Normal file
BIN
hyperdbg/libraries/libipt/libipt.lib
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue