All Projects → 71 → asmdot

71 / asmdot

Licence: MIT license
[Unstable] Fast, zero-copy and lightweight (Arm | Mips | x86) assembler in (C | C++ | C# | Go | Haskell | Javascript | Nim | OCaml | Python | Rust).

Programming Languages

rust
11053 projects
python
139335 projects - #7 most used programming language
C#
18002 projects
c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
haskell
3896 projects

Projects that are alternatives of or similar to asmdot

Ataraxia
Simple and lightweight source-based multi-platform Linux distribution with musl libc.
Stars: ✭ 226 (+882.61%)
Mutual labels:  arm, mips, x86
Capstone
Capstone disassembly/disassembler framework: Core (Arm, Arm64, BPF, EVM, M68K, M680X, MOS65xx, Mips, PPC, RISCV, Sparc, SystemZ, TMS320C64x, Web Assembly, X86, X86_64, XCore) + bindings.
Stars: ✭ 5,374 (+23265.22%)
Mutual labels:  arm, mips, x86
Easy Linux Pwn
A set of Linux binary exploitation tasks for beginners on various architectures
Stars: ✭ 353 (+1434.78%)
Mutual labels:  arm, mips, x86
GoRAT
GoRAT (Go Remote Access Tool) is an extremely powerful reverse shell, file server, and control plane using HTTPS reverse tunnels as a transport mechanism.
Stars: ✭ 34 (+47.83%)
Mutual labels:  arm, mips, x86
Bap
Binary Analysis Platform
Stars: ✭ 1,385 (+5921.74%)
Mutual labels:  arm, mips, x86
Plasma
Plasma is an interactive disassembler for x86/ARM/MIPS. It can generates indented pseudo-code with colored syntax.
Stars: ✭ 2,956 (+12752.17%)
Mutual labels:  arm, mips, x86
Steed
[INACTIVE] Rust's standard library, free of C dependencies, for Linux systems
Stars: ✭ 520 (+2160.87%)
Mutual labels:  arm, mips, x86
l4re-core
The core components of the L4Re operating system.
Stars: ✭ 39 (+69.57%)
Mutual labels:  arm, mips, x86
Keypatch
Multi-architecture assembler for IDA Pro. Powered by Keystone Engine.
Stars: ✭ 939 (+3982.61%)
Mutual labels:  arm, mips, x86
Arm now
arm_now is a qemu powered tool that allows instant setup of virtual machines on arm cpu, mips, powerpc, nios2, x86 and more, for reverse, exploit, fuzzing and programming purpose.
Stars: ✭ 719 (+3026.09%)
Mutual labels:  arm, mips, x86
cross
“Zero setup” cross compilation and “cross testing” of Rust crates
Stars: ✭ 3,550 (+15334.78%)
Mutual labels:  arm, mips, x86
Cross
“Zero setup” cross compilation and “cross testing” of Rust crates
Stars: ✭ 2,461 (+10600%)
Mutual labels:  arm, mips, x86
Unicorn
Unicorn CPU emulator framework (ARM, AArch64, M68K, Mips, Sparc, PowerPC, RiscV, X86)
Stars: ✭ 4,934 (+21352.17%)
Mutual labels:  arm, mips, x86
Rop Tool
A tool to help you write binary exploits
Stars: ✭ 590 (+2465.22%)
Mutual labels:  arm, mips, x86
Keystone
Keystone assembler framework: Core (Arm, Arm64, Hexagon, Mips, PowerPC, Sparc, SystemZ & X86) + bindings
Stars: ✭ 1,654 (+7091.3%)
Mutual labels:  arm, mips, x86
toddler
Toddler is a well-designed usable and portable microkernel OS
Stars: ✭ 70 (+204.35%)
Mutual labels:  arm, mips, x86
Bdvl
LD_PRELOAD Linux rootkit (x86 & ARM)
Stars: ✭ 232 (+908.7%)
Mutual labels:  arm, x86
Tengine
Tengine is a lite, high performance, modular inference engine for embedded device
Stars: ✭ 4,012 (+17343.48%)
Mutual labels:  arm, mips
APISearch-Plugin-x86
APISearch Plugin (x86) - A Plugin For x64dbg
Stars: ✭ 46 (+100%)
Mutual labels:  asm, x86
8086-cheatsheet
8086 Microprocessor Cheat sheet with Programs
Stars: ✭ 81 (+252.17%)
Mutual labels:  asm, x86

ASM.

Providing an extensible Python framework for building a fast, zero-copy assembler.

History and goals

This project originally aimed to create a fast, minimalist and unopinionated assembler in C that could live in a single file, and support multiple architectures.

Thus, a Python library was built to transform various instructions from different architectures into a simple, common AST that supports bitwise and logical expressions, basic flow control and variables into C code.
Since code would be generated automatically, other options such as naming conventions and parameter types could be easily modified when generating it.

However, I soon realized that, since a complete AST was built, it could be easily to extend this process to not only support C, but also other programming languages.
At first, the goal was thus to produce bindings to the C API, which is very efficient; but since a complete AST was built anyway, and that a mechanism already existed to distinguish source files and include files, I decided to make the whole process available in different languages.

As such, ASM. was born. Parsers transform data files that define instructions in various architectures to an AST, which is then transformed by emitters into source code in various programming languages.

Goals and non-goals

  • ASM. is a lightweight assembler library. It is designed to be as simple as possible.
  • ASM. has no support for labels or macros: developers are expected to build their own interface on top of the provided functions.
  • ASM. is not a binary, it's a library. You cannot use it directly.
  • ASM. has no built-in parser: if you want an assembler that works with arbitrary strings, use Keystone.
  • ASM. has different instructions for different architectures: if you want a common interface for all architectures, use GNU Lightning or libjit.

Usage

Using make

A Makefile is provided to automate most tasks, including generating sources, as well as building and testing every generated library.

The emit, build and test recipes are made available, and invoke all language-specific recipes that are defined. To execute tasks in a language-specific manner, the recipes emit-lang, build-lang, and test-lang are also available, where lang is either one of these values:

  • c (uses any C compiler).
  • cpp (uses any C++ compiler).
  • csharp (uses dotnet).
  • go (uses go).
  • haskell (uses cabal, doesn't compile; help needed).
  • javascript (uses npm).
  • nim (uses nimble).
  • ocaml (uses dune, doesn't compile; help needed).
  • python (uses pytest).
  • rust (uses cargo).

Generating the sources

Each language directory contains a generate.py file, which can be directly invoked from the command line.

Here is an example output of the C generation script:

usage: generate.py [-h] [-ns] [-nt] [-o output-dir/] [-v] [-np] [-ah]
                   [-cc CALLING-CONVENTION]

Generate ASM. sources.

optional arguments:
  -h, --help            Show the help message.

  -ns, --no-sources     Do not generate sources.
  -nt, --no-tests       Do not generate tests.
  -be, --big-endian     Use big-endian instead of little-endian.

  -o output-dir/, --output output-dir/
                        Change the output directory (default: directory of
                        calling emitter).
  -v, --verbose         Increase verbosity (can be given multiple times to
                        increase it further).

C:
  -np, --no-prefix      Do not prefix function names by their architecture.
  -ah, --as-header      Generate headers instead of regular files.

  -cc CALLING-CONVENTION, --calling-convention CALLING-CONVENTION
                        Specify the calling convention of generated functions.

Using the C API

#include "./x86.h"

void* buffer = malloc(0xff);
void* origin = buffer;

inc_r32(&buffer, eax);
ret(&buffer);

free(origin);

Using the Nim API

# The Nim language goes very well with ASM., thanks to its UFCS support.
import asmdot/x86

var
  bytes = newSeqOfCap[byte](10)
  buf = addr bytes[0]

buf.inc(eax)
buf.ret()

Using the Python API

from asm.x86 import Reg32, X86Assembler

asm = X86Assembler(10)

asm.inc_r32(Reg32.eax)
asm.ret()

Using the Rust API

use asm::x86::{Register32, X86Assembler};

let mut buf = vec!();

buf.inc_r32(Register32::EAX)?;
buf.ret()?;

Installing

We're not there yet, but if you want to experiment with the project or contribute, you're welcome to clone it and play around.

# Clone project
git clone https://github.com/71/asmdot.git

# Get dependencies
python -m pip install -r asmdot/requirements.txt

# Play around
PYTHONPATH=. && python languages/c/generate.py --help

Status

Architectures

Sources

Docs

The directory of each language (list available above) contains the documentation for said language. Furthermore, a hacking guide is available for those who want to extend or improve ASM.

License

All the content of the repository is MIT-licensed, except the data directory which is Unlicensed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].