This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 182
/
scripts.js
executable file
·193 lines (178 loc) · 6.08 KB
/
scripts.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
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
var delayTimer;
$('#myModal').on('show', function () {
$(this).find('.modal-body').css({width:'auto',
height:'auto',
'max-height':'100%'});
});
jQuery(document).ready(function () {
jQuery('.collapse')
.on('shown.bs.collapse', function() {
jQuery('#search-params').html('');
jQuery(this)
.parent()
.find(".glyphicon-plus")
.removeClass("glyphicon-plus")
.addClass("glyphicon-minus");
})
.on('hidden.bs.collapse', function() {
jQuery(this)
.parent()
.find(".glyphicon-minus")
.removeClass("glyphicon-minus")
.addClass("glyphicon-plus");
var text = new Array;
if (jQuery('#ipAddress').val().length > 0){
text[text.length] = "IP: <strong>" + jQuery('#ipAddress').val() + "</strong>";
}
if (jQuery('#portN').val().length > 0){
text[text.length] = "Port: <strong>" + jQuery('#portN').val() + "</strong>";
}
if (jQuery('#serviceState').val().length > 0){
text[text.length] = "Service state: <strong>" + jQuery('#serviceState').val() + "</strong>";
}
if (jQuery('#pProtocol').val().length > 0){
text[text.length] = "Protocol: <strong>" + jQuery('#pProtocol').val() + "</strong>";
}
if (jQuery('#pService').val().length > 0){
text[text.length] = "Service: <strong>" + jQuery('#pService').val() + "</strong>";
}
if (jQuery('#pBanner').val().length > 0){
text[text.length]= "Banner/Title: <strong>" + jQuery('#pBanner').val() + "</strong>";
}
if (text.length > 0) {
var html = '<p class="text-muted">';
for (var i =0; i < text.length; i++)
{
html += text[i];
if (i+1 < text.length) {
html += " | ";
}
}
html += "</p>";
jQuery('#search-params').html(html);
}
});
});
function submitSearchForm()
{
var data = jQuery('#form').serialize();
var data = data + '&form=1';
var ajax_options = {
beforeSend:function () {
jQuery('#ajax-loader-form').css('display', 'block');
},
complete:function () {
jQuery('#ajax-loader-form').css('display', 'none');
},
error:function (XMLHttpRequest, textStatus, errorThrown) {
alert('There was an error durring request. Please try again later!');
},
success:function (response, textStatus) {
jQuery('#content').html(response);
jQuery('a#export-link').attr('onclick','').unbind('click');
jQuery('a#export-link').click(function(){
exportResultsToXML(data);
});
},
timeout:'100000',
type:'get',
dataType:'html',
data:data,
url:'/filter.php'
};
$.ajax(ajax_options);
return false;
}
function showIpHistory(ip, ipa)
{
jQuery('#myModalLabel').text('Scan history for IP '+ ip);
var ajax_options = {
beforeSend:function () {
},
complete:function () {
},
error:function (XMLHttpRequest, textStatus, errorThrown) {
alert('There was an error durring request. Please try again later!');
},
success:function (response, textStatus) {
$('#myModal').modal('show');
jQuery('.modal-body').html(response);
},
timeout:'100000',
type:'get',
dataType:'html',
data:'ip='+ipa,
url:'/ajax.php'
};
$.ajax(ajax_options);
return false;
}
function exportResultsToXML(data)
{
var url='/export.php?'+ data;
var _iframe_dl = $('<iframe />')
.attr('src', url)
.hide()
.appendTo('body');
return false;
}
function searchDataText(data)
{
clearTimeout(delayTimer);
delayTimer = setTimeout(function() {
searchData(data);
}, 1000);
}
function searchData(data, throbber)
{
throbber = typeof throbber !== 'undefined' ? throbber : 'ajax-loader';
var ajax_options = {
beforeSend:function () {
jQuery('#' + throbber).css('display', 'block');
},
complete:function () {
jQuery('#'+ throbber).css('display', 'none');
},
error:function (XMLHttpRequest, textStatus, errorThrown) {
alert('There was an error durring request. Please try again later!');
},
success:function (response, textStatus) {
jQuery('#ajax-list-container').html(response);
jQuery('a#export-link').attr('onclick','').unbind('click');
jQuery('a#export-link').click(function(){
exportResultsToXML(data);
});
},
timeout:'100000',
type:'get',
dataType:'html',
data:data,
url:'/filter.php'
};
$.ajax(ajax_options);
return false;
}
function showImportHelp()
{
jQuery('#myModalLabel').text('How to scan and import data?');
var ajax_options = {
beforeSend:function () {
},
complete:function () {
},
error:function (XMLHttpRequest, textStatus, errorThrown) {
alert('There was an error during request. Please try again!');
},
success:function (response, textStatus) {
$('#myModal').modal('show');
jQuery('.modal-body').html(response);
},
timeout:'100000',
type:'get',
dataType:'html',
data:'',
url:'/includes/html/import-help.html'
};
$.ajax(ajax_options);
return false;
}