Skip to content

Commit 3299190

Browse files
committed
Add support for AppNeta protocols
1 parent 4aa76c9 commit 3299190

File tree

5 files changed

+2075
-3
lines changed

5 files changed

+2075
-3
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ endif()
5252
set(PROJECT_MAJOR_VERSION 4)
5353
set(PROJECT_MINOR_VERSION 6)
5454
set(PROJECT_PATCH_VERSION 2)
55-
set(PROJECT_BUILD_VERSION 0)
56-
set(PROJECT_VERSION_EXTENSION "")
55+
set(PROJECT_BUILD_VERSION ${GIT_REVISION})
56+
set(PROJECT_VERSION_EXTENSION ".appneta.65")
5757

5858
if(DEFINED ENV{WIRESHARK_VERSION_EXTRA})
5959
set(PROJECT_VERSION_EXTENSION "$ENV{WIRESHARK_VERSION_EXTRA}")

README.appneta.md

Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
MacOS
2+
=====
3+
4+
References
5+
----------
6+
7+
* Code Signing:
8+
* <https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html>
9+
* <https://developer.apple.com/library/archive/technotes/tn2206/_index.html>
10+
11+
* Notarizing
12+
* <https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution>
13+
14+
Prerequisites
15+
-------------
16+
17+
```shell
18+
pip3 install dmgbuild
19+
```
20+
21+
Build
22+
-----
23+
24+
* Run one time only, or if moving to a new Wireshark revision
25+
26+
```shell
27+
tools/macos-setup-brew.sh --install-optional
28+
./tools/macos-setup-brew.sh --install-required --install-optional --install-doc-deps --install-dmg-deps \
29+
--install-test-deps
30+
```
31+
32+
* Here are some exports you should execute before build
33+
34+
```shell
35+
export PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig
36+
export CMAKE_PREFIX_PATH=/opt/homebrew/opt/qt@6
37+
export PATH=/usr/local/opt/qt@6/bin:$PATH
38+
```
39+
40+
* Build
41+
42+
```shell
43+
mkdir build; cd build
44+
cmake -GNinja -DBUILD_stratoshark=OFF -DBUILD_falcodump=ON -DBUILD_androiddump=OFF -DBUILD_ciscodump=OFF \
45+
-DBUILD_mmdbresolve=OFF -DBUILD_randpkt=OFF -DBUILD_randpktdump=OFF -DBUILD_sharkd=OFF \
46+
-DBUILD_sshdump=OFF -DBUILD_tshark=OFF -DBUILD_wifidump=OFF -DBUILD_wireshark=ON ..
47+
cmake --build .
48+
```
49+
50+
* Build an app bundle (Wireshark.app)
51+
52+
```shell
53+
cmake --build . --target wireshark_app_bundle
54+
```
55+
56+
* Choose a code signing certificate
57+
* in this example I want to use certificate #3 which was most recently created in XCode Preferences
58+
59+
```shell
60+
❯ security find-identity -p codesigning -v login.keychain
61+
1) 02BD99C3D9CE9E301DF3D9D2E1C6148DFE95AC79 "Apple Development: fred.klassen@broadcom.com (PZ339J2MU7)"
62+
2) 0E3D74157F689870D378A291EBC3B1C927BA28D2 "Mac Developer: Fred Klassen (VRZWY3PKS3)"
63+
3) CE26B0A97A4D50197168F844813C929EEB3904F0 "Apple Development: Fred Klassen (VRZWY3PKS3)"
64+
3 valid identities found
65+
```
66+
67+
* for clarity I use `"Apple Development: Fred Klassen (VRZWY3PKS3)"` but could also select `CE26B0A97A4D50197168F844813C929EEB3904F0` to resolve duplicates
68+
69+
* Sign the app bundle and verify that there are no errors
70+
71+
```shell
72+
~/git/wireshark/build
73+
❯ codesign --sign "Apple Development: Fred Klassen (VRZWY3PKS3)" --prefix "org.broadcom.appneta" \
74+
--entitlements ../packaging/macosx/entitlements.plist --timestamp --verbose --deep -f run/Wireshark.app
75+
run/Wireshark.app: replacing existing signature
76+
run/Wireshark.app: signed app bundle with Mach-O thin (arm64) [org.wireshark.Wireshark]
77+
~/git/wireshark/build
78+
❯ codesign --verify --deep --strict --verbose=2 run/Wireshark.app
79+
...
80+
```
81+
82+
* Test and note any error messages regarding missing libraries
83+
84+
```shell
85+
run/Wireshark.app/Contents/MacOS/Wireshark --help
86+
run/Wireshark.app/Contents/MacOS/Wireshark
87+
```
88+
89+
* if a library is missing (e.g. QtDBus.framework), copy it (must use `ditto` not `cp -r`)
90+
91+
```shell
92+
pushd run/Wireshark.app/Contests/Frameworks
93+
ditto /opt/homebrew/Cellar/qt/6.6.0/lib/QtDBus.framework QtDBus.framework
94+
codesign --sign "Apple Development: Fred Klassen (VRZWY3PKS3)" --prefix "org.broadcom.appneta" \
95+
--entitlements ../packaging/macosx/entitlements.plist --timestamp --verbose -f --deep QtDBus.framework
96+
popd
97+
```
98+
99+
* if libraries are still missing, it may be easier to install upstream official build and copy those libraries as they have updated @rpath
100+
101+
```shell
102+
pushd run/Wireshark.app/Contests/Frameworks
103+
ditto /Applications/Wireshark_orig.app/Contents/Frameworks/libdbus.1.3.dylib .
104+
codesign --sign "Apple Development: Fred Klassen (VRZWY3PKS3)" --prefix "org.broadcom.appneta" \
105+
--entitlements ../packaging/macosx/entitlements.plist --timestamp --verbose -f libdbus.1.3.dylib
106+
popd
107+
```
108+
109+
* Make a backup copy of `run/Wireshark.app` as the next command will break it
110+
111+
```shell
112+
mkdir -p ~/data
113+
ditto run/Wireshark.app ~/data/Wireshark.app
114+
```
115+
116+
* Make the install `.dmg` file
117+
118+
```shell
119+
cmake --build . --target wireshark_dmg
120+
```
121+
122+
* Replace a broken `Wireshark.app` in the dmg bundle with the working one
123+
124+
```shell
125+
pushd run
126+
hdiutil convert Wireshark\ 4.6.2.appneta.65\ Arm\ 64.dmg -format UDRW -o Wireshark\ 4.6.2.appneta.65\ Arm\ 64-rw.dmg
127+
hdiutil resize -size 500M Wireshark\ 4.6.2.appneta.65\ Arm\ 64-rw.dmg
128+
hdiutil attach Wireshark\ 4.6.2.appneta.65\ Arm\ 64-rw.dmg
129+
rm -rf /Volumes/Wireshark\ 4.6.2.appneta.65/Wireshark.app
130+
ditto ~/data/Wireshark.app /Volumes/Wireshark\ 4.6.2.appneta.65/Wireshark.app
131+
```
132+
133+
* At this point you will use Finder to unmount the `.dmg` bundle
134+
* Now convert R/W bundle to R/O
135+
136+
```shell
137+
hdiutil convert Wireshark\ 4.6.2.appneta.65\ Arm\ 64-rw.dmg -format UDRO -o ~/data/Wireshark\ 4.6.2.appneta.65\ Arm\ 64.dmg
138+
popd
139+
```
140+
141+
* Code sign the new bundle
142+
143+
```shell
144+
codesign --sign "Apple Development: Fred Klassen (VRZWY3PKS3)" --prefix "org.broadcom.appneta" \
145+
--entitlements ../packaging/macosx/entitlements.plist --timestamp --verbose -f ~/data/Wireshark\ 4.6.2.appneta.65\ Arm\ 64.dmg
146+
```
147+
148+
* Test the new installer program
149+
* At this point the `dmg` should be installable by any developer who has installed their `Apple Development` certificate,
150+
and is running the same OS version or newer
151+
* To enable others to install the `dmg` you will need to Notarize (if you have rights to do so)
152+
153+
Notarize - optional (only supported on TC build machines)
154+
---------------------------------------------------------
155+
156+
At this point you may want to notarize the app_bundle - you will require an
157+
application-specific password - <https://support.apple.com/en-us/HT204397>
158+
159+
```shell
160+
cd run
161+
ditto -ck --keepParent Wireshark.app Wireshark.zip
162+
xcrun altool --notarize-app --primary-bundle-id "com.appneta.wireshark.app" --username <apple id> --password <app-specific password> --file Wireshark.zip
163+
```
164+
165+
Wait up to 5 minutes for success - check using this command
166+
167+
```shell
168+
xcrun altool --notarize-history 0 --username <apple id> --password <app-specific password>
169+
```
170+
171+
Staple the notarization result so app can be verified as notarized when offline
172+
173+
```shell
174+
xcrun stapler staple Wireshark.app
175+
cd ..
176+
```
177+
178+
macOS Notarize Package
179+
----------------------
180+
181+
* this probably will break `Wireshark.app` but it is here for reference
182+
183+
```shell
184+
cd run
185+
../packaging/macosx/osx-dmg.sh
186+
xcrun altool --notarize-app --primary-bundle-id "com.appneta.wireshark.dmg" --username <apple id> --password <app-specific password> --file Wireshark\ <version>\ Intel\ 64.dmg
187+
xcrun altool --notarize-history 0 --username <apple id> --password <app-specific password>
188+
xcrun stapler staple Wireshark\ <version>\ Intel\ 64.dmg
189+
cd ..
190+
```
191+
192+
Linux
193+
=====
194+
195+
To build Linux debug
196+
---------------------
197+
198+
```shell
199+
mkdir -p build-debug
200+
cd build-debug
201+
cmake -DCMAKE_BUILD_TYPE=Debug ..
202+
make -j6
203+
```
204+
205+
Make Linux Package
206+
------------------
207+
208+
Install prerequisites
209+
210+
$ sudo tools/debian-setup.sh --install-all
211+
212+
Build packages (from wireshark directory)
213+
214+
$ dpkg-buildpackage -b -us -uc -jauto
215+
$ mkdir -p ~/data/wireshark_4.4.5.appneta.61_repo
216+
$ mv ../wireshark_4.4.5* ~/data/wireshark-4.4.5-appneta.61_repo
217+
218+
Once packages are made, do something like:
219+
220+
cd ~/data/wireshark-4.4.5-appneta.61_repo
221+
dpkg-scanpackages . | xz -c > Packages.xz
222+
223+
Optionally you can move directory and install packages locally
224+
... in /etc/apt/sources.list.d/wireshark.list ... (not working for Debian bookworm)
225+
226+
deb [trusted=yes] file:/home/fklassen/data/wireshark-4.4.5-appneta-61-repo ./
227+
$ sudo apt update
228+
$ sudo apt install wireshark
229+
230+
To manually install, remove any old versions of wireshark and run something like this:
231+
232+
sudo dpkg -i libwireshark18_4.4.5.appneta.61_arm64.deb libwireshark-data_4.4.5.appneta.61_all.deb libwiretap15_4.4.5.appneta.61_arm64.deb libwsutil16_4.4.5.appneta.61_arm64.deb tshark_4.4.5.appneta.61_arm64.deb wireshark_4.4.5.appneta.61_arm64.deb wireshark-common_4.4.5.appneta.61_arm64.deb wireshark-dev_4.4.5.appneta.61_arm64.deb wireshark-doc_4.4.5.appneta.61_all.deb
233+
234+
Windows
235+
=======
236+
237+
* Set up as per [install guide](https://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWin32.html).
238+
No need to install Git, CMake, Python or Perl on Windows Dev machine. Install Qt5 not Qt6.
239+
240+
* I had to open a regular Command Prompt and run
241+
`"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"`
242+
rather than open a "x64 Native Tools Command Prompt for VS 2019".
243+
244+
* Set the following environmental variables e.g.
245+
246+
```
247+
set WIRESHARK_BASE_DIR=C:\Users\fklassen\git
248+
set WIRESHARK_VERSION_EXTRA=-appneta.60
249+
set WIRESHARK_QT6_PREFIX_PATH=C:\Qt\6.8.0\msvc2022_64
250+
```
251+
252+
* Create a build directory and change into it e.g
253+
254+
> mkdir ..\wsbuild64
255+
> cd ..\wsbuild64
256+
257+
* Generate build files
258+
259+
> "C:\Program Files\CMake\bin\cmake" -G "Visual Studio 16 2019" -A x64 ..\wireshark
260+
261+
* Make
262+
263+
> msbuild /m /p:Configuration=RelWithDebInfo Wireshark.sln
264+

epan/dissectors/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,7 @@ set(DISSECTOR_SRC
762762
${CMAKE_CURRENT_SOURCE_DIR}/packet-ap1394.c
763763
${CMAKE_CURRENT_SOURCE_DIR}/packet-app-pkix-cert.c
764764
${CMAKE_CURRENT_SOURCE_DIR}/packet-applemidi.c
765+
${CMAKE_CURRENT_SOURCE_DIR}/packet-appneta.c
765766
${CMAKE_CURRENT_SOURCE_DIR}/packet-aprs.c
766767
${CMAKE_CURRENT_SOURCE_DIR}/packet-arcnet.c
767768
${CMAKE_CURRENT_SOURCE_DIR}/packet-arinc615a.c

0 commit comments

Comments
 (0)