Changeset 196
- Timestamp:
- 10/03/09 19:59:24 (4 years ago)
- File:
-
- 1 edited
-
fierce2/branch/fierce (modified) (26 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fierce2/branch/fierce
r195 r196 55 55 my $pattern = 0; 56 56 my $wildc_stop = 0; 57 57 58 # ignore all errors while trying to load up thead stuff 58 59 BEGIN { … … 177 178 GetOptions( 178 179 \%options, 179 'dns=s', 'format=s', 'no=s', 'all', 'wide', 'traverse=i', 180 'delay=i', 'template=s',180 'dns=s', 'format=s', 'no=s', 'all', 'wide', 'traverse=i', 181 'delay=i', 'template=s', 181 182 'tcptimeout=i', 'udptimeout=i', 'threads=i', 'subdomains=s', 'search=s', 182 'dnsserver=s', 'ztstop', 'prefix=s', 183 'exts=s', 'output=s', 'range=s','wildcstop',184 'maxbruteforce=i', 'maxlookups=s', 'arin=s',185 'verbose+' => \$verbose,186 'debug+' => \$debug,183 'dnsserver=s', 'ztstop', 'prefix=s', 184 'exts=s', 'output=s', 'range=s', 'wildcstop', 185 'maxbruteforce=i', 'maxlookups=s', 'arin=s', 186 'verbose+' => \$verbose, 187 'debug+' => \$debug, 187 188 'help|h' => sub { help(); }, 188 189 'version|v' => sub { print_version(); }, … … 235 236 if ( $options{dnsservers} ) { 236 237 if ( -r $options{dnsservers} ) { 237 open( DNSSERVERS, $options{dnsservers} ) || die("Could not open file!"); 238 open( DNSSERVERS, $options{dnsservers} ) 239 || die("Could not open file!"); 238 240 @name_servers = <DNSSERVERS>; 239 241 close(DNSSERVERS); … … 333 335 my $include_path = "tt/$format"; 334 336 my $template; 335 if ( $options{template} ) {337 if ( $options{template} ) { 336 338 if ( -d $options{template} ) { 337 $template = $options{template};339 $template = $options{template}; 338 340 $include_path = "$template/$format"; 339 341 } … … 343 345 my $config = { 344 346 INCLUDE_PATH => "$include_path", # or list ref 345 INTERPOLATE => 1, # expand "$var" in plain text346 POST_CHOMP => 1, # cleanup whitespace347 EVAL_PERL => 1, # evaluate Perl code blocks347 INTERPOLATE => 1, # expand "$var" in plain text 348 POST_CHOMP => 1, # cleanup whitespace 349 EVAL_PERL => 1, # evaluate Perl code blocks 348 350 }; 349 351 … … 361 363 362 364 sub template_output { 363 my ( $obj,$result,$template) = @_;365 my ( $obj, $result, $template ) = @_; 364 366 365 367 my $obj_output; … … 373 375 elasp => $obj->elasp, 374 376 }; 377 375 378 # reference to output text string 376 $tt->process( "$template", $vars, 377 \$obj_output ) 379 $tt->process( "$template", $vars, \$obj_output ) 378 380 || die $tt->error(), "\n"; 379 381 output($obj_output); 380 382 } 381 382 383 383 384 my $args; … … 404 405 405 406 if ( $options{range} ) { 406 if ( $options{dnsservers} ) {407 if ( $options{dnsservers} ) { 407 408 help(); 408 409 } 409 410 my @ipranges; 410 411 411 if ($options{range} =~ /(\d{1,3}\.\d{1,3}\.\d{1,3})\.(\d{1,3})\-(\d{1,3})/ ) { 412 my ($group,$oct2,$oct3) = ($1,$2,$3); 413 foreach($oct2..$oct3) { 412 if ( $options{range} 413 =~ /(\d{1,3}\.\d{1,3}\.\d{1,3})\.(\d{1,3})\-(\d{1,3})/ ) 414 { 415 my ( $group, $oct2, $oct3 ) = ( $1, $2, $3 ); 416 foreach ( $oct2 .. $oct3 ) { 414 417 chomp; 415 push( @ipranges,"$group.$_");418 push( @ipranges, "$group.$_" ); 416 419 } 417 420 } 418 elsif ($options{range} =~ /(\d{1,3}\.\d{1,3}\.\d{1,3})\.(\d{1,3})\/(\d{1,3})/) { 419 push(@ipranges,$options{range}); 421 elsif ( $options{range} 422 =~ /(\d{1,3}\.\d{1,3}\.\d{1,3})\.(\d{1,3})\/(\d{1,3})/ ) 423 { 424 push( @ipranges, $options{range} ); 420 425 } 421 426 my $iprange_obj = IPrange->new( iprange => \@ipranges ); … … 424 429 if ( $verbose > 0 or $format eq 'txt' ); 425 430 my $find_nearby = tFindNearby->new( 426 search => $search,427 pattern => $pattern,428 traverse => $traverse,429 wide => $wide,431 search => $search, 432 pattern => $pattern, 433 traverse => $traverse, 434 wide => $wide, 430 435 ); 431 436 $find_nearby = $find_nearby->execute($iprange_obj); 432 437 433 438 my $find_nearby_result = $find_nearby->result(); 434 template_output( $find_nearby,$find_nearby_result,'find_nearby.tt');439 template_output( $find_nearby, $find_nearby_result, 'find_nearby.tt' ); 435 440 exit; 436 } 441 } 437 442 elsif ( $options{dns} ) { 438 443 if ( -r $options{dns} ) { … … 468 473 my ( $whois, $wildcard, $ext_bf, $find_nearby ); 469 474 470 my ( %output_data, $vhost_result );471 my ( $subdomain_bf_result, $prefix_bf_result );472 my ( $wildcard_result, $reverse_lookup_result);473 my ( $find_mx_result, $whois_result);474 my ( $ext_bf_result, $zt_result);475 my ( $find_nearby_result);475 my ( %output_data, $vhost_result ); 476 my ( $subdomain_bf_result, $prefix_bf_result ); 477 my ( $wildcard_result, $reverse_lookup_result ); 478 my ( $find_mx_result, $whois_result ); 479 my ( $ext_bf_result, $zt_result ); 480 my ($find_nearby_result); 476 481 477 482 print "Nameservers for $dns\n" … … 481 486 482 487 my $ns_result = $ns->result(); 483 template_output( $ns,$ns_result,'ns.tt');488 template_output( $ns, $ns_result, 'ns.tt' ); 484 489 485 490 if ( grep( !/arin/, $no ) ) { … … 489 494 # 490 495 my $arin_query; 491 if ( $options{arin} ) {496 if ( $options{arin} ) { 492 497 $arin_query = $options{arin}; 493 498 } … … 498 503 print "ARIN lookup $arin_query\n" 499 504 if ( $verbose > 0 or $format eq 'txt' ); 500 my $arin = ARIN->new( query => $arin_query );501 $arin = $arin->execute( $domain);505 my $arin = ARIN->new( query => $arin_query ); 506 $arin = $arin->execute($domain); 502 507 503 508 my $arin_result = $arin->result(); … … 513 518 elasp => $arin->elasp, 514 519 }; 520 515 521 # reference to output text string 516 $tt->process( "arin.tt", $arin_vars, 517 \$arin_output ) 522 $tt->process( "arin.tt", $arin_vars, \$arin_output ) 518 523 || die $tt->error(), "\n"; 519 524 output($arin_output); … … 533 538 534 539 $zt_result = $zt->result(); 535 template_output( $zt,$zt_result,'zt.tt');540 template_output( $zt, $zt_result, 'zt.tt' ); 536 541 } 537 542 unless ( $options{ztstop} and $zt->check == 1 ) { … … 549 554 550 555 $wildcard_result = $wildcard->result(); 551 template_output($wildcard,$wildcard_result,'wildcard.tt'); 552 } 553 unless ( $options{wildcstop} and defined($wildcard) and $wildcard->check == 1 ) { 556 template_output( $wildcard, $wildcard_result, 'wildcard.tt' ); 557 } 558 unless ($options{wildcstop} 559 and defined($wildcard) 560 and $wildcard->check == 1 ) 561 { 554 562 ################################### 555 563 # … … 558 566 if ( grep( !/prebf/, $no ) ) { 559 567 560 561 568 print "Trying Prefix Bruteforce ... \n" 562 569 if ( $verbose > 0 or $format eq 'txt' ); … … 569 576 570 577 $prefix_bf_result = $prefix_bf->result(); 571 template_output($prefix_bf,$prefix_bf_result,'prefix_bf.tt'); 578 template_output( $prefix_bf, $prefix_bf_result, 579 'prefix_bf.tt' ); 572 580 } 573 581 ##################################### … … 589 597 590 598 $subdomain_bf_result = $subdomain_bf->result(); 591 template_output($subdomain_bf,$subdomain_bf_result,'subdomain_bf.tt'); 599 template_output( $subdomain_bf, $subdomain_bf_result, 600 'subdomain_bf.tt' ); 592 601 } 593 602 } … … 603 612 $ext_bf = tExtensionBruteForceDNS->new( 604 613 'extension_list' => \@ext_list, ); 605 $ext_bf = $ext_bf->execute($domain);614 $ext_bf = $ext_bf->execute($domain); 606 615 $ext_bf_result = $ext_bf->result(); 607 template_output( $ext_bf,$ext_bf_result,'ext_bf.tt');616 template_output( $ext_bf, $ext_bf_result, 'ext_bf.tt' ); 608 617 } 609 618 ###################################### … … 620 629 621 630 $vhost_result = $vhost->result(); 622 template_output( $vhost,$vhost_result,'vhost.tt');631 template_output( $vhost, $vhost_result, 'vhost.tt' ); 623 632 } 624 633 ################################################ … … 634 643 = $find_mx->execute( $domain, $base->new_dns_resolver ); 635 644 $find_mx_result = $find_mx->result(); 636 template_output( $find_mx,$find_mx_result,'find_mx.tt');645 template_output( $find_mx, $find_mx_result, 'find_mx.tt' ); 637 646 } 638 647 ##################################################### … … 649 658 650 659 $whois_result = $whois->result(); 651 template_output( $whois,$whois_result,'whois.tt');660 template_output( $whois, $whois_result, 'whois.tt' ); 652 661 } 653 662 … … 670 679 671 680 $reverse_lookup_result = $reverse_lookup->result(); 672 template_output($reverse_lookup,$reverse_lookup_result,'reverse_lookup.tt'); 681 template_output( $reverse_lookup, $reverse_lookup_result, 682 'reverse_lookup.tt' ); 673 683 } 674 684 ######################################################### … … 708 718 709 719 $find_nearby_result = $find_nearby->result(); 710 template_output($find_nearby,$find_nearby_result,'find_nearby.tt'); 720 template_output( $find_nearby, $find_nearby_result, 721 'find_nearby.tt' ); 711 722 } 712 723 } … … 749 760 \$end_fiercescan_output ) 750 761 || die $tt->error(), "\n"; 751 output($end_fiercescan_output) 762 output($end_fiercescan_output); 752 763 } 753 764 else {
Note: See TracChangeset
for help on using the changeset viewer.