signature-base/makefile

41 lines
1.2 KiB
Makefile
Raw Normal View History

2019-01-17 12:20:54 +00:00
YARA=3.8.1
2017-08-11 14:00:44 +00:00
CUR_DIR=${PWD}
YARA_DIR=$(CUR_DIR)/yara
BUILD_DIR=$(CUR_DIR)/build
3RD_PARTY=$(CUR_DIR)/3rdparty
MJOLNIR_DIR=$(CUR_DIR)/../mjolnir
2017-08-11 14:00:44 +00:00
2021-05-19 06:40:36 +00:00
YAR_COMP_VARS=-d filename="XXX" -d filepath="XXX" -d extension="XXX" -d filetype="XXX" -d md5="XXX" -d id="1" -d owner="XXX"
2017-08-11 14:00:44 +00:00
YAR_SIGS=$(wildcard ./yara/*.yar)
all: clean prereq build
sigs: cleanbuild build
clean: cleanbuild
rm -rf $(3RD_PARTY)
cleanbuild:
rm -rf $(BUILD_DIR)
extractinfo:
2019-02-07 08:51:20 +00:00
python3 $(MJOLNIR_DIR)/mjolnir.py -d ./yara --metaexport -o sig-base-rules.temp
cat sig-base-rules.temp | sort > sig-base-rules.csv
rm -f sig-base-rules.temp
2017-08-11 14:00:44 +00:00
prereq:
mkdir -p $(3RD_PARTY)/src
wget -P $(3RD_PARTY)/src https://github.com/VirusTotal/yara/archive/v$(YARA).tar.gz
tar -xvzf $(3RD_PARTY)/src/*.tar.gz -C $(3RD_PARTY)/src
cd $(3RD_PARTY)/src/yara-$(YARA) ; \
./bootstrap.sh ; \
./configure --disable-shared --disable-magic --disable-cuckoo --prefix=$(3RD_PARTY)/yara ; \
2017-08-11 14:00:44 +00:00
make ; \
make install
build:
mkdir -p $(BUILD_DIR)/yara
for yarsig in $(YAR_SIGS) ; do \
echo "Compiling $(BUILD_DIR)/$(notdir $$yarsig) ..." ; \
$(3RD_PARTY)/yara/bin/yarac $(YAR_COMP_VARS) $(notdir $$yarsig) $(BUILD_DIR)/$(notdir $$yarsig).compiled ; \
done