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
270 lines (201 loc) · 10.1 KB
/
providerCreate.html
File metadata and controls
270 lines (201 loc) · 10.1 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
<!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=\"addPayloadField()\"><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=\"addPayloadField()\"><input type=\"button\" value=\"-\" onclick=\"minusButton(this)\"> <br> <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()\"> {Case Sensitive ; Leave empty if you want to only send request} <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()\">{Case Sensitive ; Leave empty if you want to only send request} <br> <br> </div>"
function changeOption(xoxo){
document.querySelectorAll(".delimiter").forEach(function(element) {element.selectedIndex=xoxo.selectedIndex})
}
function payloadBody(){
if(document.getElementById('sendIn').value == "header") {
document.querySelector("#payloadDiv").innerHTML=PayloadHeaderDiv;
document.getElementById('minusbuttonID').style="display:none"
}
else{
document.querySelector("#payloadDiv").innerHTML=PayloadBodyDiv
}
}
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].sendIn=document.querySelector("#sendIn").value
json[jsonIndex].color=document.querySelector("#color").value
json[jsonIndex].payload=new Array();
// json[0].payload[0]=document.querySelector("#payload").value
x=document.querySelectorAll("#payloadDiv input[type=\"text\"]")
for (var i = 0; i < x.length; i++) {
json[jsonIndex].payload[i]=x[i].value;
}
json[jsonIndex].checkIn=document.querySelector("#checkIn").value
y=document.querySelectorAll(".response")
json[jsonIndex].checkFor=""
document.querySelector("#sendIn").value
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 addPayloadField() {
if(document.getElementById('sendIn').value == "header") {
document.querySelector("#payloadDiv").insertAdjacentHTML("beforeend",PayloadHeaderDiv)
}
else{
document.querySelector("#payloadDiv").insertAdjacentHTML("beforeend",PayloadBodyDiv)
}
}
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
previousValueSendIn = document.querySelector("#sendIn").value
if (document.querySelector(".delimiter")){
previousID = document.querySelector(".delimiter").selectedIndex
}
xoxo.form.reset();
document.querySelector("#checkIn").value = previousValueCheckIn
document.querySelector("#sendIn").value = previousValueSendIn
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
previousValueSendIn = document.querySelector("#sendIn").value
xoxo.form.reset()
document.querySelector("#checkIn").value = previousValueCheckIn
document.querySelector("#sendIn").value = previousValueSendIn //restoring to previous value
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>
Send payload in:
<select name="sendIn" id="sendIn" onchange="payloadBody()">
<option value="url">URL</option>
<option value="header">Request Header</option>
</select> <br><br> <!--drop down url | header -->
<div id="payloadDiv">
<div id="payloadHeaderDiv">
Endpoint where request will be send:
<input type="text" class="payload" value="/" required> <input type="button" value="+" onclick="addPayloadField()"> <br><br>
</div>
</div>
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>
Severity to Assign
<select name="color" id="color">
<option value="red">High</option>
<option value="yellow">Medium</option>
<option value="blue">Low</option>
</select> <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>