-
Notifications
You must be signed in to change notification settings - Fork 0
420 lines (393 loc) · 14.7 KB
/
CI.yml
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
# This file is part of Aeronautical Wireshark Plugin.
#
# Copyright (C) 2023 Airbus CyberSecurity SAS
#
# Aeronautical Wireshark Plugin is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# Aeronautical Wireshark Plugin is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Aeronautical Wireshark Plugin. If not, see <https://www.gnu.org/licenses/>.
name: CI
on:
push:
jobs:
# LuaBitOp DLL Compilation
luabitop_windows_build:
runs-on: windows-latest
env:
# Variables to update in case of new versions
LUABITOP_VERSION: "1.0.2"
WIRESHARK_VERSION: "4.2.4"
LUA_VERSION: "5.2.4"
steps:
# Get all sources
- name: Get LuaBitOp
run: Invoke-WebRequest -Uri http://bitop.luajit.org/download/LuaBitOp-${env:LUABITOP_VERSION}.zip -OutFile dll.zip
- name: Get Wireshark
run: Invoke-WebRequest -Uri https://2.na.dl.wireshark.org/win64/Wireshark-${env:WIRESHARK_VERSION}-x64.exe -OutFile wireshark.exe
- name: Get Lua
run: Invoke-WebRequest -Uri https://www.lua.org/ftp/lua-${env:LUA_VERSION}.tar.gz -OutFile lua.tar.gz
# Store Wireshark as artifact for future usage
- name: Archive wireshark.exe as artifact
uses: actions/upload-artifact@v4
with:
name: Wireshark
path: wireshark.exe
if-no-files-found: error
# Extract / rename folders and delete downloads
- name: Unzip DLL source code
run: tar -xf dll.zip
- name: Normalize DLL source code folder
run: mv LuaBitOp* dll
- name: Delete DLL source code archive
run: rm dll.zip
- name: Unzip Lua source code
run: tar -xf lua.tar.gz
- name: Normalize Lua source code folder
run: mv lua-* lua
- name: Delete Lua source code archive
run: rm lua.tar.gz
- name: Extract lua52.dll from wireshark.exe
run: 7z e wireshark.exe lua52.dll
- name: Rename Lua DLL with the right name for the build
run: mv lua52.dll lua51.dll
- name: Delete Wireshark executable
run: rm wireshark.exe
# Copy everything in build directory (dll) and compile
- name: Copy Lua Source code to build directory
run: cp lua\src\* dll
- name: Compile
run: cd dll && mingw32-make -f Makefile.mingw
- name: Move DLL to working directory
run: mv dll/bit.dll bit.dll
# Store LuaBitOp DLL as artifact for future usage
- name: Archive DLL as artifact
uses: actions/upload-artifact@v4
with:
name: LuaBitOp-DLL
path: bit.dll
if-no-files-found: error
package_ubuntu_plugin:
runs-on: ubuntu-latest
steps:
- name: Get Plugin
uses: actions/checkout@v4
with:
sparse-checkout: .
- name: Create directory structure
run: mkdir -p lib/x86_64-linux-gnu/wireshark/plugins share/wireshark
- name: Move plugin files
run: mv cyber_*.lua LICENSE README.md COPYING lib/x86_64-linux-gnu/wireshark/plugins
- name: Move user_dlts file
run: mv user_dlts share/wireshark
- name: Package plugin
run: zip -r Wireshark_plugin.zip share lib
# Store Wireshark plugin as artifact for future usage
- name: Archive plugin as artifact
uses: actions/upload-artifact@v4
with:
name: Wireshark-plugin-ubuntu
path: Wireshark_plugin.zip
if-no-files-found: error
package_alpine_plugin:
runs-on: ubuntu-latest
steps:
- name: Get Plugin
uses: actions/checkout@v4
with:
sparse-checkout: .
- name: Create directory structure
run: mkdir -p lib/wireshark/plugins share/wireshark
- name: Move plugin files
run: mv cyber_*.lua LICENSE README.md COPYING lib/wireshark/plugins
- name: Move user_dlts file
run: mv user_dlts share/wireshark
- name: Package plugin
run: zip -r Wireshark_plugin.zip share lib
# Store Wireshark plugin as artifact for future usage
- name: Archive plugin as artifact
uses: actions/upload-artifact@v4
with:
name: Wireshark-plugin-alpine
path: Wireshark_plugin.zip
if-no-files-found: error
package_centos_plugin:
runs-on: ubuntu-latest
steps:
- name: Get Plugin
uses: actions/checkout@v4
with:
sparse-checkout: .
- name: Create directory structure
run: mkdir -p lib64/wireshark/plugins share/wireshark
- name: Move plugin files
run: mv cyber_*.lua LICENSE README.md COPYING lib64/wireshark/plugins
- name: Move user_dlts file
run: mv user_dlts share/wireshark
- name: Package plugin
run: zip -r Wireshark_plugin.zip share lib64
# Store Wireshark plugin as artifact for future usage
- name: Archive plugin as artifact
uses: actions/upload-artifact@v4
with:
name: Wireshark-plugin-centos
path: Wireshark_plugin.zip
if-no-files-found: error
package_windows_plugin:
runs-on: windows-latest
needs: luabitop_windows_build
steps:
- name: Get Plugin
uses: actions/checkout@v4
with:
sparse-checkout: .
- name: Download LuaBitOp DLL
uses: actions/download-artifact@v4
with:
name: LuaBitOp-DLL
- name: Create directory structure
run: mkdir -p Wireshark/plugins
- name: Move plugin files
run: mv cyber_*.lua,LICENSE,README.md,COPYING Wireshark/plugins
- name: Move LuaBitOp DLL and user_dlts
run: mv bit.dll,user_dlts Wireshark
- name: Package plugin
run: Compress-Archive -Path Wireshark -DestinationPath Wireshark_plugin.zip
# Store Wireshark plugin as artifact for future usage
- name: Archive plugin as artifact
uses: actions/upload-artifact@v4
with:
name: Wireshark-plugin-windows
path: Wireshark_plugin.zip
if-no-files-found: error
test_a429_ubuntu:
runs-on: ubuntu-latest
needs: package_ubuntu_plugin
steps:
- name: Get test files
uses: actions/checkout@v4
with:
sparse-checkout: |
test
pcapng_files
sparse-checkout-cone-mode: false
- name: Download plugin
uses: actions/download-artifact@v4
with:
name: Wireshark-plugin-ubuntu
- name: Install luabitop
run: sudo apt-get install lua-bitop
- name: Install TShark
run: sudo apt-get install tshark
- name: Test TShark availability
run: tshark --version
- name: Extract Wireshark plugin
run: sudo unzip Wireshark_plugin.zip -d /usr
- name: Run TShark on ARINC429 traffic
run: tshark -e A429.LABEL -e A429.WORD -e A429.SDI -e A429.SSM -e A429.DATA -e A429.PARITY -E header=y -T fields -r pcapng_files/arinc429_broadcast.pcapng | tee a429_broadcast.output
- name: Run diff
run: diff a429_broadcast.output test/a429_broadcast.output
test_discrete_ubuntu:
runs-on: ubuntu-latest
needs: package_ubuntu_plugin
steps:
- name: Get test files
uses: actions/checkout@v4
with:
sparse-checkout: |
test
pcapng_files
sparse-checkout-cone-mode: false
- name: Download plugin
uses: actions/download-artifact@v4
with:
name: Wireshark-plugin-ubuntu
- name: Install TShark
run: sudo apt-get install tshark
- name: Test TShark availability
run: tshark --version
- name: Extract Wireshark plugin
run: sudo unzip Wireshark_plugin.zip -d /usr
- name: Run TShark on discrete traffic
run: tshark -e DISCRETE.VALUE -E header=y -T fields -r pcapng_files/discrete.pcapng | tee discrete.output
- name: Run diff
run: diff discrete.output test/discrete.output
test_a429_alpine:
runs-on: ubuntu-latest
needs: package_alpine_plugin
steps:
- name: Get test files
uses: actions/checkout@v4
with:
sparse-checkout: |
test
pcapng_files
sparse-checkout-cone-mode: false
- name: Download plugin
uses: actions/download-artifact@v4
with:
name: Wireshark-plugin-alpine
- name: Run TShark on ARINC429 traffic
run: docker run -v .:/test alpine sh -c "apk add tshark lua5.2-bitop && unzip /test/Wireshark_plugin.zip -d /usr && tshark -e A429.LABEL -e A429.WORD -e A429.SDI -e A429.SSM -e A429.DATA -e A429.PARITY -E header=y -T fields -r /test/pcapng_files/arinc429_broadcast.pcapng | tee /test/a429_broadcast.output"
- name: Run diff
run: diff a429_broadcast.output test/a429_broadcast.output
test_discrete_alpine:
runs-on: ubuntu-latest
needs: package_alpine_plugin
steps:
- name: Get test files
uses: actions/checkout@v4
with:
sparse-checkout: |
test
pcapng_files
sparse-checkout-cone-mode: false
- name: Download plugin
uses: actions/download-artifact@v4
with:
name: Wireshark-plugin-alpine
- name: Run TShark on ARINC429 traffic
run: docker run -v .:/test alpine sh -c "apk add tshark && unzip /test/Wireshark_plugin.zip -d /usr && tshark -e DISCRETE.VALUE -E header=y -T fields -r /test/pcapng_files/discrete.pcapng | tee /test/discrete.output"
- name: Run diff
run: diff discrete.output test/discrete.output
test_a429_windows:
runs-on: windows-latest
needs: package_windows_plugin
steps:
- name: Get test files
uses: actions/checkout@v4
with:
sparse-checkout: |
test
pcapng_files
sparse-checkout-cone-mode: false
- name: Download Wireshark plugin
uses: actions/download-artifact@v4
with:
name: Wireshark-plugin-windows
- name: Download Wireshark
uses: actions/download-artifact@v4
with:
name: Wireshark
- name: Install Wireshark
run: |
.\wireshark.exe /S
Start-Sleep -Seconds 30
- name: Test TShark availability
run: '& "${env:PROGRAMFILES}\Wireshark\tshark.exe" --version'
- name: Install plugin
run: Expand-Archive Wireshark_plugin.zip ${ENV:PROGRAMFILES} -Force
- name: Run TShark on ARINC429 traffic
run: '& "${env:PROGRAMFILES}\Wireshark\tshark.exe" -e A429.LABEL -e A429.WORD -e A429.SDI -e A429.SSM -e A429.DATA -e A429.PARITY -E header=y -T fields -r pcapng_files/arinc429_broadcast.pcapng | tee a429_broadcast.output'
- name: Run diff
run: fc.exe a429_broadcast.output test/a429_broadcast.output
test_discrete_windows:
runs-on: windows-latest
needs: package_windows_plugin
steps:
- name: Get test files
uses: actions/checkout@v4
with:
sparse-checkout: |
test
pcapng_files
sparse-checkout-cone-mode: false
- name: Download Wireshark plugin
uses: actions/download-artifact@v4
with:
name: Wireshark-plugin-windows
- name: Download Wireshark
uses: actions/download-artifact@v4
with:
name: Wireshark
- name: Install Wireshark
run: |
.\wireshark.exe /S
Start-Sleep -Seconds 30
- name: Test TShark availability
run: '& "${env:PROGRAMFILES}\Wireshark\tshark.exe" --version'
- name: Install plugin
run: Expand-Archive Wireshark_plugin.zip ${ENV:PROGRAMFILES} -Force
- name: Run TShark on discrete traffic
run: '& "${env:PROGRAMFILES}\Wireshark\tshark.exe" -e DISCRETE.VALUE -E header=y -T fields -r pcapng_files/discrete.pcapng | tee discrete.output'
- name: Run diff
run: fc.exe discrete.output test/discrete.output
release_ubuntu_plugin:
runs-on: ubuntu-latest
needs: [test_a429_ubuntu, test_discrete_ubuntu]
permissions:
contents: write
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Download plugin
uses: actions/download-artifact@v4
with:
name: Wireshark-plugin-ubuntu
- name: Rename archive
run: mv Wireshark_plugin.zip Wireshark_plugin-ubuntu-${{ github.ref_name }}.zip
- name: Release Ubuntu plugin
uses: softprops/action-gh-release@v1
with:
files: Wireshark_plugin-ubuntu-${{ github.ref_name }}.zip
fail_on_unmatched_files: true
release_alpine_plugin:
runs-on: ubuntu-latest
needs: [test_a429_alpine, test_discrete_alpine]
permissions:
contents: write
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Download plugin
uses: actions/download-artifact@v4
with:
name: Wireshark-plugin-alpine
- name: Rename archive
run: mv Wireshark_plugin.zip Wireshark_plugin-alpine-${{ github.ref_name }}.zip
- name: Release Alpine plugin
uses: softprops/action-gh-release@v1
with:
files: Wireshark_plugin-alpine-${{ github.ref_name }}.zip
fail_on_unmatched_files: true
release_centos_plugin:
runs-on: ubuntu-latest
needs: [package_centos_plugin]
permissions:
contents: write
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Download plugin
uses: actions/download-artifact@v4
with:
name: Wireshark-plugin-centos
- name: Rename archive
run: mv Wireshark_plugin.zip Wireshark_plugin-centos-${{ github.ref_name }}.zip
- name: Release CentOS plugin
uses: softprops/action-gh-release@v1
with:
files: Wireshark_plugin-centos-${{ github.ref_name }}.zip
fail_on_unmatched_files: true
release_windows_plugin:
runs-on: ubuntu-latest
needs: [test_a429_windows, test_discrete_windows]
permissions:
contents: write
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Download plugin
uses: actions/download-artifact@v4
with:
name: Wireshark-plugin-windows
- name: Rename archive
run: mv Wireshark_plugin.zip Wireshark_plugin-windows-${{ github.ref_name }}.zip
- name: Release Windows plugin
uses: softprops/action-gh-release@v1
with:
files: Wireshark_plugin-windows-${{ github.ref_name }}.zip
fail_on_unmatched_files: true