Last active
March 9, 2016 16:13
-
-
Save NaxAlpha/2c84b3fc77578bcd7ee9 to your computer and use it in GitHub Desktop.
Portable Shellcode
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
;Suppose our code will be located at | |
;Following address in memory | |
org 0xDEADBEEF | |
mov eax, Sleep ;Sleep means [0xDEADBEEF+Sleep] | |
push Time ;Time means [0xDEADBEEF+Time] | |
call eax | |
Sleep dw 0x74c37990 | |
Time dw 1000 |
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
;This shellcode is independent of its origin | |
bits 32 | |
call Here ;Issue a near call | |
Here: ;Now EIP will be in stack | |
pop edi ;Store it to data register (data index) | |
sub edi,5 ;Point edi to base of shellcode | |
;Load sleep value in eax | |
mov eax,[edi+Sleep] | |
;Load value of Time in ebx | |
mov ebx,[edi+Time] | |
;Call Sleep | |
push ebx | |
call eax | |
;Data | |
Sleep dq 0x74c37990 | |
Time dq 1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment