mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Rewrite aa-decode to use inline Python instead of to-be-deprecated Perl
This commit is contained in:
parent
a3ae271d1e
commit
707ef17923
1 changed files with 6 additions and 3 deletions
|
@ -37,8 +37,12 @@ EOM
|
|||
}
|
||||
|
||||
decode() {
|
||||
decoded=`perl -le "\\$s = uc('$1') ; if (\\$s =~ /^[0-9A-F]*$/) { print pack 'H*', \\$s; }"`
|
||||
echo "$decoded"
|
||||
if echo "$1" | egrep -q "^[0-9A-Fa-f]+$" ; then
|
||||
python3 -c "import binascii; print(bytes.decode(binascii.unhexlify('$1'), errors='strict'));"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
||||
|
@ -92,4 +96,3 @@ while read line ; do
|
|||
echo "$line"
|
||||
|
||||
done
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue