forked from nil0x42/phpsploit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray_format.php
More file actions
78 lines (72 loc) · 2.04 KB
/
array_format.php
File metadata and controls
78 lines (72 loc) · 2.04 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
74
75
76
77
78
<?php
function phpinfo_array()
{
ob_start();
phpinfo(-1);
$pi = preg_replace(
array('#^.*<body>(.*)</body>.*$#ms',
'#<h2>PHP License</h2>.*$#ms',
'#<h1>Configuration</h1>#',
"#\r?\n#",
"#</(h1|h2|h3|tr)>#",
'# +<#',
'#> +#',
"#[ \t]+#",
'# #',
'# +#',
'# class=".*?"#',
'%'%',
'#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>'
.'<h1>PHP Version (.*?)</h1>(?:\n+?)</td></tr>#',
'#<h1><a href="(?:.*?)\?=(.*?)">PHP Credits</a></h1>#',
'#<tr>(?:.*?)" src="(?:.*?)=(.*?)"(?:.*?)'
.'Zend Engine (.*?),(?:.*?)</tr>#',
"# +#",
'#<tr>#',
'#</tr>#',
'#<br />#',
'#Copyright#'),
array('$1',
'',
'',
"",
'</$1>'."\n",
' <',
'> ',
' ',
' ',
' ',
'',
' ',
'<h2>PHP Configuration</h2>'."\n".'<tr><td>PHP Version</td><td>$2'
.'</td></tr>'."\n".'<tr><td>PHP Egg</td><td>$1</td></tr>',
'<tr><td>PHP Credits Egg</td><td>$1</td></tr>',
'<tr><td>Zend Engine</td><td>$2</td></tr>'."\n"
.'<tr><td>Zend Egg</td><td>$1</td></tr>',
' ',
'%S%',
'%E%',
' ',
' Copyright'),
ob_get_clean());
$sections = explode('<h2>', strip_tags($pi, '<h2><th><td>'));
unset($sections[0]);
$pi = array();
foreach($sections as $section)
{
$n = substr($section, 0, strpos($section, '</h2>'));
$regex = '#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)' .
'</td>)?(?:<td>(.*?)</td>)?%E%#';
preg_match_all($regex, $section, $askapache, PREG_SET_ORDER);
foreach($askapache as $m)
{
if (!isset($m[3]) || $m[2] == $m[3])
$pi[$n][$m[1]] = $m[2];
else
$pi[$n][$m[1]] = array_slice($m, 2);
}
}
return $pi;
}
return phpinfo_array();
?>