I have split the shellcode into 2 seperate parts. After lots of experimenting I got it to work in gdb. However, when running it outside of gdb, I get a segmentation fault. I think this is because the kernel pushes things like enviroment variables, params etc to the stack, and thus invalidating any hardcoded adresses in the exploit. Did anyone get around this?