-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (46 loc) · 1.35 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
BINARY := ztmb-conv-json
GO_FILES := $(wildcard src/*.go)
BUILD := build
VERSION=0.1.0
COMMIT=$(shell git rev-parse HEAD)
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
LDFLAGS = -ldflags "-X main.VERSION=${VERSION} -X main.COMMIT=${COMMIT} -X main.BRANCH=${BRANCH}"
all: build
build:
go build ${LDFLAGS} -o ${BINARY} ${GO_FILES}
build-all: build-arm
build-arm:
GOOS=darwin GOARCH=arm64 go build ${LDFLAGS} -o ${BUILD}/${BINARY}-darwin-arm64 ${GO_FILES}
run: build
find pcaps -name '*.pcap' | xargs -n1 ./${BINARY}
clean:
rm -vrf ${BINARY}* dataset
find pcaps -name '*.json' | xargs -n1 rm -vrf
fmt:
go fmt ./...
deps:
go mod tidy
test:
go test ${GO_FILES} -v
ztmb: run
mkdir -pv ${BUILD}
mkdir -pv dataset
mkdir -pv dataset/benign
mkdir -pv dataset/dns2tcp
mkdir -pv dataset/dnscapy
mkdir -pv dataset/iodine
mkdir -pv dataset/tuns
for json in $$(find pcaps -name '*.json'); do \
tool=$$(echo $${json} | rev | cut -d '/' -f2 | rev); \
name=$$(echo $${json} | rev | cut -d '/' -f1 | rev); \
if `ztmb $${json} &> ./log.txt`; then \
mv result.json dataset/$${tool}/$${name}; \
mv log.txt dataset/$${tool}/$${name}.log; \
echo "Done: $${name}"; \
else \
mv log.txt dataset/$tool/$name.error.log; \
echo "Error: $${name}"; \
fi; \
done
tar -czvf ${BUILD}/dataset.tar.gz dataset
.PHONY: all build run clean test fmt lint deps help