Skip to content

Instantly share code, notes, and snippets.

@Congee
Last active August 29, 2015 13:57
Show Gist options
  • Save Congee/9524497 to your computer and use it in GitHub Desktop.
Save Congee/9524497 to your computer and use it in GitHub Desktop.
nikto 2.1.5 for Mac OS X via Homebrew
require 'formula'
class Nikto < Formula
homepage 'http://cirt.net/nikto2'
url 'https://github.com/sullo/nikto.git', :revision => '8bb017d76e592793da3c06cdbb8d31bfdffdf2eb'
version '2.1.5'
# version 2.1.6 is still under developing
def install
# adjust default paths in perl script
inreplace 'program/nikto.pl' do |s|
s.gsub! '/etc/nikto.conf', "#{etc}/nikto.conf"
s.gsub! "2.1.6", "2.1.5"
end
# adjust default paths in configuration file
inreplace 'program/nikto.conf' do |s|
# s.gsub! '# EXECDIR=/usr/local/nikto', "EXECDIR=#{prefix}"
s.gsub! '# EXECDIR=/opt/nikto', "EXECDIR=#{prefix}"
s.gsub! '# PLUGINDIR=/opt/nikto/plugins', "# PLUGINDIR=#{prefix}/plugins"
s.gsub! '# TEMPLATEDIR=/opt/nikto/templates', "# TEMPLATEDIR=#{prefix}/templates"
s.gsub! '# DOCDIR=/opt/nikto/docs', "# DOCDIR=#{prefix}/docs"
end
bin.install 'program/nikto.pl' # install main perl script
bin.install_symlink bin + 'nikto.pl' => 'nikto' # symlink w/o extension
etc.install 'program/nikto.conf' # install conf file
man1.install 'documentation/nikto.1' # install man page
(prefix + 'docs').install Dir['documentation/*'] # miscellaneous
prefix.install 'program/databases', 'program/plugins', 'program/templates' # install databases, plugins, templates
# update LibWhisker
ohai 'Updating LibWhisker', `#{bin}/nikto -update`
end
def caveats; <<-EOS.undent
File locations:
Perl script: #{HOMEBREW_PREFIX}/bin/nikto
Configuration: #{etc}/nikto.conf
Docs: #{prefix}/docs
Plugins: #{prefix}/plugins
Templates: #{prefix}/templates
Type `man nikto` or `nikto -H` for help and usage information.
EOS
end
# run the test with `brew test nikto`
def test
system "test -h #{bin}/nikto" # symlink?
system "test -x #{bin}/nikto.pl" # execute permission?
system "test -f #{etc}/nikto.conf" # file?
system "test -f #{man1}/nikto.1" # file?
system "test -d #{prefix}/docs" # directory?
system "test -d #{prefix}/plugins" # directory?
system "test -d #{prefix}/templates" # directory?
end
end
@Congee
Copy link
Author

Congee commented Mar 13, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment