/
custom_tools.js
102 lines (90 loc) · 4.87 KB
/
custom_tools.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
function load_gf_template(pattern_name){
$('#modal-size').removeClass('modal-xl');
$('#modal-size').addClass('modal-lg');
$('.modal-title').html(`GF Pattern ` + htmlEncode(pattern_name));
$('#exampleModal').modal('show');
$('.modal-text').empty();
$('.modal-text').append(`<div class='outer-div' id="modal-loader"><span class="inner-div spinner-border text-info align-self-center loader-sm"></span></div>`);
$.getJSON(`/api/getFileContents?gf_pattern&name=${pattern_name}&format=json`, function(data) {
$('#modal-loader').empty();
$('#modal-text-content').append(`<pre>${htmlEncode(data['content'])}</pre>`);
}).fail(function(){
$('#modal-loader').empty();
$("#modal-text-content").append(`<p class='text-danger'>Error loading GF Pattern</p>`);
});
}
function load_nuclei_template(pattern_name){
$('#modal-size').removeClass('modal-lg');
$('#modal-size').addClass('modal-xl');
$('.modal-title').html(`Nuclei Pattern ` + htmlEncode(pattern_name));
$('#exampleModal').modal('show');
$('.modal-text').empty();
$('.modal-text').append(`<div class='outer-div' id="modal-loader"><span class="inner-div spinner-border text-info align-self-center loader-sm"></span></div>`);
$.getJSON(`/api/getFileContents?nuclei_template&name=${pattern_name}&format=json`, function(data) {
$('#modal-loader').empty();
$('#modal-text-content').append(`<pre>${htmlEncode(data['content'])}</pre>`);
}).fail(function(){
$('#modal-loader').empty();
$("#modal-text-content").append(`<p class='text-danger'>Error loading Nuclei Template</p>`);
});
}
// get nuclei config
$.getJSON(`/api/getFileContents?nuclei_config&format=json`, function(data) {
$("#nuclei_config_text_area").attr("rows", 17);
$("textarea#nuclei_config_text_area").html(data['content']);
}).fail(function(){
$("#nuclei_config_text_area").removeAttr("readonly");
$("textarea#nuclei_config_text_area").html(`# Your nuclei configuration here.`);
$("#nuclei-config-form").append('<input type="submit" class="btn btn-info mt-2 float-right" value="Save Changes" id="nuclei-config-submit">');
});
$("#nuclei_config_text_area").dblclick(function() {
if (!document.getElementById('nuclei-config-submit')) {
$("#nuclei_config_text_area").removeAttr("readonly");
$("#nuclei-config-form").append('<input type="submit" class="btn btn-info mt-2 float-right" value="Save Changes" id="nuclei-config-submit">');
}
});
// get Subfinder config
$.getJSON(`/api/getFileContents?subfinder_config&format=json`, function(data) {
$("#subfinder_config_text_area").attr("rows", 14);
$("textarea#subfinder_config_text_area").html(data['content']);
}).fail(function(){
$("#subfinder_config_text_area").removeAttr("readonly");
$("textarea#subfinder_config_text_area").html(`# Your Subfinder configuration here.`);
$("#subfinder-config-form").append('<input type="submit" class="btn btn-info mt-2 float-right" value="Save Changes" id="subfinder-config-submit">');
});
$("#subfinder_config_text_area").dblclick(function() {
if (!document.getElementById('subfinder-config-submit')) {
$("#subfinder_config_text_area").removeAttr("readonly");
$("#subfinder-config-form").append('<input type="submit" class="btn btn-info mt-2 float-right" value="Save Changes" id="subfinder-config-submit">');
}
});
// get Naabu config
$.getJSON(`/api/getFileContents?naabu_config&format=json`, function(data) {
$("#naabu_config_text_area").attr("rows", 14);
$("textarea#naabu_config_text_area").html(data['content']);
}).fail(function(){
$("#naabu_config_text_area").removeAttr("readonly");
$("textarea#naabu_config_text_area").html(`# Your Naabu configuration here.`);
$("#naabu-config-form").append('<input type="submit" class="btn btn-info mt-2 float-right" value="Save Changes" id="naabu-config-submit">');
});
$("#naabu_config_text_area").dblclick(function() {
if (!document.getElementById('naabu-config-submit')) {
$("#naabu_config_text_area").removeAttr("readonly");
$("#naabu-config-form").append('<input type="submit" class="btn btn-info mt-2 float-right" value="Save Changes" id="naabu-config-submit">');
}
});
// get amass config
$.getJSON(`/api/getFileContents?amass_config&format=json`, function(data) {
$("#amass_config_text_area").attr("rows", 14);
$("textarea#amass_config_text_area").html(data['content']);
}).fail(function(){
$("#amass_config_text_area").removeAttr("readonly");
$("textarea#amass_config_text_area").html(`# Your amass configuration here.`);
$("#amass-config-form").append('<input type="submit" class="btn btn-info mt-2 float-right" value="Save Changes" id="amass-config-submit">');
});
$("#amass_config_text_area").dblclick(function() {
if (!document.getElementById('amass-config-submit')) {
$("#amass_config_text_area").removeAttr("readonly");
$("#amass-config-form").append('<input type="submit" class="btn btn-info mt-2 float-right" value="Save Changes" id="amass-config-submit">');
}
});