homebrew-core/Formula/wireshark.rb

99 lines
3.6 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-4.0.2.tar.xz"
mirror "https://1.eu.dl.wireshark.org/src/all-versions/wireshark-4.0.2.tar.xz"
sha256 "f35915699f2f9b28ddb211202d40ec8984e5834d3c911483144a4984ba44411d"
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_ventura: "b77227776d9c22545b9293eea171a7bcba9a8f9571b6fff318bfc314270ad88a"
sha256 arm64_monterey: "8b7bc467337aa944d70363cfdcfcb0bb8d9adb015e4635857ae7a942dd60372d"
sha256 arm64_big_sur: "ea51202bd8dff8f258e23e0da456c7caf81988c00051472bfb64b9d587a4f848"
sha256 ventura: "a667c6328fc2c3a84d259abd6a0d973f509c136872f59e438ebb9e218df774bf"
sha256 monterey: "e3d5cec2a0e7beda097a7e9bb4524f4e530f197e73bdc6fa43be130126f3f63b"
sha256 big_sur: "42800280364ae61010b17327ba6303fa1e766fb9553514819ef8cc2004ce6cd9"
sha256 x86_64_linux: "ae706550761a4977b6ecaee52523d2aac4c51ef11d2a61fd6ef5e0af79eeda69"
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
uses_from_macos "libpcap"
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