Last active
November 23, 2022 16:49
-
-
Save massihm/20cfbc536e2397e9281d381ceea1a7e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt update | |
sudo apt install qemu-user-static | |
sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic '\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00' --mask '\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff' | |
sudo dpkg --add-architecture i386 | |
sudo apt update | |
sudo apt install -y libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386 zlib1g-dev:i386 | |
sudo apt-get install libc6-dev-i386 libx32gcc-4.8-dev nasm | |
//////////Replace <your Username> With Your WSL UserName | |
echo "service binfmt-support start;" > /home/<your Username>/script32.sh | |
chmod o+x /home/<your Username>/script32.sh | |
sudo visudo | |
<your Username> ALL=(root) NOPASSWD: /home/<your Username>/script32.sh | |
sudo /home/<your Username>/script32.sh | |
nano file.asm | |
///////////////Code//////////// | |
section .data | |
hello: db 'hello World!',10; | |
len: equ $-hello; | |
section .text | |
global main | |
main: | |
mov eax,4; | |
mov ebx,1; | |
mov ecx,hello; | |
mov edx,len; | |
int 80h; | |
mov eax,1; | |
mov ebx,0; | |
int 80h; | |
///////////////////////////// | |
nasm -f elf file.asm | |
gcc -m32 file.o | |
./file.out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment