Command Execution Program in Assembly language

Posted by Suraj Singh on December 28, 2018 · 2 mins read



Hi readers, Welcome Again To my Blog. readers, Today In This Post I am going To Share Another Mind Blowing Example of Assembly Program in which I simply tried to execute linux command. Actually, This Example is very important to understand if you want to learn exploit writing.

By The Way, If you Are new And Don't Know How To Start, Compile Or Run?
Then, Don't Follow up Our Previous Blog post. Here, it's The List.

1. Hello World In Assembly
2. Find String Length In Assembly Language
3. Subroutine Demo In Assembly language
4. Some Subroutine Functionality Example
5. User Input Example In Assembly Language
6. Variable Decleration/Include function In Assembly
7. Convert Integer Into ASCII in Assembly Language
8. Arthematic Functions In Assembly Language
9. Calculator In Assembly Language


Here, its my code

Command Execution Program in Assembly language



;
; Program To Execute Commands
;
; author : Suraj Singh Bisht
; Email : surajsinghbisht054@gmail.com
;


; section bss
SECTION .bss


; section data
SECTION .data
filename db "/bin/ping", 0h ; Decleare String
argv db "www.bitforestinfo.com", 0h ; Argument

arg_array dd filename ;
dd argv ; Array of Arguments
dd 0h ; End of Argument

environ db 0h ; Empty Argument

; section text
SECTION .text
global _start ; Linker Trigger

; Routine
_start:
mov eax, 11 ; Invoke SYS_EXECVE () - > execve(const char *filename, char *const argv[], char *const envp[])
mov ebx, filename ; EBX = File name
mov ecx, arg_array; ; ECX = array of argument addresses
mov edx, environ ; EDx= Environment
int 80h ; kernel Interpt

mov eax, 1 ; InVoke SYS_EXIT
mov ebx, 0 ; Return 0
int 80h ; Kernel Interpt


Please Check Github For Latest Error Free Examples Codes. Click here