-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
/
wireshark.rb
113 lines (101 loc) 路 4.11 KB
/
wireshark.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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.2.5.tar.xz"
mirror "https://1.eu.dl.wireshark.org/src/all-versions/wireshark-4.2.5.tar.xz"
sha256 "55e793ab87a9a73aac44336235c92cb76c52180c469b362ed3a54f26fbb1261f"
license "GPL-2.0-or-later"
head "https://gitlab.com/wireshark/wireshark.git", branch: "master"
# Upstream indicates stable releases with an even-numbered minor (see:
# https://wiki.wireshark.org/Development/ReleaseNumbers).
livecheck do
url "https://www.wireshark.org/download.html"
regex(/href=.*?wireshark[._-]v?(\d+\.\d*[02468](?:\.\d+)*)\.t/i)
end
bottle do
sha256 arm64_sonoma: "a2e887e1f5cd2960e09a69030e17218dab7d1e19d07af9a51418250360ea539e"
sha256 arm64_ventura: "e9bb83e2257dae76f06860dcef7888c016b5d5cab7d10f4742d642f3d17d910e"
sha256 arm64_monterey: "fd80dce887c48e0f9fc7c8d46a2cdf73acbb08fae051b59e3448d1aeeb089dc9"
sha256 sonoma: "cdf2576b63904b56bbcb563b681455e6f0c247afd3011b56e1f0552937c5619b"
sha256 ventura: "818d6c30beb6417cf7351c063a6c7a5075bb3bb966b7fccbebef7348b9d23dec"
sha256 monterey: "fe9a0a90e5869f1de3d5318c3dc3d0e63fbd45d32342f4144e2b7df887b9c73b"
sha256 cellar: :any_skip_relocation, x86_64_linux: "a210fe04bddf4769e4aa4b0d95924757dcdeef0bbd36a9e438a0a9226eeee0e9"
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"
depends_on "pcre2"
depends_on "speexdsp"
uses_from_macos "bison" => :build
uses_from_macos "flex" => :build
uses_from_macos "python" => :build
uses_from_macos "krb5"
uses_from_macos "libpcap"
uses_from_macos "libxml2"
uses_from_macos "zlib"
on_macos do
depends_on "libgpg-error"
end
def install
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", "-S", ".", "-B", "build", *args, *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
system "cmake", "--install", "build", "--component", "Development"
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
(testpath/"test.cpp").write <<~EOS
#include <stdio.h>
#include <ws_version.h>
int main() {
printf("%d.%d.%d", WIRESHARK_VERSION_MAJOR, WIRESHARK_VERSION_MINOR,
WIRESHARK_VERSION_MICRO);
return 0;
}
EOS
system ENV.cxx, "-std=c++11", "test.cpp", "-I#{include}/wireshark", "-o", "test"
output = shell_output("./test")
assert_equal version.to_s, output
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