Changeset 624
- Timestamp:
- 02/13/2011 03:38:16 AM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
docs/CHANGES.txt (modified) (1 diff)
-
plugins/nikto_core.plugin (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/CHANGES.txt
r623 r624 9 9 - Properly close <niktoscan> 10 10 - Incremented nxmlversion to 1.1 11 - Tickets 202, 203: Rewrote set_targets to not accidentally collapse targets, which fixed terminate signal issues 11 12 - Ticket 201: Rewritten & fixed authorization code work better and make fewer requests 12 13 - Ticket 195: Update interactive status counts if mutate options are used -
trunk/plugins/nikto_core.plugin
r623 r624 898 898 my $host_ctr = 1; 899 899 my @hosts = split(/,/, $hostlist); 900 my @ ports = split(/,/, $portlist) if defined $portlist;901 my (@ checkhosts, @results, @marks);902 my $defaultport = ($ssl) ? 443 : 80; 903 904 # Check for old style portlist and expand 905 my @newports;906 foreach my $port (@ ports) {900 my @tempports = split(/,/, $portlist) if defined $portlist; 901 my (@ports, @checkhosts, @results, @marks); 902 903 nprint("- Getting targets", "v"); 904 905 # Check for portlist and expand 906 foreach my $port (@tempports) { 907 907 if ($port =~ /-/) { 908 908 my ($start, $end); … … 917 917 } 918 918 for (my $i = $start ; $i <= $end ; $i++) { 919 push(@ newports, $i);919 push(@ports, $i); 920 920 } 921 921 } 922 922 else { 923 push(@newports, $port); 924 } 925 } 926 @ports = @newports; 927 928 nprint("- Getting targets", "v"); 929 if (scalar(@ports) == 1) { 930 931 # Only one port is set, assume that as the default port 932 $defaultport = $ports[0]; 933 } 934 935 # check whether it's a file or an entry 923 push(@ports, $port); 924 } 925 } 926 927 # no ports explicitly set, so use default port 928 if (scalar(@ports) == 0) { 929 push(@ports, $defaultport); 930 } 931 932 # check whether -h is a file or an entry 936 933 foreach my $host (@hosts) { 937 934 if (-e $host || $host eq "-") { … … 944 941 } 945 942 946 # Now parse the list of checkhosts 943 # Now parse the list of checkhosts, store in %targs by host:port 944 my $targs={}; 947 945 foreach my $host (@checkhosts) { 948 my $defhost;949 my $defport;950 946 $host =~ s/\s+//g; 951 947 if (!defined $host) { next; } 952 my $markhash = {}; 953 954 if ($root ne '') { 955 $markhash->{'root'} = $root; 956 nprint("- Added -root value of '$root' from CLI", "v"); 957 } 948 my ($defhost, $defport)=''; 958 949 959 950 # is it a URL? … … 963 954 $defhost = $hostdata[2]; 964 955 $defport = $hostdata[3]; 956 $targs{$defhost . ":" . $defport}= ($root ne "") ? $root : '/'; 965 957 966 958 if (($hostdata[0] ne '/') && ($hostdata[0] ne '') && ($root eq '')) { 967 $ markhash->{'root'}= $hostdata[0];959 $targs{$defhost . ":" . $defport}= $hostdata[0]; 968 960 nprint("- Added -root value of '$hostdata[0]' from URI", "v"); 969 961 } … … 971 963 else { 972 964 my @h = split(/\:|\,/, $host); 973 974 965 $defhost = $h[0]; 975 966 $defport = $h[1]; 976 } 977 978 # Now skip through all ports if port hasn't been added 979 if ($defport eq "" && scalar(@ports) > 0) { 980 981 foreach $port (@ports) { 982 $markhash->{'ident'} = $defhost; 967 $targs{$defhost . ":" . $defport} = ($root ne "") ? $root : '/'; 968 } 969 } 970 971 foreach my $host (keys %targs) { 972 my ($h, $p) = split(/:/, $host); 973 if ($p eq '') { 974 foreach my $port (@ports) { 975 my $markhash = {}; 976 if ($root ne '') { $markhash->{'root'} = $root; nprint("- Added -root value of '$root' from CLI", "v"); } 977 978 $markhash->{'ident'} = $h; 983 979 $markhash->{'port'} = $port; 980 if ($targs{$host} ne '/') { $markhash->{'root'} = $targs{$host}; } 984 981 nprint("- Target:$markhash->{'ident'} port:$markhash->{'port'}", "v", $markhash); 985 982 push(@marks, $markhash); 986 } 987 } 988 else { 989 if ($defport eq "") { 990 $defport = $defaultport; 991 } 992 $markhash->{'ident'} = $defhost; 993 $markhash->{'port'} = $defport; 994 995 nprint("- Target:$markhash->{'ident'} port:$markhash->{'port'}", "v", $markhash); 996 push(@marks, $markhash); 997 } 998 } 983 } 984 } 985 else { 986 my $markhash = {}; 987 if ($targs{$host} ne '/') { $markhash->{'root'} = $targs{$host}; } 988 989 $markhash->{'ident'} = $h; 990 $markhash->{'port'} = $p; 991 push(@marks, $markhash); 992 } 993 } 999 994 1000 995 return @marks; … … 2062 2057 sub nfetch { 2063 2058 my ($mark, $uri, $method, $data, $headers, $flags, $testid) = @_; 2064 sleeper();2065 2059 my (%request, %result); 2066 2060 setup_hash(\%request, $mark, $testid); … … 2109 2103 2110 2104 if (!$incache) { 2105 sleeper(); 2111 2106 LW2::http_do_request_timeout(\%request, \%result); 2112 2107 $COUNTERS{'totalrequests'}++; … … 2114 2109 # If we got an error, do 1 retry. This should be much more intelligent and configurable! 2115 2110 if (defined $result{'whisker'}->{'error'} || $result{'whisker'}{'code'} eq '') { 2111 sleeper(); 2116 2112 LW2::http_do_request_timeout(\%request, \%result); 2117 2113 $COUNTERS{'totalrequests'}++;
Note: See TracChangeset
for help on using the changeset viewer.