Skip to content

Commit

Permalink
Add workflow step to test if plugins are loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
oshaked1 committed Jul 10, 2024
1 parent a162db7 commit 5aff383
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 18 deletions.
25 changes: 25 additions & 0 deletions .github/load_plugins.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python3

import os
import subprocess

if os.name == 'nt':
tshark = os.path.join(os.getenv("ProgramFiles"), "Wireshark", "tshark.exe")
else:
tshark = "tshark"

proc = subprocess.Popen([tshark, "-G", "plugins"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = proc.communicate()
if proc.returncode != 0:
print(f'tshark exited with return code {proc.returncode}, stderr:')
print(err.decode())
exit(1)

out = out.decode()
if 'tracee-event' in out and 'tracee-network-capture' in out and 'tracee-json' in out:
print('Plugins loaded successfully')
exit(0)
else:
print("Plugins not loaded. tshark output:")
print(out)
exit(1)
45 changes: 44 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ jobs:

- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: choco install -y winflexbison3
run: |
choco install -y winflexbison3
Install-Module -Name VcRedist -Force
New-Item -Path C:\Temp\VcRedist -ItemType Directory
$VcList = Get-VcList -Release "2012"
Save-VcRedist -VcList $VcList -Path C:\Temp\VcRedist
Install-VcRedist -Path C:\Temp\VcRedist -VcList $VcList -Silent
shell: pwsh

- name: Install Qt (Windows)
if: matrix.os == 'windows-latest'
Expand Down Expand Up @@ -84,3 +91,39 @@ jobs:
call scripts\make_cmake.bat
call scripts\make.bat
shell: cmd

- name: Load Plugins Test (Unix, Wireshark > 3.6.2)
if: (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-14' || matrix.os == 'macos-13') && matrix.wireshark_version != 'wireshark-3.6.2'
run: |
sudo ninja -C wireshark/build install
sudo find /usr/local/lib/wireshark/plugins -type f -name "tracee-event" -execdir mv {} tracee-event.so \;
sudo find /usr/local/lib/wireshark/plugins -type f -name "tracee-network-capture" -execdir mv {} tracee-network-capture.so \;
sudo find /usr/local/lib/wireshark/plugins -type f -name "tracee-json" -execdir mv {} tracee-json.so \;
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
.github/load_plugins.py
- name: Load Plugins Test (Ubuntu, Wireshark 3.6.2)
if: matrix.os == 'ubuntu-latest' && matrix.wireshark_version == 'wireshark-3.6.2'
run: |
sudo ninja -C wireshark/build install
sudo cp /epan/tracee-event /usr/local/lib/wireshark/plugins/3.6/epan/tracee-event.so
sudo cp /epan/tracee-network-capture /usr/local/lib/wireshark/plugins/3.6/epan/tracee-network-capture.so
sudo cp /wiretap/tracee-json /usr/local/lib/wireshark/plugins/3.6/wiretap/tracee-json.so
.github/load_plugins.py
- name: Load Plugins Test (Windows)
if: matrix.os == 'windows-latest'
run: |
pushd build
msbuild /m /p:Configuration=RelWithDebInfo install.vcxproj
popd
del /Q "C:\Program Files\Wireshark\plugins\4.2\epan\tracee-event"
del /Q "C:\Program Files\Wireshark\plugins\4.2\epan\tracee-network-capture"
del /Q "C:\Program Files\Wireshark\plugins\4.2\wiretap\tracee-json"
del /Q "C:\Program Files\Wireshark\plugins\4.2\epan\tracee-event.dll"
del /Q "C:\Program Files\Wireshark\plugins\4.2\epan\tracee-network-capture.dll"
del /Q "C:\Program Files\Wireshark\plugins\4.2\wiretap\tracee-json.dll"
dir "C:\Program Files\Wireshark\plugins\4.2\epan"
dir "C:\Program Files\Wireshark\plugins\4.2\wiretap"
"C:\Program Files\Wireshark\tshark.exe" -v
shell: cmd
37 changes: 36 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,14 @@ jobs:

- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: choco install -y winflexbison3
run: |
choco install -y winflexbison3
Install-Module -Name VcRedist -Force
New-Item -Path C:\Temp\VcRedist -ItemType Directory
$VcList = Get-VcList -Release "2012"
Save-VcRedist -VcList $VcList -Path C:\Temp\VcRedist
Install-VcRedist -Path C:\Temp\VcRedist -VcList $VcList -Silent
shell: pwsh

- name: Install Qt (Windows)
if: matrix.os == 'windows-latest'
Expand Down Expand Up @@ -108,6 +115,34 @@ jobs:
call scripts\make.bat
shell: cmd

- name: Load Plugins Test (Unix, Wireshark > 3.6.2)
if: (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-14' || matrix.os == 'macos-13') && matrix.wireshark_version != 'wireshark-3.6.2'
run: |
sudo ninja -C wireshark/build install
sudo find /usr/local/lib/wireshark/plugins -type f -name "tracee-event" -execdir mv {} tracee-event.so \;
sudo find /usr/local/lib/wireshark/plugins -type f -name "tracee-network-capture" -execdir mv {} tracee-network-capture.so \;
sudo find /usr/local/lib/wireshark/plugins -type f -name "tracee-json" -execdir mv {} tracee-json.so \;
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
.github/load_plugins.py
- name: Load Plugins Test (Ubuntu, Wireshark 3.6.2)
if: matrix.os == 'ubuntu-latest' && matrix.wireshark_version == 'wireshark-3.6.2'
run: |
sudo ninja -C wireshark/build install
sudo cp /epan/tracee-event /usr/local/lib/wireshark/plugins/3.6/epan/tracee-event.so
sudo cp /epan/tracee-network-capture /usr/local/lib/wireshark/plugins/3.6/epan/tracee-network-capture.so
sudo cp /wiretap/tracee-json /usr/local/lib/wireshark/plugins/3.6/wiretap/tracee-json.so
.github/load_plugins.py
- name: Load Plugins Test (Windows)
if: matrix.os == 'windows-latest'
run: |
pushd build
msbuild /m /p:Configuration=RelWithDebInfo install.vcxproj
popd
python .github/load_plugins.py
shell: cmd

- name: Create distribution archive (Unix)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-14' || matrix.os == 'macos-13'
run: |
Expand Down
21 changes: 5 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,28 +134,17 @@ dist: all
@mkdir dist/workdir
@cp dist/install.sh dist/workdir

@if [ -e "wireshark/build/run/tracee-event" ]; then \
@if [ "$(OS_NAME)" = "Darwin" ]; then \
cp wireshark/build/run/tracee-event dist/workdir/tracee-event.so; \
else \
cp wireshark/build/run/tracee-event.so* dist/workdir; \
fi

@if [ -e "wireshark/build/run/tracee-network-capture" ]; then \
cp wireshark/build/run/tracee-network-capture dist/workdir/tracee-network-capture.so; \
else \
cp wireshark/build/run/tracee-network-capture.so* dist/workdir; \
fi

@if [ -e "wireshark/build/run/tracee-json" ]; then \
cp wireshark/build/run/tracee-json dist/workdir/tracee-json.so; \
else \
cp wireshark/build/run/tracee-json.so* dist/workdir; \
fi

@if [ "$(OS_NAME)" = "Darwin" ]; then \
scripts/macos_rpathify.sh dist/workdir/tracee-json.so; \
scripts/macos_rpathify.sh dist/workdir/tracee-event.so; \
scripts/macos_rpathify.sh dist/workdir/tracee-network-capture.so; \
else \
cp wireshark/build/run/tracee-event.so* dist/workdir; \
cp wireshark/build/run/tracee-network-capture.so* dist/workdir; \
cp wireshark/build/run/tracee-json.so* dist/workdir; \
fi

@cp -r profiles dist/workdir
Expand Down

0 comments on commit 5aff383

Please sign in to comment.