forked from osirislab/Shellcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsyscall.s
More file actions
45 lines (38 loc) · 700 Bytes
/
Copy pathsyscall.s
File metadata and controls
45 lines (38 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
;;; Define the SYSTEM_CALL macro
;;; YOU MUST USE A %DEFINE IF YOU USE THIS MACRO
;;; Will emit a hlt instruction if no %define is present
%macro SYSTEM_CALL 0
%ifdef INT80
int 0x80
%elifdef SYSENTER
sysenter
%elifdef SYSCALL
syscall
%elifdef CALLGATE32
call [gs:eiz+0x10]
%else
hlt
%endif
%endmacro
%macro SYSTEM_CALL 1
%ifdef INT80 ;used most frequently with 32bit shellcode
push byte %1
pop eax
;; xor eax,eax
;; mov al,%1
SYSTEM_CALL
%elifdef SYSENTER
int3
hlt
%elifdef SYSCALL ;used most frequently with 64bit shellcode
push byte %1
pop rax
SYSTEM_CALL
%elifdef CALLGATE32 ;32bit only
push byte %1
pop eax
SYSTEM_CALL
%else
hlt
%endif
%endmacro