forked from proabiral/inception
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproviderCreate.html
More file actions
311 lines (226 loc) · 12 KB
/
providerCreate.html
File metadata and controls
311 lines (226 loc) · 12 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<!DOCTYPE html>
<html lang="en">
<script>
const hintText="{{ Fill details above for new test case }}"
const PayloadHeaderDiv="<div id=\"payloadHeaderDiv\"> Header Name <input type=\"text\" name=\"payload1\" required class=\"payload\"> Header Value <input type=\"text\" name=\"payload2\" class=\"payload\" required><input type=\"button\" value=\"+\" onclick=\"addHeaderField()\"><input id=\"minusbuttonID\" type=\"button\" value=\"-\" onclick=\"minusButton(this)\"><br> <br> </div>"
const PayloadBodyDiv="<div id=\"payloadBodyDiv\"> Endpoint where request will be send: <input type=\"text\" name=\"payload\" value=\"/\" class=\"payload\" required><input type=\"button\" value=\"+\" onclick=\"addEndpointField()\"><input type=\"button\" value=\"-\" onclick=\"minusButton(this)\"> <br> <br> </div>"
const StatusCodeBodyDiv=" <div id=\"StatusCodeBodyDiv\"> Status Code : <input type=\"number\" id=\"statusCode\"> <input type=\"button\" value=\"+\" onclick=\"addStatuCodeField()\"><input id=\"minusbuttonID\" type=\"button\" value=\"-\" onclick=\"minusButton(this)\"><br> </div>"
const responseBodyDivS="<div id=\"responseDiv\"><select onchange=\"changeOption(this)\" class=\"delimiter\"> <option value=\"||||\">OR</option> <option value=\"&&&&\">AND</option></select> <br><br> What to check for in Response Body <input type=\"text\" name=\"payload1\" class=\"response\"> <input type=\"button\" value=\"+\" onclick=\"addResponseField()\"><input id=\"minusbuttonID\" type=\"button\" value=\"-\" onclick=\"minusButton(this)\"> <br> <br> </div>"
const responseBodyDiv="<div id=\"responseDiv\"> What to check for in Response Body <input type=\"text\" name=\"payload1\" class=\"response\"> <input type=\"button\" value=\"+\" onclick=\"addResponseField()\"> <br> <br> </div>"
const responseHeaderDivS="<div id=\"responseDiv\"><select onchange=\"changeOption(this)\" class=\"delimiter\"> <option value=\"||||\">OR</option> <option value=\"&&&&\">AND</option></select> <br><br> What to check for in Response Header<input type=\"text\" name=\"payload1\" class=\"response\"> <input type=\"text\" name=\"payload2\" class=\"response\"> <input type=\"button\" value=\"+\" onclick=\"addResponseField()\"><input id=\"minusbuttonID\" type=\"button\" value=\"-\" onclick=\"minusButton(this)\"> <br> <br> </div>"
const responseHeaderDiv="<div id=\"responseDiv\">What to check for in Response Header<input type=\"text\" name=\"payload1\" class=\"response\"> <input type=\"text\" name=\"payload2\" class=\"response\"> <input type=\"button\" value=\"+\" onclick=\"addResponseField()\"> <br> <br> </div>"
function changeOption(xoxo){
document.querySelectorAll(".delimiter").forEach(function(element) {element.selectedIndex=xoxo.selectedIndex})
}
function responseDiv(){
if(document.getElementById('checkIn').value == "responseHeader") {
document.querySelector("#responseDiv").innerHTML=responseHeaderDiv;
document.getElementById('minusbuttonID').style="display:none"
}
else{
document.querySelector("#responseDiv").innerHTML=responseBodyDiv
}
}
jsonIndex=0
function jsonGenerator() {
json[jsonIndex]=new Object();
json[jsonIndex].vulnerability=document.querySelector("#vulnerability").value
json[jsonIndex].method=document.querySelector("#method").value
json[jsonIndex].color=document.querySelector("#color").value
json[jsonIndex].body=document.querySelector("#postBody").value
json[jsonIndex].endpoint=new Array();
json[jsonIndex].headers=new Array();
endpoints=document.querySelectorAll("#endPointPDiv input[type=\"text\"]")
for (var i = 0; i < endpoints.length; i++) {
json[jsonIndex].endpoint[i]=endpoints[i].value;
}
json[jsonIndex].headers=new Array();
headers=document.querySelectorAll("#headerPDiv input[type=\"text\"]");
for (var i=0; i < headers.length; i+=2){
if (headers[i].value!=""){
j=i/2
json[jsonIndex].headers[j]=new Array();
json[jsonIndex].headers[j][0]=headers[i].value
json[jsonIndex].headers[j][1]=headers[i+1].value
}
}
json[jsonIndex].checkIn=document.querySelector("#checkIn").value
y=document.querySelectorAll(".response")
if (document.getElementById("statusCode").value != "") {
json[jsonIndex].statusCode=new Array();
statusCode=document.querySelectorAll("#StatusCodeBodyDiv input[type=\"number\"]")
for (var i = 0; i < statusCode.length; i++) {
json[jsonIndex].statusCode[i]=Number(statusCode[i].value);
}
}
json[jsonIndex].checkFor=""
json[jsonIndex].regexCheck=document.querySelector("#regexCheck").checked
if(document.getElementById('checkIn').value == "responseBody") {
for (var i=0; i < y.length; i++){
if (i==0){
json[jsonIndex].checkFor=y[i].value
}
else if (y[i].value !== ""){
delimiter=document.querySelector(".delimiter").value
json[jsonIndex].checkFor=y[i].value+delimiter+json[jsonIndex].checkFor
}
}
}
else{
for (var i=0; i < y.length; i+=2){
if (i==0){
json[jsonIndex].checkFor=y[i].value+": "+y[i+1].value
}
else if (y[i].value !== ""){
delimiter=document.querySelector(".delimiter").value
json[jsonIndex].checkFor=y[i].value+": "+y[i+1].value+delimiter+json[jsonIndex].checkFor
}
}
}
}
function addEndpointField() {
document.querySelector("#endPointPDiv").insertAdjacentHTML("beforeend",PayloadBodyDiv)
}
function addStatuCodeField() {
document.querySelector("#StatusCodeBodyDiv").insertAdjacentHTML("beforeend",StatusCodeBodyDiv)
}
function addHeaderField() {
document.querySelector("#headerPDiv").insertAdjacentHTML("beforeend",PayloadHeaderDiv)
}
function addResponseField(){
if(document.getElementById('checkIn').value == "responseBody") {
document.querySelector("#responseDiv").insertAdjacentHTML("beforeend",responseBodyDivS)
}
else{
document.querySelector("#responseDiv").insertAdjacentHTML("beforeend",responseHeaderDivS)
}
document.querySelectorAll(".delimiter").forEach(function(element) {element.selectedIndex=document.querySelector('.delimiter').selectedIndex})
}
function minusButton(xoxo){
xoxo.parentElement.parentElement.removeChild(xoxo.parentElement)
}
function vulnerabilityIsEmpty(){
if (document.forms[0].vulnerability.value=="") {
alert("fill up the vulnerability details")
return true
}
else{
return false
}
}
function payloadIsEmpty(){
var payloadFieldArray=document.querySelectorAll(".payload")
for (var i = 0; i < payloadFieldArray.length; i++) {
if (payloadFieldArray[i].value==""){
alert("fill up all payload section")
return true
}
else{
return false
}
}
}
function isNotEmpty(){
if (!vulnerabilityIsEmpty() && !payloadIsEmpty()){
return true
}
}
function saveValue(){
}
function moreVulnerability(xoxo){
if (isNotEmpty()){
console.log("works")
jsonGenerator();
jsonIndex++;
previousValueCheckIn = document.querySelector("#checkIn").value
if (document.querySelector(".delimiter")){
previousID = document.querySelector(".delimiter").selectedIndex
}
xoxo.form.reset();
document.querySelector("#checkIn").value = previousValueCheckIn
document.querySelectorAll(".delimiter").forEach(function(element) {element.selectedIndex=previousID})
document.querySelector('#jsonOutput').value=JSON.stringify(json, null, 4)
document.getElementById('hint').innerText=hintText;
}
}
function jsonPrint(xoxo){
if (isNotEmpty()){
jsonGenerator()
previousValueCheckIn = document.querySelector("#checkIn").value
xoxo.form.reset()
document.querySelector("#checkIn").value = previousValueCheckIn
document.querySelector('#jsonOutput').value=JSON.stringify(json, null, 4)
}
}
</script>
<body onload="json=new Array();">
<h1>
Create json file for provider
</h1>
<form>
Vulnerability Name:
<input type="text" name="vulnerability" id="vulnerability" required> <br><br>
Method
<select name="method" id="method">
<option value="GET">GET</option>
<option value="HEAD">HEAD</option>
<option value="POST">POST</option>
<option value="PUT">PUT</option>
<option value="DELETE">DELETE</option>
</select> <br><br>
<div id="endPointPDiv">
<div id="endpointDiv">
Endpoint where request will be send:
<input type="text" class="payload" value="/" required> <input type="button" value="+" onclick="addEndpointField()"> <br><br>
</div>
</div>
<div id="headerPDiv">
Headers to be send {leave empty if you don't want any custom header}
<div id="headerDiv"> Header Name <input type="text" name="payload1"> Header Value <input type="text" name="payload2" class="payload"><input type="button" value="+" onclick="addHeaderField()"><input id="minusbuttonID" type="button" value="-" onclick="minusButton(this)" style="display: none;"><br> <br>
</div>
</div>
Body to be send in request<br> <textarea rows="10" cols="80" id="postBody" placeholder='Place post data as follows ; make sure to use appropriate Content-Type: header if needed; {"username":"admin","password":"secret"} or field1=value1&field2=value2 or --boundary Content-Disposition: form-data; name="field1" value1 --boundary Content-Disposition: form-data; name="field2"; filename="example.txt" '></textarea> <br><br>
<div id="StatusCodeBodyDiv">
Status Code : <input type="number" id="statusCode"> <input type="button" value="+" onclick="addStatuCodeField()">
</div>
{Status code that need to be matched for vulnerability detection, leave empty if status code check is not needed.}
<br><br>
Check in
<select name="checkIn" id="checkIn" onchange="responseDiv()">
<option value="responseBody">Response Body</option>
<option value="responseHeader">Response Header</option>
</select> <br><br> <!-- drop down responseBody -->
<div id="responsePdiv">
<div id="responseDiv">
What to check for in Response Body<input type="text" name="checkFor" class="response" id="checkFor" required> <input type="button" value="+" onclick="addResponseField()"> {Case Sensitive ; Leave empty if you want to only send request} <br><br>
</div>
</div>
<div>
<input type="checkbox" id="regexCheck"> Perform Regex Check
</div>
<br>
Severity to Assign
<select name="color" id="color">
<option value="blue">Low</option>
<option value="yellow">Medium</option>
<option value="red">High</option>
</select> <br><br>
<input type="button" value="Add more vulnerabilities" onclick="moreVulnerability(this);">
<div id="hint"> </div>
<br> <br>
<input type="button" value="Generate JSON" onclick="jsonPrint(this)">
<br>
</form>
<textarea id="jsonOutput" rows="80" cols="90">
</textarea>
</body>
<style>
body {
display: block;
margin: 8px;
margin-top: 8px;
margin-right: 20%;
margin-left: 20%;
}
</style>
</html>