This repository was archived by the owner on Jan 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathsqlimeevaluators.js
More file actions
111 lines (92 loc) · 3.56 KB
/
Copy pathsqlimeevaluators.js
File metadata and controls
111 lines (92 loc) · 3.56 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
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
/*
Copyright 2007 Security Compass
This file is part of SQL Inject Me.
SQL Inject Me is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SQL Inject Me is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SQL Inject Me. If not, see <http://www.gnu.org/licenses/>.
If you have any questions regarding SQL Inject Me please contact
tools@securitycompass.com
*/
/**
* sqlimeevaluators.js
* This file holds a number of JS evaluators
* @require Results.js
* @require ErrorStringContainer.js
*/
/**
* Checks the source of a page for stored error strings
*/
function checkSrcForErrorString(streamListener) {
var errorContainer = getErrorStringContainer();
var results = new Array();
var doc = streamListener.data;
var stringEncoder = getHTMLStringEncoder();
dump("\nStart freeze...");
for each (var error in errorContainer.getStrings()){
var result;
if (doc.indexOf(error.string) !== -1) {
result = new Result(RESULT_TYPE_ERROR, 100, "Error string found: '" + stringEncoder.encodeString(error.string) + "'");
}
else {
result = new Result(RESULT_TYPE_PASS, 100, "Error string not found: '" + stringEncoder.encodeString(error.string) + "'");
}
results.push(result);
}
dump("\nEnd freeze...");
return results;
}
/**
* Checks the browser for stored error strings.
*/
function checkForErrorString(browser) {
var errorContainer = getErrorStringContainer();
var results = new Array();
var doc = browser.contentDocument.toString();
var stringEncoder = getHTMLStringEncoder();
dump("\nStart freeze...");
for each (var error in errorContainer.getStrings()){
var result;
if (doc.indexOf(error.string) !== -1) {
result = new Result(RESULT_TYPE_ERROR, 100, "Error string found: '" + stringEncoder.encodeString(error.string) + "'");
}
else {
result = new Result(RESULT_TYPE_PASS, 100, "Error string not found: '" + stringEncoder.encodeString(error.string) + "'");
}
results.push(result);
}
dump("\nEnd freeze...");
return results;
}
function checkForServerResponseCode(streamListener){
var nsiHttpChannel = streamListener.attackRunner.channel.QueryInterface(Components.interfaces.nsIHttpChannel);
var stringEncoder = getHTMLStringEncoder();
try{
if ((nsiHttpChannel.responseStatus === undefined || nsiHttpChannel.responseStatus === null)){
return null;
}
else {
var result;
var responseCode = nsiHttpChannel.responseStatus;
var displayString = "Server Status Code: " + stringEncoder.encodeString(responseCode.toString()) + " " +
stringEncoder.encodeString(nsiHttpChannel.responseStatusText);
if (responseCode == 200){
result = new Result(RESULT_TYPE_PASS, 100, displayString );
}
else {
result = new Result(RESULT_TYPE_ERROR, 100, displayString);
}
}
return [result];
}
catch(err){
Components.utils.reportError(err);
return [];
}
}