File: //usr/local/modsecurity-crs/regex-assembly/include/unix-shell-upto3.ra
##! Please refer to the documentation at
##! https://coreruleset.org/docs/development/regex_assembly/.
##! Note that the suffixes @ / ~ must be added manually to new entries.
##! To regenerate this list from unix-shell.data, run the following:
##! NL=$'\n'
##! # select words of length <= 3
##! original="$(grep -vE '^[#$]' regex-assembly/include/unix-shell-upto3.ra)"
##! source=$(awk '/^[^#$]/ {split($0,x,"/"); y=x[length(x)]} length(y) <= 3 {print y}' \
##! rules/unix-{shell,shell-builtins}.data | \
##! sort | uniq)
##! result=""
##! # retain all unmodified entries in this list and skip removed ones; ignore the manually added suffixes
##! while read -r oword; do
##! # strip @ and ~ from end of words
##! oword_raw="${oword/%@/}"
##! oword_raw="${oword_raw/%\~/}"
##! while read -r sword; do
##! if [ "${oword_raw}" = "${sword}" ]; then
##! result="${result}${oword}${NL}"
##! break
##! fi
##! done <<<"${source}"
##! done <<<"${original}"
##! # add new entries to this list
##! while read -r sword; do
##! found=0
##! while read -r oword; do
##! # strip @ and ~ from end of words
##! oword_raw="${oword/%@/}"
##! oword_raw="${oword_raw/%\~/}"
##! if [ "${oword_raw}" = "${sword}" ]; then
##! found=1
##! break
##! fi
##! done <<<"${original}"
##! if [ ${found} -eq 0 ]; then
##! result="${result}${sword}${NL}"
##! fi
##! done <<<"${source}"
##! # Add `@` suffix to all words, except those suffixed with `~`
##! original="${result}"
##! result=""
##! while read -r oword; do
##! oword_raw="${oword/%@/}"
##! if [ -n "${oword}" ]; then
##! oword_raw="${oword/%@/}"
##! if [[ "${oword_raw}" == "${oword_raw/%\~/}" ]]; then
##! result="${result}${oword_raw}@${NL}"
##! else
##! result="${result}${oword_raw}${NL}"
##! fi
##! fi
##! done <<<"${original}"
##! body_start=$(grep -n -E -m 1 '^[^#$]' regex-assembly/include/unix-shell-upto3.ra | cut -d: -f1)
##! ed -s regex-assembly/include/unix-shell-upto3.ra <<EOF
##! $((body_start - 1)),\$d
##! w
##! q
##! EOF
##! echo "${result}" | sort | uniq >> regex-assembly/include/unix-shell-upto3.ra
7z@
7za@
7zr@
7zx@
ab@
apt@
ar@
arj@
arp@
as@
ash@
at@
awk@
aws@
bzz@
c89@
c99@
cat@
cc@
cmp@
cp@
csh@
cut@
dd@
df@
dig@
dir@
dnf@
du@
eb@
ed@
env@
eqn@
es@
esh@
ex@
fc@
fd@
fg@
fi@
fmt@
ftp@
gcc~
gdb@
gem@
GET@
ghc@
git@
go@
gpg@
grc@
hd@
hup@
id@
ip@
irb@
jjs@
jq@
ksh@
ld@
ldd@
ln@
lp@
ls@
lua@
lz@
lz4@
man@
mtr@
mv@
nc@
net@
nl@
nm@
npm@
od@
pax@
pdb@
pf@
pg@
php@
pic@
pip~
pkg@
pr@
pry@
ps@
ptx@
pwd@
pxz@
rar@
rc@
rcp@
red@
rev@
rm@
rpm@
scp@
sed@
set@
sg@
sh@
ss@
ssh@
su@
svn@
tac@
tar@
tbl@
tcp@
tee@
tex@
tic@
top@
udp@
ul@
vi@
vim@
w@
w3m@
wc@
who@
xxd@
xz@
yes@
yum@
zip@
zsh@