Changeset 228
- Timestamp:
- 10/30/09 03:46:07 (4 years ago)
- File:
-
- 1 edited
-
fierce2/branch/fierce (modified) (33 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fierce2/branch/fierce
r227 r228 34 34 use vars qw( $PROG ); 35 35 ( $PROG = $0 ) =~ s/^.*[\/\\]//; # Truncate calling path from the prog name 36 my $fversion = '2.0';# fierce version37 my $xmlversion = '1.0';# xml version36 my $fversion = '2.0'; # fierce version 37 my $xmlversion = '1.0'; # xml version 38 38 my %options; 39 39 my ( @dns_names, @name_servers ); 40 40 my ( @prefix_list, @subdomain_list, @ext_list ); 41 41 my ( $log_file, $filename, $thread_support ); 42 my $port = 53, 43 my $tcp_timeout = 10; 42 my $port = 53, my $tcp_timeout = 10; 44 43 my $udp_timeout = 5; 45 44 my $delay = 5; … … 64 63 } 65 64 } 65 66 66 # handle output calls 67 67 sub header_output { … … 73 73 print $str; 74 74 } 75 76 75 77 76 # handle output calls … … 190 189 GetOptions( 191 190 \%options, 192 'dns=s', 'format=s', 'no=s', 'all', 'wide', 'traverse=i',193 'delay=i', 'template=s', 'port=s',191 'dns=s', 'format=s', 'no=s', 'all', 'wide', 'traverse=i', 192 'delay=i', 'template=s', 'port=s', 194 193 'tcptimeout=i', 'udptimeout=i', 'threads=i', 'subdomain=s', 'search=s', 195 'dnsservers=s', 'ztstop', 'prefix=s',196 'ext=s', 'output=s', 'range=s', 'wildcstop',194 'dnsservers=s', 'ztstop', 'prefix=s', 195 'ext=s', 'output=s', 'range=s', 'wildcstop', 197 196 'maxbruteforce=i', 'maxlookups=s', 'arin=s', 198 197 'verbose+' => \$verbose, … … 201 200 'version|v' => sub { print_version(); }, 202 201 ) or exit 1; 203 204 202 205 203 if ( $options{port} ) { … … 291 289 $ua->env_proxy; 292 290 my $response = $ua->get("$request"); 293 if ( $response->is_success) {294 @prefix_list = split( "\n",$response->decoded_content);291 if ( $response->is_success ) { 292 @prefix_list = split( "\n", $response->decoded_content ); 295 293 } 296 294 else { … … 341 339 $ua->env_proxy; 342 340 my $response = $ua->get("$request"); 343 if ( $response->is_success) {344 @subdomain_list = split( "\n",$response->decoded_content);341 if ( $response->is_success ) { 342 @subdomain_list = split( "\n", $response->decoded_content ); 345 343 } 346 344 else { … … 368 366 $ua->env_proxy; 369 367 my $response = $ua->get("$request"); 370 if ( $response->is_success) {371 @ext_list = split( "\n",$response->decoded_content);368 if ( $response->is_success ) { 369 @ext_list = split( "\n", $response->decoded_content ); 372 370 } 373 371 else { … … 382 380 'com', 'edu', 'net', 'org', 'co.uk', 'au', 383 381 'de', 'xxx', 'info', 'tv', 'biz', 'cc', 384 'cn', 'name', 'pro', 'us', 'la', 'com.au'382 'cn', 'name', 'pro', 'us', 'la', 'com.au' 385 383 ); 386 384 } … … 415 413 my $include_path_txt = $include_path; 416 414 $include_path_txt =~ s/$format/txt/; 415 417 416 # some useful options (see below for full list) 418 417 my $config_txt = { 419 INCLUDE_PATH => "$include_path_txt", # or list ref420 INTERPOLATE => 1, # expand "$var" in plain text421 POST_CHOMP => 1, # cleanup whitespace422 EVAL_PERL => 1, # evaluate Perl code blocks418 INCLUDE_PATH => "$include_path_txt", # or list ref 419 INTERPOLATE => 1, # expand "$var" in plain text 420 POST_CHOMP => 1, # cleanup whitespace 421 EVAL_PERL => 1, # evaluate Perl code blocks 423 422 }; 423 424 424 # create Template object 425 425 my $tt_txt = Template->new($config_txt); … … 427 427 # some useful options (see below for full list) 428 428 my $config = { 429 INCLUDE_PATH => "$include_path", # or list ref430 INTERPOLATE => 1, # expand "$var" in plain text431 POST_CHOMP => 1, # cleanup whitespace432 EVAL_PERL => 1, # evaluate Perl code blocks429 INCLUDE_PATH => "$include_path", # or list ref 430 INTERPOLATE => 1, # expand "$var" in plain text 431 POST_CHOMP => 1, # cleanup whitespace 432 EVAL_PERL => 1, # evaluate Perl code blocks 433 433 }; 434 434 435 # create Template object 435 436 my $tt = Template->new($config); … … 458 459 elasp => $obj->elasp, 459 460 }; 460 461 461 462 ## nmap output style 462 463 # reference to output text string … … 480 481 elasp => $obj->elasp, 481 482 }; 482 483 483 484 ## nmap output style 484 485 # reference to output text string … … 486 487 || die $tt_txt->error(), "\n"; 487 488 488 489 489 $obj_output = validate($obj_output); 490 490 return $obj_output; 491 491 } 492 492 493 494 493 sub template_output { 495 my ( $output, $output_txt ) = @_;496 $output = validate($output);494 my ( $output, $output_txt ) = @_; 495 $output = validate($output); 497 496 $output_txt = validate($output_txt); 498 497 … … 512 511 my $fierce_startstr = localtime($fierce_start); 513 512 my $start_fiercescan_vars = { 514 args => $args,515 start => $fierce_start,516 startstr => $fierce_startstr,517 verbose => $verbose,518 debug => $debug,519 fversion => $fversion,520 xmlversion => $xmlversion, 513 args => $args, 514 start => $fierce_start, 515 startstr => $fierce_startstr, 516 verbose => $verbose, 517 debug => $debug, 518 fversion => $fversion, 519 xmlversion => $xmlversion, 521 520 }; 522 521 … … 528 527 529 528 if ( $options{range} ) { 530 if ( ! $options{dnsservers} ) {529 if ( !$options{dnsservers} ) { 531 530 help(); 532 531 } … … 560 559 my $find_nearby_result = $find_nearby->result(); 561 560 562 template_output( 563 tt_output_setup( $find_nearby,564 $find_nearby_result,565 'find_nearby.tt'),566 tt_output_setup_txt( $find_nearby,567 $find_nearby_result,568 'find_nearby.tt'),569 570 );561 template_output( 562 tt_output_setup( 563 $find_nearby, $find_nearby_result, 'find_nearby.tt' 564 ), 565 tt_output_setup_txt( 566 $find_nearby, $find_nearby_result, 'find_nearby.tt' 567 ), 568 569 ); 571 570 exit; 572 571 } … … 600 599 || die $tt->error(), "\n"; 601 600 my $start_domainscan_output_txt; 601 602 602 # reference to output text string 603 603 $tt_txt->process( 'start_domainscan.tt', $start_domainscan_vars, … … 605 605 || die $tt_txt->error(), "\n"; 606 606 607 template_output($start_domainscan_output,$start_domainscan_output_txt); 607 template_output( $start_domainscan_output, 608 $start_domainscan_output_txt ); 608 609 609 610 my ( $zt, $ns, $prefix_bf, $subdomain_bf, $reverse_lookup, $find_mx ); … … 622 623 623 624 my $ns_result = $ns->result(); 624 template_output( 625 template_output( 625 626 tt_output_setup( $ns, $ns_result, 'ns.tt' ), 626 627 tt_output_setup_txt( $ns, $ns_result, 'ns.tt' ), 627 );628 ); 628 629 629 630 if ( grep( !/arin/, $no ) ) { … … 665 666 $tt_txt->process( "arin.tt", $arin_vars, \$arin_output_txt ) 666 667 || die $tt_txt->error(), "\n"; 667 template_output( $arin_output,$arin_output_txt);668 template_output( $arin_output, $arin_output_txt ); 668 669 } 669 670 … … 680 681 $zt_result = $zt->result(); 681 682 template_output( 682 tt_output_setup( $zt, $zt_result, 'zt.tt'),683 tt_output_setup_txt( $zt, $zt_result, 'zt.tt'),684 );683 tt_output_setup( $zt, $zt_result, 'zt.tt' ), 684 tt_output_setup_txt( $zt, $zt_result, 'zt.tt' ), 685 ); 685 686 } 686 687 unless ( $options{ztstop} and $zt->check == 1 ) { … … 698 699 $wildcard_result = $wildcard->result(); 699 700 template_output( 700 tt_output_setup( $wildcard, $wildcard_result, 'wildcard.tt' ), 701 tt_output_setup_txt( $wildcard, $wildcard_result, 'wildcard.tt' ), 701 tt_output_setup( 702 $wildcard, $wildcard_result, 'wildcard.tt' 703 ), 704 tt_output_setup_txt( 705 $wildcard, $wildcard_result, 'wildcard.tt' 706 ), 702 707 ); 703 708 } … … 722 727 $prefix_bf_result = $prefix_bf->result(); 723 728 template_output( 724 tt_output_setup( $prefix_bf, $prefix_bf_result, 725 'prefix_bf.tt' ), 726 tt_output_setup_txt( $prefix_bf, $prefix_bf_result, 727 'prefix_bf.tt' ), 729 tt_output_setup( 730 $prefix_bf, $prefix_bf_result, 'prefix_bf.tt' 731 ), 732 tt_output_setup_txt( 733 $prefix_bf, $prefix_bf_result, 'prefix_bf.tt' 734 ), 728 735 ); 729 736 } … … 746 753 $subdomain_bf_result = $subdomain_bf->result(); 747 754 template_output( 748 tt_output_setup( $subdomain_bf, $subdomain_bf_result, 749 'subdomain_bf.tt' ), 750 tt_output_setup_txt( $subdomain_bf, $subdomain_bf_result, 751 'subdomain_bf.tt' ), 752 753 ); 755 tt_output_setup( 756 $subdomain_bf, $subdomain_bf_result, 757 'subdomain_bf.tt' 758 ), 759 tt_output_setup_txt( 760 $subdomain_bf, $subdomain_bf_result, 761 'subdomain_bf.tt' 762 ), 763 764 ); 754 765 } 755 766 } … … 768 779 template_output( 769 780 tt_output_setup( $ext_bf, $ext_bf_result, 'ext_bf.tt' ), 770 tt_output_setup_txt( $ext_bf, $ext_bf_result, 'ext_bf.tt' ), 781 tt_output_setup_txt( 782 $ext_bf, $ext_bf_result, 'ext_bf.tt' 783 ), 771 784 ); 772 785 } … … 784 797 $vhost_result = $vhost->result(); 785 798 template_output( 786 tt_output_setup( $vhost, $vhost_result, 'vhost.tt' ),787 tt_output_setup_txt( $vhost, $vhost_result, 'vhost.tt' ),788 );799 tt_output_setup( $vhost, $vhost_result, 'vhost.tt' ), 800 tt_output_setup_txt( $vhost, $vhost_result, 'vhost.tt' ), 801 ); 789 802 } 790 803 ################################################ … … 800 813 $find_mx_result = $find_mx->result(); 801 814 template_output( 802 tt_output_setup( $find_mx, $find_mx_result, 'find_mx.tt' ), 803 tt_output_setup_txt( $find_mx, $find_mx_result, 'find_mx.tt' ), 804 ); 815 tt_output_setup( 816 $find_mx, $find_mx_result, 'find_mx.tt' 817 ), 818 tt_output_setup_txt( 819 $find_mx, $find_mx_result, 'find_mx.tt' 820 ), 821 ); 805 822 } 806 823 ##################################################### … … 817 834 $whois_result = $whois->result(); 818 835 template_output( 819 tt_output_setup( $whois, $whois_result, 'whois.tt' ),820 tt_output_setup_txt( $whois, $whois_result, 'whois.tt' ),821 );836 tt_output_setup( $whois, $whois_result, 'whois.tt' ), 837 tt_output_setup_txt( $whois, $whois_result, 'whois.tt' ), 838 ); 822 839 } 823 840 … … 840 857 $reverse_lookup_result = $reverse_lookup->result(); 841 858 template_output( 842 tt_output_setup( $reverse_lookup, $reverse_lookup_result,'reverse_lookup.tt' ), 843 tt_output_setup_txt( $reverse_lookup, $reverse_lookup_result,'reverse_lookup.tt' ), 844 ); 859 tt_output_setup( 860 $reverse_lookup, $reverse_lookup_result, 861 'reverse_lookup.tt' 862 ), 863 tt_output_setup_txt( 864 $reverse_lookup, $reverse_lookup_result, 865 'reverse_lookup.tt' 866 ), 867 ); 845 868 } 846 869 ######################################################### … … 880 903 $find_nearby_result = $find_nearby->result(); 881 904 template_output( 882 tt_output_setup( $find_nearby, $find_nearby_result, 883 'find_nearby.tt' ), 884 tt_output_setup_txt( $find_nearby, $find_nearby_result, 885 'find_nearby.tt' ), 905 tt_output_setup( 906 $find_nearby, $find_nearby_result, 907 'find_nearby.tt' 908 ), 909 tt_output_setup_txt( 910 $find_nearby, $find_nearby_result, 911 'find_nearby.tt' 912 ), 886 913 ); 887 914 } … … 906 933 || die $tt->error(), 907 934 "\n"; 908 935 909 936 my $end_domainscan_output_txt; 937 910 938 # reference to output text string 911 939 $tt_txt->process( 'end_domainscan.tt', $end_domainscan_vars, 912 \$end_domainscan_output_txt )913 || die $tt_txt->error(),940 \$end_domainscan_output_txt ) 941 || die $tt_txt->error(), 914 942 "\n"; 915 943 916 template_output( $end_domainscan_output,$end_domainscan_output_txt);944 template_output( $end_domainscan_output, $end_domainscan_output_txt ); 917 945 } 918 946 … … 933 961 \$end_fiercescan_output ) 934 962 || die $tt->error(), "\n"; 935 963 936 964 my $end_fiercescan_output_txt; 965 937 966 # reference to output text string 938 967 $tt_txt->process( 'end_fiercescan.tt', $end_fiercescan_vars, 939 \$end_fiercescan_output_txt )940 || die $tt_txt->error(),941 "\n";968 \$end_fiercescan_output_txt ) 969 || die $tt_txt->error(), 970 "\n"; 942 971 943 972 template_output($end_fiercescan_output);
Note: See TracChangeset
for help on using the changeset viewer.