Changeset 738


Ignore:
Timestamp:
04/06/2012 04:15:21 AM (14 months ago)
Author:
sullo
Message:

Ticket 214: relocate dbs to 'databases' directory

Location:
trunk
Files:
15 added
14 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/CHANGES.txt

    r735 r738  
    88        - Ticket 220: Certificate wildcard matching incorrect 
    99        - Ticket 217: Add -IgnoreCode option to allow db_404_strings' @CODE at the command line 
     10        - Ticket 214: Relocate databases to 'databases/' directory from 'plugins/' 
    1011        - Ticket 211: Shuffled some information in HTML report and added more summary data. Added error count and total check count to XML (note: DTD change). 
    1112        - Ticket 202: -maxtime maximum execution time per host (seconds) 
  • trunk/nikto.conf

    r649 r738  
    2222# IDs never to alert on (Note: this only works for IDs loaded from db_tests) 
    2323#SKIPIDS= 
    24  
    25 # if Nikto is having difficulty finding the 'plugins', set the full install path here 
    26 # EXECDIR=/usr/local/nikto 
    2724 
    2825# The DTD 
     
    6562 
    6663# If you want to specify the location of any of the files, specify them here 
    67 # EXECDIR=/opt/nikto 
    68 # PLUGINDIR=/opt/nikto/plugins 
    69 # TEMPLATEDIR=/opt/nikto/templates 
    70 # DOCDIR=/opt/nikto/docs 
     64# EXECDIR=/opt/nikto                            # Location of Nikto 
     65# PLUGINDIR=/opt/nikto/plugins                  # Location of plugin dir 
     66# DBDIR=/opt/nikto/databases                    # Location of plugin dir 
     67# TEMPLATEDIR=/opt/nikto/templates              # Location of tempmlate dir 
     68# DOCDIR=/opt/nikto/docs                        # Location of docs dir 
    7169 
    7270# Default plugin macros 
  • trunk/nikto.pl

    r713 r738  
    332332        $CONFIGFILE{'DOCUMENTDIR'} = "$CONFIGFILE{'EXECDIR'}/docs"; 
    333333    } 
     334    unless (defined $CONFIGFILE{'DBDIR'}) { 
     335        $CONFIGFILE{'DBDIR'} = "$CONFIGFILE{'EXECDIR'}/databases"; 
     336    } 
    334337    return; 
    335338} 
  • trunk/plugins/nikto_core.plugin

    r736 r738  
    757757 
    758758    # get core version 
    759     open(FI, "<$CONFIGFILE{PLUGINDIR}/nikto_core.plugin"); 
     759    open(FI, "<$CONFIGFILE{'PLUGINDIR'}/nikto_core.plugin"); 
    760760    my @F = <FI>; 
    761761    close(FI); 
     
    11881188    # verify required files 
    11891189    for my $file (@dbs) { 
    1190         if (!-r "$CONFIGFILE{PLUGINDIR}/$file") { 
    1191             die nprint("+ ERROR: Can't find/read required file \"$CONFIGFILE{PLUGINDIR}/$file\""); 
     1190        if (!-r "$CONFIGFILE{'DBDIR'}/$file") { 
     1191            die nprint("+ ERROR: Can't find/read required file \"$CONFIGFILE{'DBDIR'}/$file\""); 
    11921192        } 
    11931193    } 
    11941194 
    11951195    for my $file (@dbs) { 
    1196         my $filename = $CONFIGFILE{PLUGINDIR} . "/" . $prefix . $file; 
     1196        my $filename = $CONFIGFILE{DBDIR} . "/" . $prefix . $file; 
    11971197        if (!-r $filename) { next; } 
    11981198        open(IN, "<$filename") || die nprint("+ ERROR: Can't open \"$filename\":$!\n"); 
     
    12801280 
    12811281    for my $file (@dbs) { 
    1282         my $filename = $CONFIGFILE{PLUGINDIR} . "/" . $prefix . $file; 
     1282        my $filename = $CONFIGFILE{DBDIR} . "/" . $prefix . $file; 
    12831283        if (!-r $filename) { 
    12841284            nprint("+ ERROR: Unable to read \"$filename\""); 
     
    15321532############################################################################### 
    15331533sub load_plugins { 
    1534     my @pluginlist = dirlist("$CONFIGFILE{PLUGINDIR}", '\.plugin$'); 
     1534    my @pluginlist = dirlist("$CONFIGFILE{'PLUGINDIR'}", '\.plugin$'); 
    15351535    my @all_names; 
    15361536 
     
    15471547        $plugin_name =~ s/\.plugin$//; 
    15481548        my $plugin_init = $plugin_name . "_init"; 
    1549         eval { require "$CONFIGFILE{PLUGINDIR}/$plugin"; }; 
     1549        eval { require "$CONFIGFILE{'PLUGINDIR'}/$plugin"; }; 
    15501550        if ($@) { 
    15511551            nprint("- Could not load or parse plugin: $plugin_name\n Error: "); 
     
    18561856 
    18571857    # get local versions of plugins/dbs 
    1858     my @NIKTOFILES = dirlist($CONFIGFILE{PLUGINDIR}, ""); 
    1859  
    1860     foreach my $file (@NIKTOFILES) { 
     1858    my %NIKTOFILES; 
     1859    my @F = dirlist($CONFIGFILE{'PLUGINDIR'}, ""); 
     1860    foreach my $f (@F) { $NIKTOFILES{$f}=$CONFIGFILE{'PLUGINDIR'} . "/" . $f; } 
     1861    @F = dirlist($CONFIGFILE{'DBDIR'}, ""); 
     1862    foreach my $f (@F) { $NIKTOFILES{$f}=$CONFIGFILE{'DBDIR'} . "/" . $f; } 
     1863 
     1864    foreach my $file (keys %NIKTOFILES) { 
    18611865        my $v = ""; 
    1862         open(LOCAL, "<$CONFIGFILE{PLUGINDIR}/$file") 
    1863           || print STDERR "+ ERROR: Unable to open '$CONFIGFILE{PLUGINDIR}/$file' for read: $@\n"; 
     1866        open(LOCAL, "<$NIKTOFILES{$file}") 
     1867          || print STDERR "+ ERROR: Unable to open '$NIKTOFILES{$file}' for read: $@\n"; 
    18641868        my @l = <LOCAL>; 
    18651869        close(LOCAL); 
     
    19031907        } 
    19041908        if ($CONTENT ne "") { 
    1905             open(OUT, ">$CONFIGFILE{PLUGINDIR}/$toget") 
     1909            my $dir=''; 
     1910            if ($toget =~ /^db_/) { $dir=$CONFIGFILE{'DBDIR'}; } 
     1911            else { $dir=$CONFIGFILE{'PLUGINDIR'}; } 
     1912            open(OUT, ">$dir/$toget") 
    19061913              || die print STDERR 
    1907               "+ ERROR: Unable to open '$CONFIGFILE{PLUGINDIR}/$toget' for write: $@\n"; 
     1914              "+ ERROR: Unable to open '$dir/$toget' for write: $@\n"; 
    19081915            print OUT $CONTENT; 
    19091916            close(OUT); 
     
    25252532####################################################################### 
    25262533sub version { 
    2527     my @NIKTOFILES = dirlist($CONFIGFILE{PLUGINDIR}, "(^nikto|^db_)"); 
     2534    my %NIKTOFILES; 
     2535    my @F = dirlist($CONFIGFILE{'PLUGINDIR'}, ""); 
     2536    foreach my $f (@F) { $NIKTOFILES{$f}=$CONFIGFILE{'PLUGINDIR'} . "/" . $f; } 
     2537    @F = dirlist($CONFIGFILE{'DBDIR'}, ""); 
     2538    foreach my $f (@F) { $NIKTOFILES{$f}=$CONFIGFILE{'DBDIR'} . "/" . $f; } 
     2539 
    25282540    nprint($VARIABLES{'DIV'}); 
    25292541    nprint("$VARIABLES{'name'} Versions"); 
     
    25342546    nprint("LibWhisker                         $LW2::VERSION"); 
    25352547 
    2536     foreach my $FILE (sort @NIKTOFILES) { 
    2537         open(FI, "<$CONFIGFILE{PLUGINDIR}/$FILE") 
    2538           || die print STDERR "+ ERROR: Unable to open '$CONFIGFILE{PLUGINDIR}/$FILE': $!\n"; 
     2548    foreach my $FILE (sort keys %NIKTOFILES) { 
     2549        next if $FILE eq 'LW2.pm'; 
     2550        open(FI, "<$NIKTOFILES{$FILE}") 
     2551          || die print STDERR "+ ERROR: Unable to open '$NIKTOFILES{$FILE}': $!\n"; 
    25392552        my @F = <FI>; 
    25402553        close(FI); 
     
    25602573        nprint("Module RPC::XML::Client missing. Logging to Metasploit is disabled."); 
    25612574    } 
     2575    LW2::init_ssl_engine(); 
    25622576    my ($avail, $lib, $ver) = LW2::ssl_is_available(); 
    25632577    if ($avail) { 
    2564         nprint("SSL: $lib $ver"); 
     2578        nprint("SSL Module: $lib version $ver"); 
    25652579    } 
    25662580    else { 
     
    25972611 
    25982612    # make sure the db_outdatedb isn't *too* old 
    2599     open(OD, "<$CONFIGFILE{PLUGINDIR}/db_outdated") 
    2600       || die print STDERR "+ ERROR: Unable to open '$CONFIGFILE{PLUGINDIR}/db_outdated': $!\n"; 
     2613    open(OD, "<$CONFIGFILE{'DBDIR'}/db_outdated") 
     2614      || die print STDERR "+ ERROR: Unable to open '$CONFIGFILE{'DBDIR'}/db_outdated': $!\n"; 
    26012615    @F = <OD>; 
    26022616    close(OD); 
     
    28002814sub init_db { 
    28012815    my $dbname   = $_[0]; 
    2802     my $filename = "$CONFIGFILE{PLUGINDIR}/" . $dbname; 
     2816    my $filename = "$CONFIGFILE{'DBDIR'}/" . $dbname; 
    28032817    my (@dbarray, @headers); 
    28042818    my $hashref = {}; 
     
    28332847 
    28342848    # And the udb_* file 
    2835     $filename = "$CONFIGFILE{PLUGINDIR}/u" . $dbname; 
     2849    $filename = "$CONFIGFILE{'DBDIR'}/u" . $dbname; 
    28362850    if (open(IN, "<$filename")) { 
    28372851        while (<IN>) { 
Note: See TracChangeset for help on using the changeset viewer.