79 lines
3.5 KiB
Ruby
79 lines
3.5 KiB
Ruby
class Hydra < Formula
|
|
desc "Network logon cracker which supports many services"
|
|
homepage "https://github.com/vanhauser-thc/thc-hydra"
|
|
url "https://github.com/vanhauser-thc/thc-hydra/archive/v9.2.tar.gz"
|
|
sha256 "1a28f064763f9144f8ec574416a56ef51c0ab1ae2276e35a89ceed4f594ec5d2"
|
|
license "AGPL-3.0-only"
|
|
revision 1
|
|
head "https://github.com/vanhauser-thc/thc-hydra.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "884e41848bdb0202ba702a29259e2ad74a36f35e138fd2ed34cc86991b324041"
|
|
sha256 cellar: :any, arm64_big_sur: "3d6ffc9ab242d4cd39565466f7ed470384ae655ca91727074b5931f5d240c17b"
|
|
sha256 cellar: :any, monterey: "6bea829770ee544639bf52ebabdb6b76d2c860dbfd01cbae879f9ec34bfe0d33"
|
|
sha256 cellar: :any, big_sur: "175fb361c3f301b4a204564fb55757566c29f31be057054804e7c546cf7ea94c"
|
|
sha256 cellar: :any, catalina: "a6fb41371a0d4860f3988198203b7c10b35f0cb5f4c1aad29c7dc9993f46b4a2"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "0c32fd11cebf349d4ada5c6b551f1a24602b27eab5fc2af0afcfe6eb0e3a10ad"
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "libssh"
|
|
depends_on "mysql-client"
|
|
depends_on "openssl@1.1"
|
|
depends_on "pcre"
|
|
uses_from_macos "ncurses"
|
|
|
|
conflicts_with "ory-hydra", because: "both install `hydra` binaries"
|
|
|
|
def install
|
|
inreplace "configure" do |s|
|
|
# Link against our OpenSSL
|
|
# https://github.com/vanhauser-thc/thc-hydra/issues/80
|
|
s.gsub!(/^SSL_PATH=""$/, "SSL_PATH=#{Formula["openssl@1.1"].opt_lib}")
|
|
s.gsub!(/^SSL_IPATH=""$/, "SSL_IPATH=#{Formula["openssl@1.1"].opt_include}")
|
|
s.gsub!(/^SSLNEW=""$/, "SSLNEW=YES")
|
|
s.gsub!(/^CRYPTO_PATH=""$/, "CRYPTO_PATH=#{Formula["openssl@1.1"].opt_lib}")
|
|
s.gsub!(/^SSH_PATH=""$/, "SSH_PATH=#{Formula["libssh"].opt_lib}")
|
|
s.gsub!(/^SSH_IPATH=""$/, "SSH_IPATH=#{Formula["libssh"].opt_include}")
|
|
s.gsub!(/^MYSQL_PATH=""$/, "MYSQL_PATH=#{Formula["mysql-client"].opt_lib}")
|
|
s.gsub!(/^MYSQL_IPATH=""$/, "MYSQL_IPATH=#{Formula["mysql-client"].opt_include}/mysql")
|
|
s.gsub!(/^PCRE_PATH=""$/, "PCRE_PATH=#{Formula["pcre"].opt_lib}")
|
|
s.gsub!(/^PCRE_IPATH=""$/, "PCRE_IPATH=#{Formula["pcre"].opt_include}")
|
|
if OS.mac?
|
|
s.gsub!(/^CURSES_PATH=""$/, "CURSES_PATH=#{MacOS.sdk_path_if_needed}/usr/lib")
|
|
s.gsub!(/^CURSES_IPATH=""$/, "CURSES_IPATH=#{MacOS.sdk_path_if_needed}/usr/include")
|
|
else
|
|
s.gsub!(/^CURSES_PATH=""$/, "CURSES_PATH=#{Formula["ncurses"].opt_lib}")
|
|
s.gsub!(/^CURSES_IPATH=""$/, "CURSES_IPATH=#{Formula["ncurses"].opt_include}")
|
|
end
|
|
# Avoid opportunistic linking of everything
|
|
%w[
|
|
gtk+-2.0
|
|
libfreerdp2
|
|
libgcrypt
|
|
libidn
|
|
libmemcached
|
|
libmongoc
|
|
libpq
|
|
libsvn
|
|
].each do |lib|
|
|
s.gsub! lib, "oh_no_you_dont"
|
|
end
|
|
end
|
|
|
|
# Having our gcc in the PATH first can cause issues. Monitor this.
|
|
# https://github.com/vanhauser-thc/thc-hydra/issues/22
|
|
system "./configure", "--prefix=#{prefix}"
|
|
bin.mkpath
|
|
# remove unsupported ld flags on mac
|
|
# related to https://github.com/vanhauser-thc/thc-hydra/issues/622
|
|
inreplace "Makefile", "-Wl,--allow-multiple-definition", "" if OS.mac?
|
|
system "make", "all", "install"
|
|
share.install prefix/"man" # Put man pages in correct place
|
|
end
|
|
|
|
test do
|
|
assert_match(/ mysql .* ssh /, shell_output("#{bin}/hydra", 255))
|
|
end
|
|
end
|