forked from Neo23x0/signature-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
40 lines (33 loc) · 1.17 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
YARA=3.8.1
CUR_DIR=${PWD}
YARA_DIR=$(CUR_DIR)/yara
BUILD_DIR=$(CUR_DIR)/build
3RD_PARTY=$(CUR_DIR)/3rdparty
MJOLNIR_DIR=$(CUR_DIR)/../mjolnir
YAR_COMP_VARS=-d filename="XXX" -d filepath="XXX" -d extension="XXX" -d filetype="XXX" -d md5="XXX" -d id="1" -d owner="XXX"
YAR_SIGS=$(wildcard ./yara/*.yar)
all: clean prereq build
sigs: cleanbuild build
clean: cleanbuild
rm -rf $(3RD_PARTY)
cleanbuild:
rm -rf $(BUILD_DIR)
extractinfo:
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
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 ; \
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