homebrew-core/Formula/wpscan.rb

56 lines
1.7 KiB
Ruby

class Wpscan < Formula
desc "Black box WordPress vulnerability scanner"
homepage "https://wpscan.org"
url "https://github.com/wpscanteam/wpscan/archive/2.9.3.tar.gz"
sha256 "1bacc03857cca5a2fdcda060886bf51dbf73b129abbb7251b8eb95bc874e5376"
revision 3
head "https://github.com/wpscanteam/wpscan.git"
bottle do
sha256 "e93c2fa55c6319b06fa73187f91258d43b7f7195d263754b48f55e74a013a2e5" => :high_sierra
sha256 "675a23f1373ffa03263646f7cfc9e3d51aa2057f9c1597ce1534f8e8a3572eee" => :sierra
sha256 "469a94fdf86b201508e72fbc3900aed3c82b3891393dda1d7fa5d4e042754442" => :el_capitan
end
depends_on :ruby => "2.1.9"
def install
inreplace "lib/common/common_helper.rb" do |s|
s.gsub! "ROOT_DIR, 'cache'", "'#{var}/cache/wpscan'"
s.gsub! "ROOT_DIR, 'log.txt'", "'#{var}/log/wpscan/log.txt'"
end
system "unzip", "-o", "data.zip"
libexec.install "data", "lib", "spec", "Gemfile", "Gemfile.lock", "wpscan.rb"
ENV["GEM_HOME"] = libexec
ENV["BUNDLE_PATH"] = libexec
ENV["BUNDLE_GEMFILE"] = libexec/"Gemfile"
system "gem", "install", "bundler"
system libexec/"bin/bundle", "install", "--without", "test"
(bin/"wpscan").write <<~EOS
#!/bin/bash
GEM_HOME=#{libexec} BUNDLE_GEMFILE=#{libexec}/Gemfile \
exec #{libexec}/bin/bundle exec ruby #{libexec}/wpscan.rb "$@"
EOS
end
def post_install
(var/"log/wpscan").mkpath
# Update database
system bin/"wpscan", "--update"
end
def caveats; <<~EOS
Logs are saved to #{var}/cache/wpscan/log.txt by default.
EOS
end
test do
assert_match "URL: https://wordpress.org/",
pipe_output("#{bin}/wpscan --url https://wordpress.org/")
end
end