homebrew-core/Formula/wireshark.rb

97 lines
3.5 KiB
Ruby

class Wireshark < Formula
desc "Graphical network analyzer and capture tool"
homepage "https://www.wireshark.org"
url "https://www.wireshark.org/download/src/all-versions/wireshark-3.6.7.tar.xz"
mirror "https://1.eu.dl.wireshark.org/src/all-versions/wireshark-3.6.7.tar.xz"
sha256 "cce10a35caa2f79b73d3e6e4dc5388dd47d216114a550fdeb06ae78da0edb7c5"
license "GPL-2.0-or-later"
head "https://gitlab.com/wireshark/wireshark.git", branch: "master"
livecheck do
url "https://www.wireshark.org/download.html"
regex(/Stable Release \((\d+(?:\.\d+)*)/i)
end
bottle do
sha256 arm64_monterey: "2af55f85377ba3bf6e10dc4173cc8c55785c4f2c37c65430606692a9add0d4a6"
sha256 arm64_big_sur: "4eb76a02dbd3b155b205a8f8e16409fa83d0bb606d08d2914c81cfb769125c44"
sha256 monterey: "ced94ed71232b873f0807d994184b09764f2e51e147ffb62f4240ab128f0c3fb"
sha256 big_sur: "8718d561354155c1d49bf9c601fbb6788c461bb1fc933305e87e05d9ff2379b7"
sha256 catalina: "812521a69760692ec3142f959f8f275d8a0fc34132b8305ea30a859505e05c17"
sha256 x86_64_linux: "3bfef710231b69378c6b9f6f64e41a051a6b250560286b90c0eac53768dfe892"
end
depends_on "cmake" => :build
depends_on "c-ares"
depends_on "glib"
depends_on "gnutls"
depends_on "libgcrypt"
depends_on "libmaxminddb"
depends_on "libnghttp2"
depends_on "libsmi"
depends_on "libssh"
depends_on "lua"
uses_from_macos "bison" => :build
uses_from_macos "flex" => :build
uses_from_macos "python" => :build
def install
args = std_cmake_args + %W[
-DENABLE_CARES=ON
-DENABLE_GNUTLS=ON
-DENABLE_MAXMINDDB=ON
-DBUILD_wireshark_gtk=OFF
-DENABLE_PORTAUDIO=OFF
-DENABLE_LUA=ON
-DLUA_INCLUDE_DIR=#{Formula["lua"].opt_include}/lua
-DLUA_LIBRARY=#{Formula["lua"].opt_lib/shared_library("liblua")}
-DCARES_INCLUDE_DIR=#{Formula["c-ares"].opt_include}
-DGCRYPT_INCLUDE_DIR=#{Formula["libgcrypt"].opt_include}
-DGNUTLS_INCLUDE_DIR=#{Formula["gnutls"].opt_include}
-DMAXMINDDB_INCLUDE_DIR=#{Formula["libmaxminddb"].opt_include}
-DENABLE_SMI=ON
-DBUILD_sshdump=ON
-DBUILD_ciscodump=ON
-DENABLE_NGHTTP2=ON
-DBUILD_wireshark=OFF
-DENABLE_APPLICATION_BUNDLE=OFF
-DENABLE_QT5=OFF
-DCMAKE_INSTALL_NAME_DIR:STRING=#{lib}
]
system "cmake", *args, "."
system "make", "install"
# Install headers
(include/"wireshark").install Dir["*.h"]
(include/"wireshark/epan").install Dir["epan/*.h"]
(include/"wireshark/epan/crypt").install Dir["epan/crypt/*.h"]
(include/"wireshark/epan/dfilter").install Dir["epan/dfilter/*.h"]
(include/"wireshark/epan/dissectors").install Dir["epan/dissectors/*.h"]
(include/"wireshark/epan/ftypes").install Dir["epan/ftypes/*.h"]
(include/"wireshark/epan/wmem").install Dir["epan/wmem/*.h"]
(include/"wireshark/wiretap").install Dir["wiretap/*.h"]
(include/"wireshark/wsutil").install Dir["wsutil/*.h"]
end
def caveats
<<~EOS
This formula only installs the command-line utilities by default.
Install Wireshark.app with Homebrew Cask:
brew install --cask wireshark
If your list of available capture interfaces is empty
(default macOS behavior), install ChmodBPF:
brew install --cask wireshark-chmodbpf
EOS
end
test do
system bin/"randpkt", "-b", "100", "-c", "2", "capture.pcap"
output = shell_output("#{bin}/capinfos -Tmc capture.pcap")
assert_equal "File name,Number of packets\ncapture.pcap,2\n", output
end
end