@@ -51,40 +51,42 @@ function fixup_rules() {
5151# update_dep updates a dependency to the latest release
5252function update_dep() {
5353 local kind=$1
54- local tmpdir=$( mktemp -d )
54+ local tmpdir=" "
5555 local rel=" unknown"
5656
57+ tmpdir=" $( mktemp -d) "
58+
5759 mkdir -p " ${kind} " || true
5860
5961 case $kind in
6062 YARAForge)
6163 rel=$( latest_github_release YARAHQ/yara-forge)
62- curl -L -o " ${tmpdir} /yaraforge.zip" " https://github.com/YARAHQ/yara-forge/releases/download/${rel} /yara-forge-rules-full.zip"
63- unzip -o -j " ${tmpdir} /yaraforge.zip" packages/full/yara-rules-full.yar -d " ${kind} "
64+ curl -L -o " ${tmpdir} " /yaraforge.zip " https://github.com/YARAHQ/yara-forge/releases/download/${rel} /yara-forge-rules-full.zip"
65+ unzip -o -j " ${tmpdir} " /yaraforge.zip packages/full/yara-rules-full.yar -d " ${kind} "
6466 ;;
6567 huntress)
6668 rel=$( git_clone https://github.com/huntresslabs/threat-intel.git " ${tmpdir} " )
6769 find " ${tmpdir} " \( -name " *.yar*" -o -name " *LICENSE*" \) -print -exec cp {} " ${kind} " \;
6870 # error: rule "BOINC" in boinc.yar(1): syntax error, unexpected identifier, expecting '{'
69- rm " ${kind} /boinc.yar"
71+ rm " ${kind} " /boinc.yar
7072 # ^ expecting pattern modifier, pattern identifier or `condition`, found `}` (missing condition field)
71- rm " ${kind} /defendnot_tool.yar"
73+ rm " ${kind} " /defendnot_tool.yar
7274 ;;
7375 InQuest-VT)
7476 rel=$( git_clone https://github.com/InQuest/yara-rules-vt.git " ${tmpdir} " )
7577 find " ${tmpdir} " \( -name " *.yar*" -o -name " *LICENSE*" -o -name " README*" \) -print -exec cp {} " ${kind} " \;
7678 ;;
7779 bartblaze)
7880 rel=$( git_clone https://github.com/bartblaze/Yara-rules.git " ${tmpdir} " )
79- cp -Rp ${tmpdir} /LICENSE ${tmpdir} /README.md ${tmpdir} /rules/* " ${kind} / "
81+ cp -Rp " ${tmpdir} " /LICENSE " ${tmpdir} " /README.md " ${tmpdir} " /rules/* " ${kind} " /
8082 ;;
8183 JPCERT)
8284 rel=$( git_clone https://github.com/JPCERTCC/jpcert-yara.git " ${tmpdir} " )
8385 find " ${tmpdir} " \( -name " *.yar*" -o -name " *LICENSE*" -o -name " README*" \) -print -exec cp {} " ${kind} " \;
8486 ;;
8587 TTC-CERT)
8688 rel=$( git_clone https://github.com/ttc-cert/TTC-CERT-YARA-Rules.git " ${tmpdir} " )
87- cp -Rp ${tmpdir} /* " ${kind} / "
89+ cp -Rp " ${tmpdir} " /* " ${kind} " /
8890 ;;
8991 elastic)
9092 rel=$( git_clone https://github.com/elastic/protections-artifacts.git " ${tmpdir} " )
@@ -96,12 +98,12 @@ function update_dep() {
9698 ;;
9799 esac
98100
99- fixup_rules ${kind} /* .yar* # nolint
100- echo " ${rel} " > " ${kind} /RELEASE"
101+ fixup_rules " ${kind} " /* .yar*
102+ echo " ${rel} " > " ${kind} " /RELEASE
101103 echo " updated ${kind} to ${rel} "
102104}
103105
104- cd " $( dirname $0 ) "
106+ cd " $( dirname " $0 " ) "
105107
106108if [[ " $1 " != " " ]]; then
107109 update_dep " $1 "
0 commit comments