can1357 / linux-pe Goto Github PK
View Code? Open in Web Editor NEWCOFF and Portable Executable format described using standard C++ with no dependencies.
License: BSD 3-Clause "New" or "Revised" License
COFF and Portable Executable format described using standard C++ with no dependencies.
License: BSD 3-Clause "New" or "Revised" License
not work for this https://github.com/auth12/loader/ (((((((((((((
vs2019,c++ 20,msvc
test code
main.cpp
#include <fstream>
#include <vector>
#include <nt/image.hpp>
inline bool open_binary_file(const std::string& file,
std::vector<uint8_t>& data) {
std::ifstream fstr(file, std::ios::binary);
if (!fstr.is_open()) return false;
fstr.unsetf(std::ios::skipws);
fstr.seekg(0, std::ios::end);
const auto file_size = fstr.tellg();
fstr.seekg(NULL, std::ios::beg);
data.reserve(static_cast<uint32_t>(file_size));
data.insert(data.begin(), std::istream_iterator<uint8_t>(fstr),
std::istream_iterator<uint8_t>());
return true;
}
constexpr auto path = "demo.exe";
int main()
{
std::vector< uint8_t > module_data, tmp;
if (!open_binary_file(path, module_data))
{
std::printf("[!] failed to open binary = %s\n", path);
return -1;
}
auto img = reinterpret_cast<win::image_t<> *>(module_data.data());
auto image_size = img->get_nt_headers()->optional_header.size_image;
const auto image_base = img->get_nt_headers()->optional_header.image_base;
// page align the vector allocation so that unicorn-engine is happy girl...
tmp.resize(image_size + 0x1000);
const std::uintptr_t module_base =
reinterpret_cast<std::uintptr_t>(tmp.data()) +
(0x1000 - (reinterpret_cast<std::uintptr_t>(tmp.data()) & 0xFFFull));
std::memcpy((void*)module_base, module_data.data(), 0x1000);
std::for_each(img->get_nt_headers()->get_sections(),
img->get_nt_headers()->get_sections() + img->get_nt_headers()->file_header.num_sections,
[&](const auto& section_header)
{
std::memcpy((void*)(module_base + section_header.virtual_address),
module_data.data() + section_header.ptr_raw_data, section_header.size_raw_data);
});
auto win_img = reinterpret_cast<win::image_t<>*>(module_base);
auto baseimport_dir =
win_img->get_directory(win::directory_id::directory_entry_import);
auto baseiat_dir =
win_img->get_directory(win::directory_id::directory_entry_iat);
std::printf("[!] import dir:%x size:%x\n", baseimport_dir->rva, baseimport_dir->size);
std::printf("[!] iat dir:%x size:%x\n", baseiat_dir->rva, baseiat_dir->size);
}
Library says its linux-pe, yet there is no way to use it on linux.
What compiler should I use if not gcc-10 nor clang-11 can compile it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.