Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a pure-Ruby assembler backend #27

Open
postmodern opened this issue Dec 30, 2024 · 0 comments
Open

Add a pure-Ruby assembler backend #27

postmodern opened this issue Dec 30, 2024 · 0 comments
Assignees
Labels
feature future Future feature help-wanted Extra attention is needed idea Idea

Comments

@postmodern
Copy link
Member

postmodern commented Dec 30, 2024

Add a pure-Ruby assembler backend, instead of relying on YASM to produce shellcode.

This would likely take the form of having each architecture module define it's own Assembler class. These class may be initialized with additional configuration (ARM supports being switched to big-endian or little-endian mode) or could also track state while processing instructions. These classes should implement the "Emitter Pattern", and provide an entry point method called emit_instruction(inst) which would accept an Instruction object and output a binary String of opcodes (or possibly append the opcodes directly to an output String/File object that's also given). This method could be as simple as one giant case/when statement which inspects the instruction's name, or a method which dynamically invokes other emit_instruction_#{inst.name} methods using public_send(). Additional helper emit_* methods will probably also need to be defined to emit the operands for the instructions. An emit_program(program) method may also be necessary to output a fully assembled program, instead of a series of opcodes for shellcode.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature future Future feature help-wanted Extra attention is needed idea Idea
Projects
None yet
Development

No branches or pull requests

1 participant