Changeset 505


Ignore:
Timestamp:
08/11/2010 11:43:01 AM (3 years ago)
Author:
deity
Message:

Fix for broken -id parameter and clean up of unused %REALMS hash

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/nikto.pl

    r504 r505  
    4444# global var/definitions 
    4545use vars qw/$TEMPLATES %ERRSTRINGS %CLI %VARIABLES %TESTS $CONTENT/; 
    46 use vars qw/%NIKTO %REALMS %NIKTOCONFIG %request %result %COUNTERS/; 
     46use vars qw/%NIKTO %NIKTOCONFIG %request %result %COUNTERS/; 
    4747use vars qw/%db_extensions %FoF %UPDATES @DBFILE @BUILDITEMS/; 
    4848use vars qw/@RESULTS @PLUGINS @MARKS @REPORTS %CACHE %CONTENTSEARCH/; 
  • trunk/plugins/nikto_auth.plugin

    r483 r505  
    5555    $REALMS        = init_db("db_realms"); 
    5656    %REALMSMATCHED = (); 
     57         
     58    if (defined $CLI{'hostauth'}) { 
     59        my @x = split(/:/, $CLI{'hostauth'}); 
     60 
     61        my $HOSTAUTH = { 
     62            nikto_id    => "700500", 
     63            realm       => (defined $x[2]) ? $x[2] : '@ANY', 
     64            password    => $x[1], 
     65            id          => $x[0], 
     66            message     => "Credentials provided by CLI.", 
     67        }; 
     68        unshift(@{$REALMS}, $HOSTAUTH); 
     69    } 
    5770} 
    5871 
     
    152165        if ($result->{'www-authenticate'} eq '' 
    153166            && !defined $result->{'whisker'}->{'error'}) { 
    154  
    155167            my $message = 
    156168              "Default account found for '$realm' at $uridir ($request->{'whisker'}->{'uri'}) (ID '$entry->{'id'}', PW '$entry->{'password'}'). $entry->{message}"; 
  • trunk/plugins/nikto_core.plugin

    r504 r505  
    983983############################################################################### 
    984984sub load_databases { 
    985     my @dbs = qw/db_404_strings  db_outdated  db_realms  db_tests  db_variables db_content_search/; 
     985    my @dbs = qw/db_404_strings  db_outdated  db_tests  db_variables db_content_search/; 
    986986    my $prefix = $_[0] || ""; 
    987987 
     
    10471047                    $OVERS{ $T[1] }{ $T[2] } = $T[3]; 
    10481048                    $OVERS{ $T[1] }{'tid'} = $T[0]; 
    1049                 } 
    1050             } 
    1051  
    1052             # db_realms 
    1053             elsif ($file eq 'db_realms') { 
    1054                 my $db_realms_ctr = keys %REALMS; 
    1055                 foreach my $l (@file) { 
    1056                     my @t = parse_csv($l); 
    1057                     $REALMS{$db_realms_ctr}{'tid'}   = $t[0]; 
    1058                     $REALMS{$db_realms_ctr}{'realm'} = $t[1]; 
    1059                     $REALMS{$db_realms_ctr}{'id'}    = $t[2]; 
    1060                     $REALMS{$db_realms_ctr}{'pw'}    = $t[3]; 
    1061                     $REALMS{$db_realms_ctr}{'msg'}   = $t[4]; 
    1062                     $db_realms_ctr++; 
    1063                 } 
    1064  
    1065                 # Cheat and add CLI directly to REALMS 
    1066                 if (defined $CLI{'hostauth'}) { 
    1067                     my @x = split(/:/, $CLI{'hostauth'}); 
    1068  
    1069                     $REALMS{$db_realms_ctr}{'tid'}   = "700500"; 
    1070                     $REALMS{$db_realms_ctr}{'realm'} = (defined $x[2]) ? $x[2] : '@ANY'; 
    1071                     $REALMS{$db_realms_ctr}{'pw'}    = $x[1]; 
    1072                     $REALMS{$db_realms_ctr}{'id'}    = $x[0]; 
    1073                     $REALMS{$db_realms_ctr}{'msg'}   = "Credentials provided by CLI."; 
    10741049                } 
    10751050            } 
     
    11511126                if ($line !~ /^\@/)         { next; } 
    11521127                if ($line !~ /^\@.+\=.+$/i) { nprint("\t+ ERROR: Invalid syntax: $line"); } 
    1153                 $ctr++; 
    1154             } 
    1155             nprint("\t$ctr entries"); 
    1156         } 
    1157         elsif ($file eq 'db_realms') { 
    1158             my $ctr = 0; 
    1159             foreach $line (<IN>) { 
    1160                 if ((count_fields($line, 1) ne 4) && (count_fields($line) ne '')) { 
    1161                     nprint("\t+ ERROR: Invalid syntax: $line"); 
    1162                 } 
    11631128                $ctr++; 
    11641129            } 
Note: See TracChangeset for help on using the changeset viewer.