Giter Site home page Giter Site logo

exe_to_dll's Introduction

EXE_to_DLL

Build status GitHub release Github All Releases

Converts an EXE, so that it can be loaded like a DLL.
Supports both 32 and 64 bit DLLs

Inspired by the idea of @guywhataguy. Read more here.

Download

Stable builds are available in releases.

Test builds can be downloaded from the build server (click on the build and choose the "Artifacts" tab)

Clone

Use recursive clone to get the repo together with all the submodules:

git clone --recursive https://github.com/hasherezade/exe_to_dll.git

Usage

Run exe_to_dll from commandline. Arguments:

args: <input_exe> <output_dll>

Example:

exe_to_dll.exe test_case1.exe test_case1.dll

After the successful conversion you should obtain a DLL exporting a Start function. This is the Original Entry Point of your input application.

You can test it by running:

rundll32.exe test_case1.dll,Start

exe_to_dll's People

Contributors

hasherezade avatar lagri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exe_to_dll's Issues

WinMain

Is it possible to make this tool compatible with windows applications?
I've made som tries myself without any luck.
The exe is correcly converted, but giving the entry point to the loader nothing happens.

I guess that may people would enjoy a "testload" applications, compiled as a DLL file, with a given export name, so i may be called with rundll32. This would enable to calle rundll32 testload.dll,Load

I should be able to write this for console applications, but (sady) not for Windows applications.
Anyone would help?
Thanks in advance!
\Jeky--

memory load module

LoadLibraryA

I tried to replace "LoadLibraryA" with a memory load module and found it failed.

my code:

size_t v_size = 0;
PBYTE loaded_pe = peconv::load_pe_executable(file.c_str(), v_size);
if (NULL == loaded_pe) {
    return FALSE;
}

// calculate the Entry Point of the manually loaded module
DWORD ep_rva = (0 == rva_ep) ? peconv::get_entry_point_rva(loaded_pe) : rva_ep;
ULONG_PTR ep_va = ep_rva + (ULONG_PTR)loaded_pe;
if (NULL == ep_rva || NULL == ep_va) {
    return FALSE;
}

typedef int(APIENTRY* fnMainCRTStartup)();
fnMainCRTStartup AddressOfEntryPoint = (fnMainCRTStartup)ep_va;
if (AddressOfEntryPoint) {
    auto result = AddressOfEntryPoint();
}

Export Entry Point

Currently only loading of the EXE as a DLL is supported. But in order to call any function, we must manually find and call its address.

For easier use, it would be beneficial to have the export table created, and the Original Entry Point should be added as an exported function.

the file don't run after the conversion

Hi,

I have a multiple megabyte exe which just write something to the console. After the conversion the generated dll file only 300k and (of course) calling start on it not working at all, nothing happens. How to fix this?

Wrong virtual section size

Hello and thank you very much for your amazing work!

I'm trying to use your code to convert an exe to a dll but i'm experiencing a problem.
I'm not expert in the matter so I hope you can give me any hints.
The program fails converting the raw pe to virtual with these messages:

[!] Truncated to maximal size: fc7000, buffer size:18e9000
[-] Raw section size is out ouf bounds: 332000

Adding some debug info, if I understood correctly, it seems the size of some virtual sections reported in the section header is wrong:

Section 13 at 9576448, size: 105902592
Section 14 at 22769664, size: 3350528

The size of section 13 should not be that big, right? This leads to the first error message.
And also the SizeOfImage header seems to be too small, which leads to the second error message and failure.
Unfortunately i cannot share the exe, but it runs normally, it's not corrupted.
Any idea why this happens? Anything I can do to handle this type of files?

Thank you again!

Get console output

Is there any way to get console output from GetProcAddress ? my exe produce only console output and I'm trying to get that output to variable in GetProcAddress Start function. Can you help ?

Get Console Input

Hello,

this is a very interesting project.
I wanted to use it to convert some programs that take their parameters from command line.

So, for testing, I created a program that addition two int as parameter 1 and 2 and output the sum in a file (as there is no console output, but I am not interested in it).

When I call "Addition.exe 99 6", parameters 1 and 2 are 99 and 6. That s ok
When I call "rundll32.exe .\Addition.dll,Start 99 6" ; parameters 1 and 2 are "".\Addition.dll,Start and 99.
And If I load it in a program, it just display the parameter of that program !

Is there a way to correct that, so parameter 1 is alwways the parameter send to the entry point

Thanks

Regards

Nicolas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.