schrodyn / irasm

Interactive Redundant Assembler (shell)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

irasm

Interactive Redundant Assembler (shell)

Description

The irasm shell takes an x86 (32-bit) assembly instruction as input, and gives the corresponding machine code as output.
The main distinction between this tool and something like nasm_shell, is that the output not only gives an official machine code output, but it also gives alternative machine-code, including some machine-code that no assembler would output (valid machine code)
Not every instruction format is supported. For those that aren't, this script gracefully falls back on using nasm to assemble some machine code
Some instruction formats that may never get support are ones with xmm registers and VEX prefixes

Supported Instruction Formats

Atomic (nop, ret, pause, etc...)
OP al, imm8 (xor al, 0x13)
OP ax, imm16 (xor ax, 0x1337)
OP eax, imm32 (xor eax, 0x13371337)
OP r/m8, imm8 (adc byte [eax + ebx + 0x1337], 66)
OP r/m16, imm8 (adc word [eax + ebx + 0x1337], 0x22)
OP r/m32, imm8 (adc dword [eax + ebx + 0x1337], 0x22)
OP r/m16, imm16 (adc word [eax + ebx + 0x1337], 0x4444)
OP r/m32, imm32 (adc dword [eax + ebx + 0x1337], 0x88888888)
OP r/m8, r8 (xor al, ah)
OP r/m16, r16 (xor ax, ax)
OP r/m32, r32 (xor eax, eax)
OP r8, r/m8 (xor al, ah)
OP r16, r/m16 (xor ax, ax)
OP r32, r/m32 (xor eax, eax)
OP rel8
OP rel16
OP rel32

Fully Supported Instructions

adc, aad, aam, aas, add, and, cbw, cmp cwde, clac, clc, cld, cli, clts, cmc, cmpsb, cmpsw, cmpsd, cpuid, cwd, cdq, daa, das, emms, f2xm1, fabs, faddp, fchs, fclex, fnclex, fcompp, fcos, fdecstp, fincstp, finit, fninit, fld1, fldl2t, fldl2e, fldpi, fldlg2, fldln2, fldz, fnop, fpatan, fprem, fprem1, fptan, frndint, fscale, fsin, fsincos, fsqrt, ftst, fucompp, fxam, fxtract, fyl2x, fyl2xp1, hlt, insb, insw, insd, into, invd, iretw, iretd, iret, lahf, leave, leavew, lfence, lock, lodsb, lodsw, lodsd, mfence, monitor, movsb, movsw, movsd, mwait, nop, or, outsb, outsw, outsd, pause, popaw, popad, popa, popfw, popfd, popf, pushaw, pushad, pusha, pushfw, pushfd, pushf, rdmsr, rdpmc, rdtsc, rdtscp, rsm, sbb, scasb, scasw, scasd, sfence, stac, stc, std, sti, stosb, stosw, stosd, sub, swapgs, syscall, sysenter, sysexit, sysret, test, ud2, fwait, wait, wbinvd, wrmsr, xgetbv, xlat, xor, xsetbv, and xtest

Partially Supported Instructions (only with the above instruction formats)

fcom, fcomp, fdivp, fdivrp, fmulp, fstsw ax, fnstsw ax, fsubp, fsubrp, fucom, fucomp, fxch, in, ret, retf, and sahf

Test Instructions

The below instructions are examples that can be used to test out the functionality of irasm:
aad
add eax, 0x00000022
adc byte [ebp + eax + 0x13371337], 88
mfence
cmp ax, 0x5555
and al, 0x66

About

Interactive Redundant Assembler (shell)

License:MIT License


Languages

Language:Ruby 100.0%