A quick look into pwn library :
from pwn import *
context.bits=32
p.sendline(), p.recvline
p.recvuntil(':'), pack()
s=ssh(host='challenge02.root-me.org',user='app-systeme-ch15',password='app-systeme-ch15',port=2222)
p=s.process('./ch15')
r=remote('127.0.0.1',8888)
p=process(['level2',payload])
context.bits=len(a)*8
Shellcode=asm(shellcraft.i386.linux.cat("flag"))
libc = ELF(libcfilename);
libc.address= leak- libc.symbols['atoi'];
system = libc.symbols['system']
binsh = libc.search("/bin/sh").next()
p = gdb.debug('./pinkiegift')
raw_input()
Pwntools
A quick look into pwn library :