-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkxxs.php
42 lines (32 loc) · 1020 Bytes
/
checkxxs.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
<?php
include 'kmpalgo.php';
$data = array("Will this be Blocked","Definately a good text","<script> alert(" XSS ")</script>","<script>alert('1');</script>");
$result=0;
$injPattern = array("<script>","'","</script>");
echo " <link rel='stylesheet' href='style.css'> <table>
<tr>
<th>Payload</th>
<th>Result</th>
</tr>";
for($k=0;$k<count($data);$k++){
for($i=0;$i<count($injPattern);$i++){
//echo "res is " . $result;
//echo $data[$k] . "init <br>";
if(count(SearchString($data[$k],$injPattern[$i])) > 0 ){
if(($i+1) == count($injPattern)){echo $injPattern[$i];$result=1;}
}else{$result=0;
//echo "in it\n";
}
//echo "comparing " . $data[$k] . " " . $injPattern[$i] . " " . $injPattern[$i] . "\n";
}
$xxs=htmlspecialchars($data[$k], ENT_QUOTES, 'UTF-8');
if($result==1){$result="Blocked";}else{$result="Passed";}
echo "
<tr>
<td>" . htmlspecialchars($data[$k], ENT_QUOTES, 'UTF-8') ."</td>
<td>$result</td>
</tr>
";
}
echo "
</table> ";