Giter Club home page Giter Club logo

Comments (7)

samsa1 avatar samsa1 commented on September 16, 2024

This feature is not fully implemented because to be able to generate a binary you also need to generate the OS specific header and my previous attempts to do this failed.

As such this feature is not documented because this crate does not have a satisfying implementation of binary generation

from write_x86_64.

InfiniteCoder01 avatar InfiniteCoder01 commented on September 16, 2024

Generating header is not necessary, users can do it themselves. If it's really important there is goblin. It's not easy to use it to write stuff, but for writing I found one crate for ELF files (also uses goblin, so we can look up how it's done): faerie.

from write_x86_64.

InfiniteCoder01 avatar InfiniteCoder01 commented on September 16, 2024

I've tried goblin, object and faerie.
The only thing I got is gimli-rs/object#577
I'm writing my own crate to write any ELF files including executables. Hopefully I'll make it. It will be quite low level through.

from write_x86_64.

InfiniteCoder01 avatar InfiniteCoder01 commented on September 16, 2024

Ok, I finally wrote some elfs. Here is the crate, still WIP, but already usable for generating executables: https://crates.io/crates/orecc-elf.
If I won't find such crate for PE, I'll write my own too. With windows PE I have at least some experience :)

from write_x86_64.

samsa1 avatar samsa1 commented on September 16, 2024

Your crate does not explain where the other segments are placed.
Most of the time you need at least 2 segments one that is executable and one that isn't (which thus should be on another memory page for security to work).
How can I know the address of the second segment ?

from write_x86_64.

InfiniteCoder01 avatar InfiniteCoder01 commented on September 16, 2024

For some reason, I've deleted this line off docs. It said that if you use ELF::new, segments will be loaded continuously into memory. With x86 first segment will be loaded into 0x08048000 (Not quite, also headers), with x86_64 into 0x400000. Here is why: https://stackoverflow.com/questions/2966426/why-do-virtual-memory-addresses-for-linux-binaries-start-at-0x8048000

from write_x86_64.

InfiniteCoder01 avatar InfiniteCoder01 commented on September 16, 2024

@samsa1 Maybe you could suggest a better way of placing a data segment?

from write_x86_64.

Related Issues (1)

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.