added cli parser, compiles, cmkr finished...

main
xerox 3 years ago
parent ddce00210e
commit 3dbefbe1c3

1
.gitignore vendored

@ -9,6 +9,7 @@
*.user
*.userosscache
*.sln.docstates
*.o
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

3
.gitmodules vendored

@ -4,3 +4,6 @@
[submodule "deps/unicorn"]
path = deps/unicorn
url = https://github.com/unicorn-engine/unicorn.git
[submodule "deps/cli-parser"]
path = deps/cli-parser
url = https://githacks.org/_xeroxz/cli-parser.git

@ -0,0 +1,80 @@
# This file is automatically generated from cmake.toml - DO NOT EDIT
# See https://github.com/build-cpp/cmkr for more information
cmake_minimum_required(VERSION 3.15)
# Regenerate CMakeLists.txt automatically in the root project
set(CMKR_ROOT_PROJECT OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CMKR_ROOT_PROJECT ON)
# Bootstrap cmkr
include(cmkr.cmake OPTIONAL RESULT_VARIABLE CMKR_INCLUDE_RESULT)
if(CMKR_INCLUDE_RESULT)
cmkr()
endif()
# Enable folder support
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
# Create a configure-time dependency on cmake.toml to improve IDE support
if(CMKR_ROOT_PROJECT)
configure_file(cmake.toml cmake.toml COPYONLY)
endif()
project(vmemu)
# deps
set(CMKR_CMAKE_FOLDER ${CMAKE_FOLDER})
if(CMAKE_FOLDER)
set(CMAKE_FOLDER "${CMAKE_FOLDER}/deps")
else()
set(CMAKE_FOLDER deps)
endif()
add_subdirectory(deps)
set(CMAKE_FOLDER ${CMKR_CMAKE_FOLDER})
# Target vmemu
set(CMKR_TARGET vmemu)
set(vmemu_SOURCES "")
list(APPEND vmemu_SOURCES
"src/main.cpp"
)
list(APPEND vmemu_SOURCES
cmake.toml
)
set(CMKR_SOURCES ${vmemu_SOURCES})
add_executable(vmemu)
if(vmemu_SOURCES)
target_sources(vmemu PRIVATE ${vmemu_SOURCES})
endif()
get_directory_property(CMKR_VS_STARTUP_PROJECT DIRECTORY ${PROJECT_SOURCE_DIR} DEFINITION VS_STARTUP_PROJECT)
if(NOT CMKR_VS_STARTUP_PROJECT)
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT vmemu)
endif()
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${vmemu_SOURCES})
target_compile_definitions(vmemu PRIVATE
NOMINMAX
)
target_include_directories(vmemu PRIVATE
include
)
target_link_libraries(vmemu PRIVATE
vmprofiler
unicorn
cli-parser
)
unset(CMKR_TARGET)
unset(CMKR_SOURCES)

@ -0,0 +1,46 @@
# This file is automatically generated from cmake.toml - DO NOT EDIT
# See https://github.com/build-cpp/cmkr for more information
# Create a configure-time dependency on cmake.toml to improve IDE support
if(CMKR_ROOT_PROJECT)
configure_file(cmake.toml cmake.toml COPYONLY)
endif()
# vmprofiler
set(CMKR_CMAKE_FOLDER ${CMAKE_FOLDER})
if(CMAKE_FOLDER)
set(CMAKE_FOLDER "${CMAKE_FOLDER}/vmprofiler")
else()
set(CMAKE_FOLDER vmprofiler)
endif()
add_subdirectory(vmprofiler)
set(CMAKE_FOLDER ${CMKR_CMAKE_FOLDER})
# unicorn
set(CMKR_CMAKE_FOLDER ${CMAKE_FOLDER})
if(CMAKE_FOLDER)
set(CMAKE_FOLDER "${CMAKE_FOLDER}/unicorn")
else()
set(CMAKE_FOLDER unicorn)
endif()
add_subdirectory(unicorn)
set(CMAKE_FOLDER ${CMKR_CMAKE_FOLDER})
# Target cli-parser
set(CMKR_TARGET cli-parser)
set(cli-parser_SOURCES "")
set(CMKR_SOURCES ${cli-parser_SOURCES})
add_library(cli-parser INTERFACE)
if(cli-parser_SOURCES)
target_sources(cli-parser INTERFACE ${cli-parser_SOURCES})
endif()
target_include_directories(cli-parser INTERFACE
cli-parser
)
unset(CMKR_TARGET)
unset(CMKR_SOURCES)

1
deps/cli-parser vendored

@ -0,0 +1 @@
Subproject commit 1aedaf8bb7f383f54b7cd498767611535526da85

@ -0,0 +1,45 @@
#include <cli-parser.hpp>
#include <fstream>
#include <iostream>
#include <thread>
#define NUM_THREADS 20
int __cdecl main(int argc, const char* argv[]) {
argparse::argument_parser_t parser("VMEmu",
"VMProtect 3 VM Handler Emulator");
parser.add_argument()
.name("--vmentry")
.description("relative virtual address to a vm entry...");
parser.add_argument()
.name("--bin")
.description("path to unpacked virtualized binary...")
.required(true);
parser.add_argument()
.name("--out")
.description("output file name...")
.required(true);
parser.add_argument().name("--unpack").description("unpack a vmp2 binary...");
parser.add_argument()
.names({"-f", "--force"})
.description("force emulation of unknown vm handlers...");
parser.add_argument()
.name("--emuall")
.description(
"scan for all vm enters and trace all of them... this may take a few "
"minutes...");
parser.enable_help();
auto result = parser.parse(argc, argv);
if (result) {
std::printf("[!] error parsing commandline arguments... reason = %s\n",
result.what().c_str());
return -1;
}
if (parser.exists("help")) {
parser.print_help();
return 0;
}
}
Loading…
Cancel
Save