1
|
|
|
// jshint esversion: 8, -W069 |
2
|
|
|
|
3
|
|
|
/** global: settings */ |
4
|
|
|
const conversions = require('../../common/conversions'); |
5
|
|
|
|
6
|
|
|
const { |
7
|
|
|
ipcRenderer |
8
|
|
|
} = require('electron'), { |
9
|
|
|
tableReset |
10
|
|
|
} = require('./auxiliary'); |
11
|
|
|
|
12
|
|
|
require('../../common/stringFormat'); |
13
|
|
|
|
14
|
|
|
var bwWordlistContents; // Global wordlist input contents |
15
|
|
|
|
16
|
|
|
/* |
17
|
|
|
ipcRenderer.on('bw:wordlistinput.confirmation', function() {...}); |
18
|
|
|
Wordlist input, contents confirmation container |
19
|
|
|
*/ |
20
|
|
|
ipcRenderer.on('bw:wordlistinput.confirmation', function() { |
21
|
|
|
var bwFileStats = []; |
22
|
|
|
|
23
|
|
|
bwWordlistContents = $('#bwWordlistTextareaDomains').val().toString(); |
24
|
|
|
if (bwWordlistContents == '' && bwWordlistContents === null) { |
25
|
|
|
$('#bwWordlistconfirm').addClass('is-hidden'); |
26
|
|
|
$('#bwEntry').removeClass('is-hidden'); |
27
|
|
|
} else { |
28
|
|
|
$('#bwWordlistSpanInfo').text('Loading wordlist stats...'); |
29
|
|
|
$('#bwWordlistSpanInfo').text('Getting line count...'); |
30
|
|
|
bwFileStats['linecount'] = bwWordlistContents.toString().split('\n').length; |
31
|
|
|
|
32
|
|
|
if (settings['lookup.randomize.timeBetween'].randomize === true) { |
33
|
|
|
bwFileStats['minestimate'] = conversions.msToHumanTime(bwFileStats['linecount'] * settings['lookup.randomize.timeBetween'].minimum); |
34
|
|
|
bwFileStats['maxestimate'] = conversions.msToHumanTime(bwFileStats['linecount'] * settings['lookup.randomize.timeBetween'].maximum); |
35
|
|
|
$('#bwWordlistSpanTimebetweenmin').text('{0}ms '.format(settings['lookup.randomize.timeBetween'].minimum)); |
36
|
|
|
$('#bwWordlistSpanTimebetweenmax').text('/ {0}ms'.format(settings['lookup.randomize.timeBetween'].maximum)); |
37
|
|
|
$('#bwWordlistTdEstimate').text('{0} to {1}'.format(bwFileStats['minestimate'], bwFileStats['maxestimate'])); |
38
|
|
|
} else { |
39
|
|
|
bwFileStats['minestimate'] = conversions.msToHumanTime(bwFileStats['linecount'] * settings['lookup.general'].timeBetween); |
40
|
|
|
$('#bwWordlistSpanTimebetweenminmax').addClass('is-hidden'); |
41
|
|
|
$('#bwWordlistSpanTimebetweenmin').text(settings['lookup.general'].timeBetween + 'ms'); |
42
|
|
|
$('#bwWordlistTdEstimate').text('> {0}'.format(bwFileStats['minestimate'])); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
bwFileStats['filepreview'] = bwWordlistContents.toString().substring(0, 50); |
46
|
|
|
//console.log(readLines(filePath[0])); |
47
|
|
|
//console.log(bwFileStats['filepreview']); |
48
|
|
|
|
49
|
|
|
//console.log(lineCount(bwFileContents)); |
50
|
|
|
$('#bwWordlistloading').addClass('is-hidden'); |
51
|
|
|
$('#bwWordlistconfirm').removeClass('is-hidden'); |
52
|
|
|
|
53
|
|
|
// stats |
54
|
|
|
$('#bwWordlistTdDomains').text('{0} line(s)'.format(bwFileStats['linecount'])); |
55
|
|
|
$('#bwWordlistTdFilepreview').text(bwFileStats['filepreview'] + '...'); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
return; |
59
|
|
|
}); |
60
|
|
|
|
61
|
|
|
/* |
62
|
|
|
$('#bwEntryButtonWordlist').click(function() {...}); |
63
|
|
|
Wordlist Input, Entry container button |
64
|
|
|
*/ |
65
|
|
|
$('#bwEntryButtonWordlist').click(function() { |
66
|
|
|
$('#bwEntry').addClass('is-hidden'); |
67
|
|
|
$('#bwWordlistinput').removeClass('is-hidden'); |
68
|
|
|
|
69
|
|
|
return; |
|
|
|
|
70
|
|
|
}); |
71
|
|
|
|
72
|
|
|
/* |
73
|
|
|
$('#bwWordlistinputButtonCancel').click(function() {...}); |
74
|
|
|
Wordlist Input, cancel input |
75
|
|
|
*/ |
76
|
|
|
$('#bwWordlistinputButtonCancel').click(function() { |
77
|
|
|
$('#bwWordlistinput').addClass('is-hidden'); |
78
|
|
|
$('#bwEntry').removeClass('is-hidden'); |
79
|
|
|
|
80
|
|
|
return; |
|
|
|
|
81
|
|
|
}); |
82
|
|
|
|
83
|
|
|
/* |
84
|
|
|
$('#bwWordlistinputButtonConfirm').click(function() {...}); |
85
|
|
|
Wordlist Input, go to confirm |
86
|
|
|
*/ |
87
|
|
|
$('#bwWordlistinputButtonConfirm').click(function() { |
88
|
|
|
$('#bwWordlistinput').addClass('is-hidden'); |
89
|
|
|
ipcRenderer.send("bw:input.wordlist"); |
90
|
|
|
|
91
|
|
|
return; |
|
|
|
|
92
|
|
|
}); |
93
|
|
|
|
94
|
|
|
/* |
95
|
|
|
$('#bwWordlistconfirmButtonCancel').click(function() {...}); |
96
|
|
|
Wordlist input, cancel confirmation |
97
|
|
|
*/ |
98
|
|
|
$('#bwWordlistconfirmButtonCancel').click(function() { |
99
|
|
|
$('#bwWordlistconfirm').addClass('is-hidden'); |
100
|
|
|
$('#bwEntry').removeClass('is-hidden'); |
101
|
|
|
|
102
|
|
|
return; |
|
|
|
|
103
|
|
|
}); |
104
|
|
|
|
105
|
|
|
/* |
106
|
|
|
$('#bwWordlistconfirmButtonStart').click(function() {...}); |
107
|
|
|
Wordlist input, proceed to bulk whois |
108
|
|
|
*/ |
109
|
|
|
$('#bwWordlistconfirmButtonStart').click(function() { |
110
|
|
|
var bwDomainArray = bwWordlistContents.toString().split('\n').map(Function.prototype.call, String.prototype.trim), |
111
|
|
|
bwTldsArray = $('#bwWordlistInputTlds').val().toString().split(','); |
112
|
|
|
|
113
|
|
|
/* |
114
|
|
|
console.log(bwDomainArray); |
115
|
|
|
console.log(bwTldsArray); |
116
|
|
|
*/ |
117
|
|
|
|
118
|
|
|
tableReset(bwDomainArray.length, bwTldsArray.length); |
119
|
|
|
$('#bwWordlistconfirm').addClass('is-hidden'); |
120
|
|
|
$('#bwProcessing').removeClass('is-hidden'); |
121
|
|
|
|
122
|
|
|
ipcRenderer.send("bw:lookup", bwDomainArray, bwTldsArray); |
123
|
|
|
|
124
|
|
|
return; |
|
|
|
|
125
|
|
|
}); |
126
|
|
|
|
127
|
|
|
/* |
128
|
|
|
$('#bwWordlistInputTlds').keyup(function(...) {...}); |
129
|
|
|
ipsum |
130
|
|
|
*/ |
131
|
|
|
$('#bwWordlistInputTlds').keyup(function(event) { |
132
|
|
|
// Cancel the default action, if needed |
133
|
|
|
event.preventDefault(); |
134
|
|
|
// Number 13 is the "Enter" key on the keyboard |
135
|
|
|
if (event.keyCode === 13) { |
136
|
|
|
// Trigger the button element with a click |
137
|
|
|
$('#bwWordlistconfirmButtonStart').click(); |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
return; |
|
|
|
|
141
|
|
|
}); |
142
|
|
|
|