added dirs for cpp files... working on lib dctor and pe dctor...

master
_xeroxz 4 years ago
parent 1c85485bf0
commit a7abd2055c

@ -12,14 +12,18 @@ namespace llo::s1
{
const auto lib_header = reinterpret_cast< const ar::header_t * >( image.data() );
auto lib_entry = &lib_header->first_entry;
ar::entry_t *string_table = nullptr;
do
{
if ( lib_entry->is_string_table() )
string_table = ( ar::entry_t * )lib_entry;
// skip these since we dont want to extract them... they are not obj files...
if ( lib_entry->is_string_table() || lib_entry->is_symbol_table() )
continue;
std::printf( "> object name = %s\n", lib_entry->to_string());
std::printf( "> object name = %s\n", lib_entry->to_string( string_table ) );
} while ( ( lib_entry = lib_header->first_entry.next() ) );
}
void generate( lloiff_t &iff ) override;

@ -1,16 +1,25 @@
#pragma once
#include <llodctor/llodctor_base.hpp>
#include <linuxpe>
#include <llodctor/llodctor_base.hpp>
namespace llo::s1
{
class dctor_pe_t : public dctor_base_t
{
win::dos_header_t *dos_header;
win::section_header_t *sections;
std::uint32_t section_count;
std::uint32_t entry_point;
public:
explicit dctor_pe_t( std::vector< std::uint8_t > &image,
llo::s1::symbol_loader_base_t *symbol_loader = nullptr )
: dctor_base_t( image, symbol_loader )
{
dos_header = reinterpret_cast< win::dos_header_t * >( raw_img.data() );
sections = dos_header->get_nt_headers()->get_sections();
section_count = dos_header->get_nt_headers()->file_header.num_sections;
entry_point = dos_header->get_nt_headers()->optional_header.entry_point;
}
void generate( lloiff_t &iff ) override;

@ -5,14 +5,9 @@ namespace llo::s1
class symbol_loader_map_t : public symbol_loader_base_t
{
public:
explicit symbol_loader_map_t( std::string &&path ) : symbol_loader_base_t( path )
explicit symbol_loader_map_t( const std::string &path ) : symbol_loader_base_t( path )
{
}
symbol_loader_map_t( std::string &path ) : symbol_loader_base_t( path )
{
}
void load( llo::lloiff_t &iff ) override;
};
} // namespace llo::s1

@ -105,10 +105,10 @@
<ClCompile Include="dependencies\fcml\include\fcml_gas_mnemonics.cpp" />
<ClCompile Include="dependencies\fcml\include\fcml_intel_mnemonics.cpp" />
<ClCompile Include="dependencies\fcml\include\fcml_registers.cpp" />
<ClCompile Include="include\llodctor\llodctor_lib.cpp" />
<ClCompile Include="include\llodisposition\llodisposition_types.cpp" />
<ClCompile Include="include\llosymbol_loader\llosymbol_loader_map.cpp" />
<ClCompile Include="src\llodctor_pe.cpp" />
<ClCompile Include="src\llodctor\llodctor_lib.cpp" />
<ClCompile Include="src\llodctor\llodctor_pe.cpp" />
<ClCompile Include="src\llodisposition\llodisposition_types.cpp" />
<ClCompile Include="src\llosymbol_loader\llosymbol_loader_map.cpp" />
<ClCompile Include="src\main.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">

@ -42,6 +42,15 @@
<Filter Include="Header Files\linux-pe\coff\auxiliaries">
<UniqueIdentifier>{98d78f45-088b-441d-b20f-f4b2e7cec972}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\llosymbol_loader">
<UniqueIdentifier>{d76f131b-ba41-4e64-918a-03c5a526c281}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\llodctor">
<UniqueIdentifier>{9bd2b0b0-4ae2-4d9d-8620-4b596f84d20d}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\llodisposition">
<UniqueIdentifier>{4370901a-12c1-43ce-883a-6a6c3f48845a}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\lloiff.hpp">
@ -309,9 +318,6 @@
</None>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\llodctor_pe.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -324,14 +330,17 @@
<ClCompile Include="dependencies\fcml\include\fcml_registers.cpp">
<Filter>Header Files\fcml</Filter>
</ClCompile>
<ClCompile Include="include\llosymbol_loader\llosymbol_loader_map.cpp">
<Filter>Source Files</Filter>
<ClCompile Include="src\llodctor\llodctor_pe.cpp">
<Filter>Source Files\llodctor</Filter>
</ClCompile>
<ClCompile Include="include\llodisposition\llodisposition_types.cpp">
<Filter>Source Files</Filter>
<ClCompile Include="src\llosymbol_loader\llosymbol_loader_map.cpp">
<Filter>Source Files\llosymbol_loader</Filter>
</ClCompile>
<ClCompile Include="include\llodctor\llodctor_lib.cpp">
<Filter>Source Files</Filter>
<ClCompile Include="src\llodctor\llodctor_lib.cpp">
<Filter>Source Files\llodctor</Filter>
</ClCompile>
<ClCompile Include="src\llodisposition\llodisposition_types.cpp">
<Filter>Source Files\llodisposition</Filter>
</ClCompile>
</ItemGroup>
</Project>

@ -2,4 +2,5 @@
void llo::s1::dctor_lib_t::generate( lloiff_t &iff )
{
// TODO
}

@ -2,11 +2,6 @@
void llo::s1::dctor_pe_t::generate( lloiff_t &iff )
{
auto dos_header = reinterpret_cast< win::dos_header_t * >( raw_img.data() );
auto sections = dos_header->get_nt_headers()->get_sections();
auto section_count = dos_header->get_nt_headers()->file_header.num_sections;
auto entry_point = dos_header->get_nt_headers()->optional_header.entry_point;
// lift section information to iff...
for ( auto idx = 0u; idx < section_count; ++idx )
{

@ -4,5 +4,5 @@ std::shared_ptr< llo::disposition_t > llo::disposition_t::make( const llo::utils
const llo::utils::hash_t< std::string > &section_name,
std::uint32_t section_offset )
{
return std::make_shared< disposition_t >( iff_name, section_name, section_offset );
return std::make_shared< llo::disposition_t >( iff_name, section_name, section_offset );
}

@ -2,4 +2,5 @@
void llo::s1::symbol_loader_map_t::load( llo::lloiff_t &iff )
{
// TODO
}

@ -59,6 +59,11 @@ int __cdecl main( int argc, const char *argv[] )
// TODO:
// symbol_loader = std::make_shared< llo::s1::symbol_loader_pdb_t >( symbols_file );
}
else
{
std::printf( "[!] unknown symbol file extension: %s\n", symbols_file.extension().c_str() );
return -1;
}
}
std::shared_ptr< llo::s1::dctor_base_t > file_dctor = nullptr;
@ -69,15 +74,15 @@ int __cdecl main( int argc, const char *argv[] )
{
file_dctor = std::make_shared< llo::s1::dctor_pe_t >( image, symbol_loader.get() );
}
else if ( file_path.extension().compare( ".o" ) )
{
// TODO: elf file format...
return -1;
}
else if ( file_path.extension().compare( ".lib" ) )
{
file_dctor = std::make_shared< llo::s1::dctor_lib_t >( image, symbol_loader.get() );
}
else if ( file_path.extension().compare( ".o" ) || file_path.extension().compare( ".so" ) )
{
// TODO:
// file_dctor = std::make_shared< llo::s1::dctor_elf_t >( image, symbol_loader.get() );
}
else
{
std::printf( "[!] unknown file extension: %s\n", file_path.extension().c_str() );

Loading…
Cancel
Save