forked from nortakales/flipper-zero-tonies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidation.sh
executable file
·42 lines (36 loc) · 1.06 KB
/
validation.sh
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
#!/bin/bash
shopt -s globstar
REQUIRED_PATTERNS=(
"Filetype: Flipper NFC device"
"Version: 4"
"UID:( [A-F0-9]{2}){8}"
"DSFID: 00"
"AFI: 00"
"IC Reference: 03"
"Lock DSFID: false"
"Lock AFI: false"
"Block Count: 8"
"Block Size: 04"
"Data Content:( [A-F0-9]{2}){32}"
"Security Status: 00 00 00 00 00 00 00 00"
"Capabilities: Default"
"Password Privacy: 7F FD 6E 5B"
"Password Destroy: 0F 0F 0F 0F"
"Password EAS: 00 00 00 00"
"Privacy Mode: false"
"Lock EAS: false"
)
for filename in **/*.nfc; do
for pattern in "${REQUIRED_PATTERNS[@]}"; do
if [ -z "$(grep -P "$pattern" "$filename")" ]; then
echo $filename
echo " Missing: $pattern"
fi
done
# The likelihood of two blocks of 00 in data content is almsot impossible,
# so use that as a check for when the full data is not read
if [ ! -z "$(grep -P "Data Content:( [A-F0-9]{2})* 00 00( [A-F0-9]{2})*" "$filename")" ]; then
echo $filename
echo " Full data not read"
fi
done