-
Notifications
You must be signed in to change notification settings - Fork 25
128 lines (108 loc) · 3.9 KB
/
tests.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
# SPDX-FileCopyrightText: AISEC Pentesting Team
#
# SPDX-License-Identifier: CC0-1.0
# https://github.com/actions/setup-python/issues/374
#
name: tests
on:
push:
branches:
- master
pull_request:
paths:
- '.github/**'
- 'src/**'
- 'tests/**'
jobs:
pytest:
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.12']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: Gr1N/setup-poetry@v9
- uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}-${{ hashFiles('pyproject.toml') }}
- name: Install Dependencies
run: |
poetry install
- name: Run pytest
run: |
poetry run python -m pytest -v tests
vecu:
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.12']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: Gr1N/setup-poetry@v9
- uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}-${{ hashFiles('pyproject.toml') }}
- name: Install Dependencies
run: |
poetry install
- name: Spawn vECU
run: |
poetry run gallia script vecu "unix-lines:///tmp/vecu.sock" rng --seed 3 --mandatory_sessions "[1, 2, 3]" --mandatory_services "[DiagnosticSessionControl, EcuReset, ReadDataByIdentifier, WriteDataByIdentifier, RoutineControl, SecurityAccess, ReadMemoryByAddress, WriteMemoryByAddress, RequestDownload, RequestUpload, TesterPresent, ReadDTCInformation, ClearDiagnosticInformation, InputOutputControlByIdentifier]" &
- name: Add config
run: |
echo "[gallia]" > gallia.toml
echo "[gallia.scanner]" >> gallia.toml
echo 'target = "unix-lines:///tmp/vecu.sock"' >> gallia.toml
echo 'dumpcap = false' >> gallia.toml
echo "[gallia.protocols.uds]" >> gallia.toml
echo 'ecu_reset = 0x01' >> gallia.toml
- name: Dump Config and Defaults
run: |
poetry run gallia --show-config
poetry run gallia --show-defaults
- name: Test scan-services
run: |
poetry run gallia scan uds services --sessions 1 2 --check-session
- name: Test scan-sessions
run: |
poetry run gallia scan uds sessions --depth 2
poetry run gallia scan uds sessions --fast
- name: Test scan-identifiers
run: |
poetry run gallia scan uds identifiers --start 0 --end 100 --sid 0x22
poetry run gallia scan uds identifiers --start 0 --end 100 --sid 0x2e
poetry run gallia scan uds identifiers --start 0 --end 100 --sid 0x31
- name: Test scan-reset
run: |
poetry run gallia scan uds reset
- name: Test scan-dump-seeds
run: |
poetry run gallia scan uds dump-seeds --duration 0.01 --level 0x2f
- name: Test scan-memory-functions
run: |
for sid in 0x23 0x34 0x35 0x3d; do
poetry run gallia scan uds memory --sid "$sid"
done
- name: Test UDS primitives
run: |
poetry run gallia primitive uds ecu-reset
poetry run gallia primitive uds vin
poetry run gallia primitive uds ping --count 2
poetry run gallia primitive uds rdbi 0x108d
poetry run gallia primitive uds pdu 1001
poetry run gallia primitive uds wdbi 0x2266 --data 00
poetry run gallia primitive uds dtc read
poetry run gallia primitive uds dtc clear
poetry run gallia primitive uds dtc control --stop
poetry run gallia primitive uds dtc control --resume
poetry run gallia primitive uds iocbi 0x1000 reset-to-default