-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandler.js
111 lines (91 loc) · 2.13 KB
/
handler.js
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
var urlencode = require('urlencode');
var regx = require('verbal-expressions');
var injectionAlert = false;
var IsInjected= function()
{
return injectionAlert;
}
var controlData =function(data)
{
var querystring= urlencode.decode(data, "utf8");
querystring= querystring.split("+").join(' ');
console.log(decodeURI(querystring));
// var tester= regx()
// .startOfLine()
// .maybe('select')
// .then('--')
// .maybe('\'1=')
// .endOfLine();
var d1 = regx()
.then("'")
.maybe(' or ');
var d2 = regx()
.then("'")
.maybe(' and ')
var d3 = regx()
.then("'")
.maybe('=');
var d4 = regx()
.maybe('--')
.then('select ');
var d6 = regx()
.maybe("'")
.then('union ');
var d7 = regx()
.maybe('--')
.then('union ');
var d8 = regx()
.maybe("'")
.then('select ');
var d9 = regx()
.maybe("'")
.then('delete ');
var d10 = regx()
.maybe("'")
.then('update ');
var d10 = regx()
.maybe("'")
.then('insert ');
var d11 = regx()
.maybe("or ")
.then(' 1=1--');
var d12 = regx()
.maybe("\x27\x4F\x52")
.then('select ');
var d13 = regx()
.maybe("\x27\x6F\x72")
.then('select ');
var ts=querystring.toLowerCase();
regExTest(d1,ts);
regExTest(d2,ts);
regExTest(d3,ts);
regExTest(d4,ts);
// rTest(d5,ts);
regExTest(d6,ts);
regExTest(d7,ts);
regExTest(d8,ts);
regExTest(d9,ts);
regExTest(d10,ts);
regExTest(d11,ts);
regExTest(d12,ts);
regExTest(d13,ts);
// rTest(d14,ts);
// rTest(d15,ts);
}
var regExTest =function (pattern,injectionString)
{
if(pattern.test(injectionString))
{
injectionAlert=true;
console.log("Yakalandı! >>>>>>"+ injectionString);
}
}
module.exports = function()
{
return {
rTest: regExTest,
controlData : controlData,
injectionAlert : injectionAlert,
IsInjected :IsInjected
}
}