Skip to content

Instantly share code, notes, and snippets.

@kwarrick
Last active May 20, 2021 18:49
Show Gist options
  • Save kwarrick/d2b4b744a31c021c11711f4519db5e71 to your computer and use it in GitHub Desktop.
Save kwarrick/d2b4b744a31c021c11711f4519db5e71 to your computer and use it in GitHub Desktop.
uasm +

Install

Install dependencies:

sudo apt install clang build-essential git

Install the UASM assembler from source:

git clone -b v2.50 https://github.com/Terraspace/UASM
pushd UASM
    make -f Makefile_Linux CC=clang
    sudo cp ./GccUnixR/uasm /usr/local/bin
popd
sudo mv UASM /usr/local/src/

Install the LLVM lld linker from the repository (Ubuntu 18):

sudo apt install lld

Run

Running against PE32 and PE32+ is slightly different:

For 32-bit PE32:

ddisasm ex.exe -F -j1 --generate-import-libs --asm out.asm
uasm -coff out.asm
lld-link-6.0 out.o /machine:x86 /subsystem:console /entry:_EntryPoint

For 64-bit PE32+:

ddisasm ex.exe -F -j1 --generate-import-libs --asm out.asm
uasm -win64 out.asm
lld-link-6.0 out.o /machine:x64 /subsystem:console /entry:__EntryPoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment