-
Notifications
You must be signed in to change notification settings - Fork 136
/
Makefile
46 lines (36 loc) · 1.24 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
ifdef RS_SHELL
LDFLAGS := $(LDFLAGS) -X 'main.defaultShell=$(RS_SHELL)'
endif
ifdef RS_PUB
LDFLAGS := $(LDFLAGS) -X 'main.authorizedKey=$(RS_PUB)'
endif
RS_PASS ?= $(shell hexdump -n 8 -e '2/4 "%08x"' /dev/urandom)
LDFLAGS := $(LDFLAGS) -X 'main.localPassword=$(RS_PASS)'
ifdef LUSER
LDFLAGS := $(LDFLAGS) -X 'main.LUSER=$(LUSER)'
endif
ifdef LHOST
LDFLAGS := $(LDFLAGS) -X 'main.LHOST=$(LHOST)'
endif
ifdef LPORT
LDFLAGS := $(LDFLAGS) -X 'main.LPORT=$(LPORT)'
endif
ifdef BPORT
LDFLAGS := $(LDFLAGS) -X 'main.HomeBindPort=$(BPORT)'
endif
ifdef NOCLI
LDFLAGS := $(LDFLAGS) -X 'main.NOCLI=$(NOCLI)'
endif
.PHONY: build
build: clean
CGO_ENABLED=0 go build -ldflags="$(LDFLAGS) -s -w" -o bin/ .
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -ldflags="$(LDFLAGS) -s -w" -o bin/reverse-sshx64 .
CGO_ENABLED=0 GOARCH=386 GOOS=linux go build -ldflags="$(LDFLAGS) -s -w" -o bin/reverse-sshx86 .
CGO_ENABLED=0 GOARCH=amd64 GOOS=windows go build -ldflags="$(LDFLAGS) -s -w" -o bin/reverse-sshx64.exe .
CGO_ENABLED=0 GOARCH=386 GOOS=windows go build -ldflags="$(LDFLAGS) -s -w" -o bin/reverse-sshx86.exe .
.PHONY: clean
clean:
rm -f bin/*reverse-ssh*
.PHONY: compressed
compressed: build
@for f in $(shell ls bin); do upx -o "bin/upx_$${f}" "bin/$${f}"; done