mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-26 23:34:25 +02:00
Use xxd or hexdump, depending on OS
This commit is contained in:
parent
4829ae9722
commit
ba32b1a001
@ -43,8 +43,18 @@ if [ $# -gt 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate random host IDs
|
# Generate random host IDs
|
||||||
|
case "${OS}" in
|
||||||
|
"AIX")
|
||||||
|
# hexdump does not exist on AIX
|
||||||
HOSTID=$(head -c20 < /dev/urandom | xxd -c 20 -p)
|
HOSTID=$(head -c20 < /dev/urandom | xxd -c 20 -p)
|
||||||
HOSTID2=$(head -c32 < /dev/urandom | xxd -c 32 -p)
|
HOSTID2=$(head -c32 < /dev/urandom | xxd -c 32 -p)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# xxd does not exist on FreeBSD
|
||||||
|
HOSTID=$(head -c20 < /dev/urandom | hexdump -ve '"%.2x"')
|
||||||
|
HOSTID2=$(head -c32 < /dev/urandom | hexdump -ve '"%.2x"')
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
${ECHOCMD} "Generated host identifiers"
|
${ECHOCMD} "Generated host identifiers"
|
||||||
${ECHOCMD} "- hostid: ${HOSTID}"
|
${ECHOCMD} "- hostid: ${HOSTID}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user