line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: DomainScanDetails.pm 297 2009-11-16 04:37:07Z jabra $ |
2
|
|
|
|
|
|
|
package Fierce::Parser::DomainScanDetails; |
3
|
|
|
|
|
|
|
{ |
4
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
5
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1291
|
use Object::InsideOut; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
8
|
1
|
|
|
1
|
|
533
|
use XML::LibXML; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Fierce::Parser::Domain; |
10
|
|
|
|
|
|
|
use Fierce::Parser::Node; |
11
|
|
|
|
|
|
|
use Fierce::Parser::PTR; |
12
|
|
|
|
|
|
|
use Fierce::Parser::ZoneTransferResult; |
13
|
|
|
|
|
|
|
use Fierce::Parser::FindMXResult; |
14
|
|
|
|
|
|
|
use Fierce::Parser::RangeResult; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my @domains : Field : Arg(domains) : Get(domains) : |
17
|
|
|
|
|
|
|
Type(List(Fierce::Parser::Domain)); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub parse { |
20
|
|
|
|
|
|
|
my ( $self, $parser, $doc ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#return Nikto::Parser::ScanDetails->new( hosts => \@hosts ); |
23
|
|
|
|
|
|
|
my $xpc = XML::LibXML::XPathContext->new($doc); |
24
|
|
|
|
|
|
|
my @domains; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
foreach my $h ( $xpc->findnodes('//fiercescan/domainscan') ) { |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $domain = $h->getAttribute('domain'); |
29
|
|
|
|
|
|
|
my $startscan = $h->getAttribute('startscan'); |
30
|
|
|
|
|
|
|
my $startscanstr = $h->getAttribute('startscanstr'); |
31
|
|
|
|
|
|
|
my ( $bruteforce, $zone_transfers, $nameservers, $findmx, |
32
|
|
|
|
|
|
|
$reverselookups ); |
33
|
|
|
|
|
|
|
my ( $extbruteforce, $whois_lookup, $wildcard, $vhost, |
34
|
|
|
|
|
|
|
$find_nearby, $arin_lookup ); |
35
|
|
|
|
|
|
|
foreach my $ds ( |
36
|
|
|
|
|
|
|
$xpc->findnodes( |
37
|
|
|
|
|
|
|
'//fiercescan/domainscan[@domain="' . $domain . '"]' |
38
|
|
|
|
|
|
|
) |
39
|
|
|
|
|
|
|
) |
40
|
|
|
|
|
|
|
{ |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# {{{ ns |
43
|
|
|
|
|
|
|
foreach my $e ( $ds->getElementsByTagName('nameservers') ) { |
44
|
|
|
|
|
|
|
my $starttime = $e->getAttribute('starttime'); |
45
|
|
|
|
|
|
|
my $starttimestr = $e->getAttribute('starttimestr'); |
46
|
|
|
|
|
|
|
my $endtime = $e->getAttribute('endtime'); |
47
|
|
|
|
|
|
|
my $endtimestr = $e->getAttribute('endtimestr'); |
48
|
|
|
|
|
|
|
my $elapsedtime = $e->getAttribute('elapsedtime'); |
49
|
|
|
|
|
|
|
my @nodes; |
50
|
|
|
|
|
|
|
foreach my $n ( $e->getElementsByTagName('node') ) { |
51
|
|
|
|
|
|
|
my $node = Fierce::Parser::Node->new( |
52
|
|
|
|
|
|
|
ip => $n->getAttribute('ip'), |
53
|
|
|
|
|
|
|
hostname => $n->getAttribute('hostname'), |
54
|
|
|
|
|
|
|
from => $n->getAttribute('from') |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
push( @nodes, $node ); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$nameservers = Fierce::Parser::Domain::NameServers->new( |
61
|
|
|
|
|
|
|
nodes => \@nodes, |
62
|
|
|
|
|
|
|
starttime => $starttime, |
63
|
|
|
|
|
|
|
starttimestr => $starttimestr, |
64
|
|
|
|
|
|
|
endtime => $endtime, |
65
|
|
|
|
|
|
|
endtimestr => $endtimestr, |
66
|
|
|
|
|
|
|
elapsedtime => $elapsedtime, |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
} # }}} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# {{{ arin |
71
|
|
|
|
|
|
|
foreach my $e ( $ds->getElementsByTagName('arin') ) { |
72
|
|
|
|
|
|
|
my $query = $e->getAttribute('query'); |
73
|
|
|
|
|
|
|
my $starttime = $e->getAttribute('starttime'); |
74
|
|
|
|
|
|
|
my $starttimestr = $e->getAttribute('starttimestr'); |
75
|
|
|
|
|
|
|
my $endtime = $e->getAttribute('endtime'); |
76
|
|
|
|
|
|
|
my $endtimestr = $e->getAttribute('endtimestr'); |
77
|
|
|
|
|
|
|
my $elapsedtime = $e->getAttribute('elapsedtime'); |
78
|
|
|
|
|
|
|
my @ranges; |
79
|
|
|
|
|
|
|
foreach my $r ( $e->getElementsByTagName('range') ) { |
80
|
|
|
|
|
|
|
my $range = Fierce::Parser::RangeResult->new( |
81
|
|
|
|
|
|
|
net_handle => $r->getAttribute('nethandle'), |
82
|
|
|
|
|
|
|
net_range => $r->getAttribute('iprange'), |
83
|
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
push( @ranges, $range ); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
$arin_lookup = Fierce::Parser::Domain::ARIN->new( |
89
|
|
|
|
|
|
|
query => $query, |
90
|
|
|
|
|
|
|
result => \@ranges, |
91
|
|
|
|
|
|
|
starttime => $starttime, |
92
|
|
|
|
|
|
|
starttimestr => $starttimestr, |
93
|
|
|
|
|
|
|
endtime => $endtime, |
94
|
|
|
|
|
|
|
endtimestr => $endtimestr, |
95
|
|
|
|
|
|
|
elapsedtime => $elapsedtime, |
96
|
|
|
|
|
|
|
); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# }}} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# {{{ zt |
103
|
|
|
|
|
|
|
foreach my $e ( $ds->getElementsByTagName('zonetransfers') ) { |
104
|
|
|
|
|
|
|
my $starttime = $e->getAttribute('starttime'); |
105
|
|
|
|
|
|
|
my $starttimestr = $e->getAttribute('starttimestr'); |
106
|
|
|
|
|
|
|
my $endtime = $e->getAttribute('endtime'); |
107
|
|
|
|
|
|
|
my $endtimestr = $e->getAttribute('endtimestr'); |
108
|
|
|
|
|
|
|
my $elapsedtime = $e->getAttribute('elapsedtime'); |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my @result; |
111
|
|
|
|
|
|
|
foreach my $z ( $e->getElementsByTagName('zonetransfer') ) |
112
|
|
|
|
|
|
|
{ |
113
|
|
|
|
|
|
|
my ( $raw_output, @nodes ); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
foreach my $output ( |
116
|
|
|
|
|
|
|
$z->getElementsByTagName('rawoutput') ) |
117
|
|
|
|
|
|
|
{ |
118
|
|
|
|
|
|
|
$raw_output .= $output->textContent; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
foreach my $n ( $z->getElementsByTagName('node') ) { |
121
|
|
|
|
|
|
|
my $node = Fierce::Parser::Node->new( |
122
|
|
|
|
|
|
|
ip => $n->getAttribute('ip'), |
123
|
|
|
|
|
|
|
hostname => $n->getAttribute('hostname'), |
124
|
|
|
|
|
|
|
type => $n->getAttribute('type'), |
125
|
|
|
|
|
|
|
ttl => $n->getAttribute('ttl'), |
126
|
|
|
|
|
|
|
from => $n->getAttribute('from') |
127
|
|
|
|
|
|
|
); |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
push( @nodes, $node ); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
my $zt_result |
133
|
|
|
|
|
|
|
= Fierce::Parser::ZoneTransferResult->new( |
134
|
|
|
|
|
|
|
raw_output => $raw_output, |
135
|
|
|
|
|
|
|
nodes => \@nodes, |
136
|
|
|
|
|
|
|
name_server => $z->getAttribute('nameserver'), |
137
|
|
|
|
|
|
|
bool => $z->getAttribute('bool'), |
138
|
|
|
|
|
|
|
domain => $domain, |
139
|
|
|
|
|
|
|
); |
140
|
|
|
|
|
|
|
push( @result, $zt_result ); |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
$zone_transfers |
143
|
|
|
|
|
|
|
= Fierce::Parser::Domain::ZoneTransfers->new( |
144
|
|
|
|
|
|
|
result => \@result, |
145
|
|
|
|
|
|
|
starttime => $starttime, |
146
|
|
|
|
|
|
|
starttimestr => $starttimestr, |
147
|
|
|
|
|
|
|
endtime => $endtime, |
148
|
|
|
|
|
|
|
endtimestr => $endtimestr, |
149
|
|
|
|
|
|
|
elapsedtime => $elapsedtime, |
150
|
|
|
|
|
|
|
); |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
} # }}} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
# {{{ bf |
155
|
|
|
|
|
|
|
foreach my $e ( $ds->getElementsByTagName('bruteforce') ) { |
156
|
|
|
|
|
|
|
my $starttime = $e->getAttribute('starttime'); |
157
|
|
|
|
|
|
|
my $starttimestr = $e->getAttribute('starttimestr'); |
158
|
|
|
|
|
|
|
my $endtime = $e->getAttribute('endtime'); |
159
|
|
|
|
|
|
|
my $endtimestr = $e->getAttribute('endtimestr'); |
160
|
|
|
|
|
|
|
my $elapsedtime = $e->getAttribute('elapsedtime'); |
161
|
|
|
|
|
|
|
my @nodes; |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
foreach my $n ( $e->getElementsByTagName('node') ) { |
164
|
|
|
|
|
|
|
my $node = Fierce::Parser::Node->new( |
165
|
|
|
|
|
|
|
ip => $n->getAttribute('ip'), |
166
|
|
|
|
|
|
|
hostname => $n->getAttribute('hostname'), |
167
|
|
|
|
|
|
|
from => $n->getAttribute('from') |
168
|
|
|
|
|
|
|
); |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
push( @nodes, $node ); |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
$bruteforce = Fierce::Parser::Domain::BruteForce->new( |
174
|
|
|
|
|
|
|
nodes => \@nodes, |
175
|
|
|
|
|
|
|
starttime => $starttime, |
176
|
|
|
|
|
|
|
starttimestr => $starttimestr, |
177
|
|
|
|
|
|
|
endtime => $endtime, |
178
|
|
|
|
|
|
|
endtimestr => $endtimestr, |
179
|
|
|
|
|
|
|
elapsedtime => $elapsedtime, |
180
|
|
|
|
|
|
|
); |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
} # }}} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
# {{{ subdomain bf |
185
|
|
|
|
|
|
|
foreach |
186
|
|
|
|
|
|
|
my $e ( $ds->getElementsByTagName('subdomainbruteforce') ) |
187
|
|
|
|
|
|
|
{ |
188
|
|
|
|
|
|
|
my $starttime = $e->getAttribute('starttime'); |
189
|
|
|
|
|
|
|
my $starttimestr = $e->getAttribute('starttimestr'); |
190
|
|
|
|
|
|
|
my $endtime = $e->getAttribute('endtime'); |
191
|
|
|
|
|
|
|
my $endtimestr = $e->getAttribute('endtimestr'); |
192
|
|
|
|
|
|
|
my $elapsedtime = $e->getAttribute('elapsedtime'); |
193
|
|
|
|
|
|
|
my @nodes; |
194
|
|
|
|
|
|
|
foreach my $n ( $e->getElementsByTagName('node') ) { |
195
|
|
|
|
|
|
|
my $node = Fierce::Parser::Node->new( |
196
|
|
|
|
|
|
|
ip => $n->getAttribute('ip'), |
197
|
|
|
|
|
|
|
hostname => $n->getAttribute('hostname'), |
198
|
|
|
|
|
|
|
from => $n->getAttribute('from') |
199
|
|
|
|
|
|
|
); |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
push( @nodes, $node ); |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
$subdomainbruteforce |
205
|
|
|
|
|
|
|
= Fierce::Parser::Domain::SubdomainBruteForce->new( |
206
|
|
|
|
|
|
|
nodes => \@nodes, |
207
|
|
|
|
|
|
|
starttime => $starttime, |
208
|
|
|
|
|
|
|
starttimestr => $starttimestr, |
209
|
|
|
|
|
|
|
endtime => $endtime, |
210
|
|
|
|
|
|
|
endtimestr => $endtimestr, |
211
|
|
|
|
|
|
|
elapsedtime => $elapsedtime, |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
); |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
} # }}} |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
# {{{ ext bf |
218
|
|
|
|
|
|
|
foreach my $e ( $ds->getElementsByTagName('extbruteforce') ) { |
219
|
|
|
|
|
|
|
my $starttime = $e->getAttribute('starttime'); |
220
|
|
|
|
|
|
|
my $starttimestr = $e->getAttribute('starttimestr'); |
221
|
|
|
|
|
|
|
my $endtime = $e->getAttribute('endtime'); |
222
|
|
|
|
|
|
|
my $endtimestr = $e->getAttribute('endtimestr'); |
223
|
|
|
|
|
|
|
my $elapsedtime = $e->getAttribute('elapsedtime'); |
224
|
|
|
|
|
|
|
my @nodes; |
225
|
|
|
|
|
|
|
foreach my $n ( $e->getElementsByTagName('node') ) { |
226
|
|
|
|
|
|
|
my $node = Fierce::Parser::Node->new( |
227
|
|
|
|
|
|
|
ip => $n->getAttribute('ip'), |
228
|
|
|
|
|
|
|
hostname => $n->getAttribute('hostname'), |
229
|
|
|
|
|
|
|
from => $n->getAttribute('from') |
230
|
|
|
|
|
|
|
); |
231
|
|
|
|
|
|
|
push( @nodes, $node ); |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
$extbruteforce |
235
|
|
|
|
|
|
|
= Fierce::Parser::Domain::ExtBruteForce->new( |
236
|
|
|
|
|
|
|
nodes => \@nodes, |
237
|
|
|
|
|
|
|
starttime => $starttime, |
238
|
|
|
|
|
|
|
starttimestr => $starttimestr, |
239
|
|
|
|
|
|
|
endtime => $endtime, |
240
|
|
|
|
|
|
|
endtimestr => $endtimestr, |
241
|
|
|
|
|
|
|
elapsedtime => $elapsedtime, |
242
|
|
|
|
|
|
|
); |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
} # }}} |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
# {{{ find mx |
247
|
|
|
|
|
|
|
foreach my $e ( $ds->getElementsByTagName('findmx') ) { |
248
|
|
|
|
|
|
|
my $starttime = $e->getAttribute('starttime'); |
249
|
|
|
|
|
|
|
my $starttimestr = $e->getAttribute('starttimestr'); |
250
|
|
|
|
|
|
|
my $endtime = $e->getAttribute('endtime'); |
251
|
|
|
|
|
|
|
my $endtimestr = $e->getAttribute('endtimestr'); |
252
|
|
|
|
|
|
|
my $elapsedtime = $e->getAttribute('elapsedtime'); |
253
|
|
|
|
|
|
|
my @result; |
254
|
|
|
|
|
|
|
foreach my $n ( $e->getElementsByTagName('mx') ) { |
255
|
|
|
|
|
|
|
my $mx = Fierce::Parser::FindMXResult->new( |
256
|
|
|
|
|
|
|
preference => $n->getAttribute('preference'), |
257
|
|
|
|
|
|
|
exchange => $n->getAttribute('exchange') |
258
|
|
|
|
|
|
|
); |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
push( @result, $mx ); |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
$findmx = Fierce::Parser::Domain::FindMX->new( |
263
|
|
|
|
|
|
|
result => \@result, |
264
|
|
|
|
|
|
|
starttime => $starttime, |
265
|
|
|
|
|
|
|
starttimestr => $starttimestr, |
266
|
|
|
|
|
|
|
endtime => $endtime, |
267
|
|
|
|
|
|
|
endtimestr => $endtimestr, |
268
|
|
|
|
|
|
|
elapsedtime => $elapsedtime, |
269
|
|
|
|
|
|
|
); |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
} # }}} |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
# {{{ vhost |
274
|
|
|
|
|
|
|
foreach my $e ( $ds->getElementsByTagName('vhost') ) { |
275
|
|
|
|
|
|
|
my $starttime = $e->getAttribute('starttime'); |
276
|
|
|
|
|
|
|
my $starttimestr = $e->getAttribute('starttimestr'); |
277
|
|
|
|
|
|
|
my $endtime = $e->getAttribute('endtime'); |
278
|
|
|
|
|
|
|
my $endtimestr = $e->getAttribute('endtimestr'); |
279
|
|
|
|
|
|
|
my $elapsedtime = $e->getAttribute('elapsedtime'); |
280
|
|
|
|
|
|
|
my @nodes; |
281
|
|
|
|
|
|
|
foreach my $n ( $e->getElementsByTagName('node') ) { |
282
|
|
|
|
|
|
|
my $node = Fierce::Parser::Node->new( |
283
|
|
|
|
|
|
|
ip => $n->getAttribute('ip'), |
284
|
|
|
|
|
|
|
hostname => $n->getAttribute('hostname'), |
285
|
|
|
|
|
|
|
from => $n->getAttribute('from') |
286
|
|
|
|
|
|
|
); |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
push( @nodes, $node ); |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
$vhost = Fierce::Parser::Domain::Vhost->new( |
291
|
|
|
|
|
|
|
nodes => \@nodes, |
292
|
|
|
|
|
|
|
starttime => $starttime, |
293
|
|
|
|
|
|
|
starttimestr => $starttimestr, |
294
|
|
|
|
|
|
|
endtime => $endtime, |
295
|
|
|
|
|
|
|
endtimestr => $endtimestr, |
296
|
|
|
|
|
|
|
elapsedtime => $elapsedtime, |
297
|
|
|
|
|
|
|
); |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
} # }}} |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
# {{{ wildcard |
302
|
|
|
|
|
|
|
foreach my $e ( $ds->getElementsByTagName('wildcard') ) { |
303
|
|
|
|
|
|
|
my $starttime = $e->getAttribute('starttime'); |
304
|
|
|
|
|
|
|
my $starttimestr = $e->getAttribute('starttimestr'); |
305
|
|
|
|
|
|
|
my $endtime = $e->getAttribute('endtime'); |
306
|
|
|
|
|
|
|
my $endtimestr = $e->getAttribute('endtimestr'); |
307
|
|
|
|
|
|
|
my $elapsedtime = $e->getAttribute('elapsedtime'); |
308
|
|
|
|
|
|
|
my $bool |
309
|
|
|
|
|
|
|
= ( |
310
|
|
|
|
|
|
|
scalar( @{ $e->getElementsByTagName('node') } ) > 0 ) |
311
|
|
|
|
|
|
|
? 1 |
312
|
|
|
|
|
|
|
: 0; |
313
|
|
|
|
|
|
|
$wildcard = Fierce::Parser::Domain::WildCard->new( |
314
|
|
|
|
|
|
|
bool => $bool, |
315
|
|
|
|
|
|
|
starttime => $starttime, |
316
|
|
|
|
|
|
|
starttimestr => $starttimestr, |
317
|
|
|
|
|
|
|
endtime => $endtime, |
318
|
|
|
|
|
|
|
endtimestr => $endtimestr, |
319
|
|
|
|
|
|
|
elapsedtime => $elapsedtime, |
320
|
|
|
|
|
|
|
); |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
# }}} |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
# {{{ whois |
327
|
|
|
|
|
|
|
foreach my $e ( $ds->getElementsByTagName('whois') ) { |
328
|
|
|
|
|
|
|
my $starttime = $e->getAttribute('starttime'); |
329
|
|
|
|
|
|
|
my $starttimestr = $e->getAttribute('starttimestr'); |
330
|
|
|
|
|
|
|
my $endtime = $e->getAttribute('endtime'); |
331
|
|
|
|
|
|
|
my $endtimestr = $e->getAttribute('endtimestr'); |
332
|
|
|
|
|
|
|
my $elapsedtime = $e->getAttribute('elapsedtime'); |
333
|
|
|
|
|
|
|
my @ranges; |
334
|
|
|
|
|
|
|
foreach my $r ( $e->getElementsByTagName('range') ) { |
335
|
|
|
|
|
|
|
my $range = Fierce::Parser::RangeResult->new( |
336
|
|
|
|
|
|
|
net_handle => $r->getAttribute('nethandle'), |
337
|
|
|
|
|
|
|
net_range => $r->getAttribute('iprange'), |
338
|
|
|
|
|
|
|
); |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
push( @ranges, $range ); |
341
|
|
|
|
|
|
|
} |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
$whois_lookup = Fierce::Parser::Domain::WhoisLookup->new( |
344
|
|
|
|
|
|
|
result => \@ranges, |
345
|
|
|
|
|
|
|
starttime => $starttime, |
346
|
|
|
|
|
|
|
starttimestr => $starttimestr, |
347
|
|
|
|
|
|
|
endtime => $endtime, |
348
|
|
|
|
|
|
|
endtimestr => $endtimestr, |
349
|
|
|
|
|
|
|
elapsedtime => $elapsedtime, |
350
|
|
|
|
|
|
|
); |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
# }}} |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
# {{{ rev lookup |
357
|
|
|
|
|
|
|
foreach my $e ( $ds->getElementsByTagName('reverselookup') ) { |
358
|
|
|
|
|
|
|
my $starttime = $e->getAttribute('starttime'); |
359
|
|
|
|
|
|
|
my $starttimestr = $e->getAttribute('starttimestr'); |
360
|
|
|
|
|
|
|
my $endtime = $e->getAttribute('endtime'); |
361
|
|
|
|
|
|
|
my $endtimestr = $e->getAttribute('endtimestr'); |
362
|
|
|
|
|
|
|
my $elapsedtime = $e->getAttribute('elapsedtime'); |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
my @nodes; |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
foreach my $n ( $e->getElementsByTagName('node') ) { |
367
|
|
|
|
|
|
|
my $node = Fierce::Parser::Node->new( |
368
|
|
|
|
|
|
|
ip => $n->getAttribute('ip'), |
369
|
|
|
|
|
|
|
hostname => $n->getAttribute('hostname'), |
370
|
|
|
|
|
|
|
from => $n->getAttribute('from') |
371
|
|
|
|
|
|
|
); |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
push( @nodes, $node ); |
374
|
|
|
|
|
|
|
} |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
$reverselookups |
377
|
|
|
|
|
|
|
= Fierce::Parser::Domain::ReverseLookups->new( |
378
|
|
|
|
|
|
|
nodes => \@nodes, |
379
|
|
|
|
|
|
|
starttime => $starttime, |
380
|
|
|
|
|
|
|
starttimestr => $starttimestr, |
381
|
|
|
|
|
|
|
endtime => $endtime, |
382
|
|
|
|
|
|
|
endtimestr => $endtimestr, |
383
|
|
|
|
|
|
|
elapsedtime => $elapsedtime, |
384
|
|
|
|
|
|
|
); |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
} |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
# }}} |
389
|
|
|
|
|
|
|
# {{{ find nearby |
390
|
|
|
|
|
|
|
foreach my $e ( $ds->getElementsByTagName('findnearby') ) { |
391
|
|
|
|
|
|
|
my $starttime = $e->getAttribute('starttime'); |
392
|
|
|
|
|
|
|
my $starttimestr = $e->getAttribute('starttimestr'); |
393
|
|
|
|
|
|
|
my $endtime = $e->getAttribute('endtime'); |
394
|
|
|
|
|
|
|
my $endtimestr = $e->getAttribute('endtimestr'); |
395
|
|
|
|
|
|
|
my $elapsedtime = $e->getAttribute('elapsedtime'); |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
my @ptrs; |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
foreach my $n ( $e->getElementsByTagName('ptr') ) { |
400
|
|
|
|
|
|
|
my $ptr = Fierce::Parser::PTR->new( |
401
|
|
|
|
|
|
|
ip => $n->getAttribute('ip'), |
402
|
|
|
|
|
|
|
hostname => $n->getAttribute('hostname'), |
403
|
|
|
|
|
|
|
ptrdname => $n->getAttribute('ptrdname'), |
404
|
|
|
|
|
|
|
from => $n->getAttribute('from') |
405
|
|
|
|
|
|
|
); |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
push( @ptrs, $ptr ); |
408
|
|
|
|
|
|
|
} |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
$find_nearby = Fierce::Parser::Domain::FindNearby->new( |
411
|
|
|
|
|
|
|
ptrs => \@ptrs, |
412
|
|
|
|
|
|
|
starttime => $starttime, |
413
|
|
|
|
|
|
|
starttimestr => $starttimestr, |
414
|
|
|
|
|
|
|
endtime => $endtime, |
415
|
|
|
|
|
|
|
endtimestr => $endtimestr, |
416
|
|
|
|
|
|
|
elapsedtime => $elapsedtime, |
417
|
|
|
|
|
|
|
); |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
# }}} |
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
} |
424
|
|
|
|
|
|
|
my $domain_obj = Fierce::Parser::Domain->new( |
425
|
|
|
|
|
|
|
domain => $domain, |
426
|
|
|
|
|
|
|
startscan => $startscan, |
427
|
|
|
|
|
|
|
startscanstr => $startscanstr, |
428
|
|
|
|
|
|
|
ext_bruteforce => $extbruteforce, |
429
|
|
|
|
|
|
|
bruteforce => $bruteforce, |
430
|
|
|
|
|
|
|
subdomain_bruteforce => $subdomainbruteforce, |
431
|
|
|
|
|
|
|
zone_transfers => $zone_transfers, |
432
|
|
|
|
|
|
|
name_servers => $nameservers, |
433
|
|
|
|
|
|
|
findmx => $findmx, |
434
|
|
|
|
|
|
|
vhost => $vhost, |
435
|
|
|
|
|
|
|
reverse_lookups => $reverselookups, |
436
|
|
|
|
|
|
|
wildcard => $wildcard, |
437
|
|
|
|
|
|
|
arin_lookup => $arin_lookup, |
438
|
|
|
|
|
|
|
whois_lookup => $whois_lookup, |
439
|
|
|
|
|
|
|
find_nearby => $find_nearby, |
440
|
|
|
|
|
|
|
); |
441
|
|
|
|
|
|
|
push( @domains, $domain_obj ); |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
} |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
return Fierce::Parser::DomainScanDetails->new( domains => \@domains ); |
446
|
|
|
|
|
|
|
} |
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
sub get_host_ip { |
449
|
|
|
|
|
|
|
my ( $self, $ip ) = @_; |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
#return $hosts[0]; |
452
|
|
|
|
|
|
|
return; |
453
|
|
|
|
|
|
|
} |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
sub get_host_hostname { |
456
|
|
|
|
|
|
|
my ( $self, $hostname ) = @_; |
457
|
|
|
|
|
|
|
my @hosts = grep( $_->domain eq $hostname, @{ $self->domains } ); |
458
|
|
|
|
|
|
|
return $hosts[0]; |
459
|
|
|
|
|
|
|
} |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
sub all_hosts { |
462
|
|
|
|
|
|
|
my ($self) = @_; |
463
|
|
|
|
|
|
|
return @{ $self->domains }; |
464
|
|
|
|
|
|
|
} |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
sub print_hosts { |
467
|
|
|
|
|
|
|
my ($self) = @_; |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
# foreach my $host ( @{ $self->hosts } ) { |
470
|
|
|
|
|
|
|
# print "IP: " . $host->ip . "\n"; |
471
|
|
|
|
|
|
|
# print "Hostname: " . $host->hostname . "\n"; |
472
|
|
|
|
|
|
|
#} |
473
|
|
|
|
|
|
|
return; |
474
|
|
|
|
|
|
|
} |
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
} |
477
|
|
|
|
|
|
|
1; |