Skip to content

Commit

Permalink
Initial steps into low level programming
Browse files Browse the repository at this point in the history
Completed code snippets for shell spawning and exit() syscall.
  • Loading branch information
cydtseng authored Apr 11, 2022
1 parent 4bb3b69 commit 744deab
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions exit_syscall/exitsys.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
char shellcode[] = "xbb\x00\x00\x00\x00"
"xb8\x01\x00\x00\x00"
"xcd\x80"

int main() {
int *ret;
ret = (int *)&ret + 2;
*ret = (int)shellcode;
}
13 changes: 13 additions & 0 deletions shell_spawning/shell.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include<stdlib.h>
#include<unistd.h>


int main() {
char *name[2];

name[0] = "/bin/sh";
name[1] = 0x0;
execve(name[0], name, 0x0);
exit(0);
}

0 comments on commit 744deab

Please sign in to comment.