parent
77e7cadd97
commit
1ce9a78e69
@ -1,49 +0,0 @@
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
|
||||
build/
|
||||
|
||||
dependencies/mbuild/
|
||||
dependencies/xed/
|
@ -1,12 +0,0 @@
|
||||
[submodule "dependencies/xed"]
|
||||
path = dependencies/xed
|
||||
url = https://github.com/intelxed/xed.git
|
||||
[submodule "dependencies/mbuild"]
|
||||
path = dependencies/mbuild
|
||||
url = https://github.com/intelxed/mbuild.git
|
||||
[submodule "demo/dependencies/linux-pe"]
|
||||
path = demo/dependencies/linux-pe
|
||||
url = https://github.com/can1357/linux-pe.git
|
||||
[submodule "demo/dependencies/cli-parser"]
|
||||
path = demo/dependencies/cli-parser
|
||||
url = https://githacks.org/_xeroxz/cli-parser.git
|
@ -1,4 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(llo-stage-one)
|
||||
add_subdirectory(demo/)
|
||||
add_library(${PROJECT_NAME} src/deconstructor.cpp)
|
@ -1,14 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(llo-stage-one-demo)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_FLAGS -Winvalid-constexpr)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
|
||||
endif(MSVC)
|
||||
|
||||
include_directories(dependencies/cli-parser/ dependencies/linux-pe/includes/)
|
||||
add_executable(${PROJECT_NAME} src/main.cpp)
|
@ -1 +0,0 @@
|
||||
Subproject commit 1aedaf8bb7f383f54b7cd498767611535526da85
|
@ -1 +0,0 @@
|
||||
Subproject commit db2b7af6e6beae1bc391ff8f8e5c97b963dc3258
|
@ -1,30 +0,0 @@
|
||||
#include <iostream>
|
||||
#include "cli-parser.hpp"
|
||||
#include "linuxpe"
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
argparse::argument_parser_t cli_parser("llo-stage-one demo", "CLI, LLO, stage one demo...");
|
||||
cli_parser
|
||||
.add_argument()
|
||||
.names({"-i", "--input"})
|
||||
.required(true)
|
||||
.description("input file, must be a file format supported by stage one modules...");
|
||||
|
||||
cli_parser.enable_help();
|
||||
auto err = cli_parser.parse(argc, argv);
|
||||
|
||||
if (err)
|
||||
{
|
||||
std::cout << err << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( cli_parser.exists( "help" ) )
|
||||
{
|
||||
cli_parser.print_help();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// win::dos_header_t image_dos;
|
||||
}
|
@ -1 +0,0 @@
|
||||
Subproject commit 09b6654be0c52bf1df44e88c88b411a67b624cbd
|
@ -1 +0,0 @@
|
||||
Subproject commit 428712c28e831573579b7f749db63d3a58dcdbd9
|
@ -1,10 +0,0 @@
|
||||
#include <cstdint>
|
||||
|
||||
namespace llo::s1
|
||||
{
|
||||
class dctor_base_t
|
||||
{
|
||||
public:
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
#include "llodctor_base.hpp"
|
||||
|
||||
std::shared_ptr< llo::s1::dctor_base_t > llo::s1::dctor_base_t::begin( std::vector< std::uint8_t > &image )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "lloiff.hpp"
|
||||
|
||||
namespace llo::s1
|
||||
{
|
||||
class dctor_base_t
|
||||
{
|
||||
std::vector< std::uint8_t > raw_img;
|
||||
public:
|
||||
static std::shared_ptr<dctor_base_t> begin( std::vector< std::uint8_t > &image );
|
||||
virtual bool generate( lloiff_t &iff );
|
||||
};
|
||||
} // namespace llo::s1
|
@ -0,0 +1,10 @@
|
||||
#include "llodctor_base.hpp"
|
||||
|
||||
namespace llo::s1
|
||||
{
|
||||
class dctor_pe_t : public dctor_base_t
|
||||
{
|
||||
public:
|
||||
bool generate( lloiff_t &iff ) override;
|
||||
};
|
||||
} // namespace llo::s1
|
@ -0,0 +1,49 @@
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "lloutils.hpp"
|
||||
|
||||
namespace llo
|
||||
{
|
||||
class lloiff_t
|
||||
{
|
||||
public:
|
||||
explicit lloiff_t( std::string &file_name )
|
||||
{
|
||||
this->file_name.make( file_name );
|
||||
}
|
||||
|
||||
class section_offset_t
|
||||
{
|
||||
public:
|
||||
llo::utils::hash_t< std::string > section_name;
|
||||
std::uint32_t offset;
|
||||
};
|
||||
|
||||
class symbol_t
|
||||
{
|
||||
public:
|
||||
llo::utils::hash_t< std::string > symbol_name;
|
||||
section_offset_t location;
|
||||
};
|
||||
|
||||
class section_t
|
||||
{
|
||||
public:
|
||||
llo::utils::hash_t< std::string > section_name;
|
||||
std::vector< symbol_t > symbols;
|
||||
std::vector< std::uint8_t > section_raw;
|
||||
};
|
||||
|
||||
static std::shared_ptr< lloiff_t > begin( std::string &file_name )
|
||||
{
|
||||
return std::make_shared< lloiff_t >( file_name );
|
||||
}
|
||||
|
||||
private:
|
||||
llo::utils::hash_t< std::string > file_name;
|
||||
std::vector< section_t > sections;
|
||||
};
|
||||
} // namespace llo
|
@ -0,0 +1,52 @@
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <random>
|
||||
#include <type_traits>
|
||||
#include <variant>
|
||||
|
||||
namespace llo::utils
|
||||
{
|
||||
template < class number_t > number_t generate_random_number( const number_t minimum, const number_t maximum )
|
||||
{
|
||||
static_assert( std::is_arithmetic_v< number_t >, "type is not arithmetic..." );
|
||||
|
||||
std::random_device rd;
|
||||
std::mt19937 mt( rd() );
|
||||
std::uniform_real_distribution< double > dist( 1.0, 10.0 );
|
||||
return dist( mt );
|
||||
}
|
||||
|
||||
template < class T > class hash_t
|
||||
{
|
||||
std::size_t hash_result;
|
||||
const T data;
|
||||
|
||||
public:
|
||||
hash_t()
|
||||
{
|
||||
}
|
||||
|
||||
hash_t( const T &data ) : data{ data }
|
||||
{
|
||||
auto random_num =
|
||||
llo::utils::generate_random_number< std::uint64_t >( 0, std::numeric_limits< std::uint64_t >::max() );
|
||||
|
||||
this->hash_result = std::hash< T >{}( data ) + std::hash< std::uint64_t >{}( random_num );
|
||||
}
|
||||
|
||||
static std::shared_ptr< hash_t > make( const T &data )
|
||||
{
|
||||
return std::make_shared< hash_t >( data );
|
||||
}
|
||||
|
||||
T &get_data() const
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
std::size_t get_hash() const
|
||||
{
|
||||
return hash_result;
|
||||
}
|
||||
};
|
||||
} // namespace llo::utils
|
@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\llodctor_base.hpp" />
|
||||
<ClInclude Include="include\llodctor_pe.hpp" />
|
||||
<ClInclude Include="include\lloiff.hpp" />
|
||||
<ClInclude Include="include\lloutils.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include=".clang-format" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="include\llodctor_base.cpp" />
|
||||
<ClCompile Include="src\llodctor_pe.cpp" />
|
||||
<ClCompile Include="src\main.cpp" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{caa703f1-d4e7-4ea6-95f4-7f32d86600ae}</ProjectGuid>
|
||||
<RootNamespace>llos1</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{f02de5e5-e0f4-4244-a05f-45e095918bff}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\llodctor_base.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\lloiff.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\lloutils.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\llodctor_pe.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include=".clang-format">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\llodctor_pe.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="include\llodctor_base.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
@ -0,0 +1,6 @@
|
||||
#include "..\include\llodctor_pe.hpp"
|
||||
|
||||
bool llo::s1::dctor_pe_t::generate( lloiff_t &iff )
|
||||
{
|
||||
return false;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
#include "../include/llodctor_pe.hpp"
|
||||
#include "../include/lloiff.hpp"
|
||||
|
||||
int main()
|
||||
{
|
||||
std::string file_name = "test.exe";
|
||||
std::vector< std::uint8_t > image;
|
||||
|
||||
llo::lloiff_t iif( file_name );
|
||||
auto pe_dctor = llo::s1::dctor_base_t::begin( image );
|
||||
|
||||
if ( !pe_dctor->generate( iif ) )
|
||||
{
|
||||
std::printf( "> failed to generate iff...\n" );
|
||||
return -1;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue