2026-08-11 00:23:02 +08:00
|
|
|
|
/**
|
2024-08-11 19:42:58 +09:00
|
|
|
|
* @file main.cpp
|
|
|
|
|
|
* @author Sina Karvandi (sina@hyperdbg.org)
|
|
|
|
|
|
* @brief perform tests
|
|
|
|
|
|
* @details
|
|
|
|
|
|
* @version 0.11
|
|
|
|
|
|
* @date 2024-08-11
|
|
|
|
|
|
*
|
|
|
|
|
|
* @copyright This project is released under the GNU Public License v3.
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
#include "pch.h"
|
|
|
|
|
|
|
2026-08-11 00:23:02 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @brief Main function of test process
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param argc
|
|
|
|
|
|
* @param argv
|
|
|
|
|
|
* @return int
|
|
|
|
|
|
*/
|
2024-08-11 19:42:58 +09:00
|
|
|
|
int
|
2026-08-11 00:23:02 +08:00
|
|
|
|
main(int argc, char* argv[])
|
2024-08-11 19:42:58 +09:00
|
|
|
|
{
|
2024-08-13 19:31:02 +09:00
|
|
|
|
if (argc != 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
printf("you should not test functionalities directly, instead use 'test all' "
|
2026-08-11 00:23:02 +08:00
|
|
|
|
"command from HyperDbg...\n");
|
2024-08-13 19:31:02 +09:00
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
2024-08-11 19:42:58 +09:00
|
|
|
|
|
2024-08-16 16:14:52 +09:00
|
|
|
|
if (!strcmp(argv[1], TEST_CASE_PARAMETER_FOR_MAIN_COMMAND_PARSER))
|
2024-08-13 19:31:02 +09:00
|
|
|
|
{
|
|
|
|
|
|
//
|
|
|
|
|
|
// # Test case 1
|
|
|
|
|
|
// Testing command parser
|
|
|
|
|
|
//
|
|
|
|
|
|
if (TestCommandParser())
|
|
|
|
|
|
{
|
|
|
|
|
|
printf("\n[*] The main command parser test cases passed successfully\n");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2024-10-02 15:04:02 +02:00
|
|
|
|
printf("\n[x] The main command parser test cases failed\n");
|
2024-08-13 19:31:02 +09:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-06-02 11:20:05 +01:00
|
|
|
|
else if (!strcmp(argv[1], TEST_CASE_PARAMETER_FOR_PE_PARSER))
|
2024-08-16 16:14:52 +09:00
|
|
|
|
{
|
|
|
|
|
|
//
|
|
|
|
|
|
// # Test case 2
|
2026-06-02 11:20:05 +01:00
|
|
|
|
// Testing PE parser helpers
|
|
|
|
|
|
//
|
|
|
|
|
|
if (TestPeParser())
|
|
|
|
|
|
{
|
|
|
|
|
|
printf("\n[*] The PE parser test cases passed successfully\n");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
printf("\n[x] The PE parser test cases failed\n");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (!strcmp(argv[1], TEST_CASE_PARAMETER_FOR_SCRIPT_SEMANTIC_TEST_CASES))
|
|
|
|
|
|
{
|
|
|
|
|
|
//
|
|
|
|
|
|
// # Test case 3
|
2024-08-16 16:14:52 +09:00
|
|
|
|
// Testing script semantic test cases
|
|
|
|
|
|
//
|
|
|
|
|
|
if (TestSemanticScripts())
|
|
|
|
|
|
{
|
|
|
|
|
|
printf("\n[*] The script semantic test cases passed successfully\n");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2024-10-02 15:04:02 +02:00
|
|
|
|
printf("\n[x] The script semantic test cases failed\n");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-06-04 18:25:24 +01:00
|
|
|
|
else if (!strcmp(argv[1], TEST_CASE_PARAMETER_FOR_CODEVIEW_RSDS_PARSER))
|
|
|
|
|
|
{
|
|
|
|
|
|
//
|
|
|
|
|
|
// # Test case 4
|
|
|
|
|
|
// Testing CodeView RSDS parser helpers
|
|
|
|
|
|
//
|
|
|
|
|
|
if (TestCodeViewRsdsParser())
|
|
|
|
|
|
{
|
|
|
|
|
|
printf("\n[*] The CodeView RSDS parser test cases passed successfully\n");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
printf("\n[x] The CodeView RSDS parser test cases failed\n");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-10-02 15:04:02 +02:00
|
|
|
|
else if (!strcmp(argv[1], TEST_HWDBG_FUNCTIONALITIES))
|
|
|
|
|
|
{
|
|
|
|
|
|
//
|
|
|
|
|
|
// # Test hwdbg functionalities
|
|
|
|
|
|
//
|
|
|
|
|
|
if (HwdbgTestCreateTestCases())
|
|
|
|
|
|
{
|
|
|
|
|
|
printf("\n[*] The hwdbg test cases passed successfully\n");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
printf("\n[x] The hwdbg test cases failed\n");
|
2024-08-16 16:14:52 +09:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-08-13 19:31:02 +09:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
printf("unknown test case\n");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-08-11 00:23:02 +08:00
|
|
|
|
printf("\npress any key to exit...");
|
|
|
|
|
|
|
|
|
|
|
|
_getch();
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
2024-08-11 19:42:58 +09:00
|
|
|
|
}
|