-
Notifications
You must be signed in to change notification settings - Fork 120
/
Makefile
46 lines (33 loc) · 1.31 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
# ref: https://vic.demuzere.be/articles/golang-makefile-crosscompile/
BIN_DIR := build
BIN_NAME := godoh
K := $(shell openssl rand -hex 16)
V := $(shell git rev-parse --short HEAD)
LD_FLAGS := -s -w -X=github.com/sensepost/godoh/cmd.Version=$(V)
# set dnsDomain if set
# Example: make dnsDomain=foo.bar
ifneq ($(dnsDomain),)
LD_FLAGS := $(LD_FLAGS) -X=github.com/sensepost/godoh/cmd.CompileTimeDomain=$(dnsDomain)
endif
default: keywarn clean darwin linux windows integrity
clean:
$(RM) $(BIN_DIR)/$(BIN_NAME)*
go clean -x
keywarn:
@echo "!!! Consider running 'make key' before 'make' to generate new encryption keys!"
@echo "!!! Not doing this will leave your C2 using the default key!\n"
key:
sed -i -E "s/const.*/const cryptKey = \`$(K)\`/g" lib/key.go
install:
go install
darwin:
GOOS=darwin GOARCH=amd64 go build -ldflags="$(LD_FLAGS)" -o '$(BIN_DIR)/$(BIN_NAME)-darwin64'
linux:
GOOS=linux GOARCH=amd64 go build -ldflags="$(LD_FLAGS)" -o '$(BIN_DIR)/$(BIN_NAME)-linux64'
windows:
GOOS=windows GOARCH=amd64 go build -ldflags="$(LD_FLAGS)" -o '$(BIN_DIR)/$(BIN_NAME)-windows64.exe'
GOOS=windows GOARCH=386 go build -ldflags="$(LD_FLAGS)" -o '$(BIN_DIR)/$(BIN_NAME)-windows32.exe'
pack:
cd $(BIN_DIR) && upx $(BIN_NAME)-linux64 $(BIN_NAME)-windows32.exe $(BIN_NAME)-windows64.exe
integrity:
cd $(BIN_DIR) && shasum *