Skip to content

Commit

Permalink
Merge pull request #390 from BishopFox/stage
Browse files Browse the repository at this point in the history
Upgrade Go / Protobuf / gRPC
  • Loading branch information
moloch-- authored Apr 11, 2021
2 parents 5707fe7 + 55674a1 commit 9343b2a
Show file tree
Hide file tree
Showing 212 changed files with 48,708 additions and 6,202 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/autorelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,6 @@ jobs:
git build-essential zlib1g zlib1g-dev wget zip unzip \
mingw-w64 binutils-mingw-w64 g++-mingw-w64 gcc-multilib
- name: Protoc
env:
PROTOC_VER: 3.11.4
run: |
wget -O protoc-${PROTOC_VER}-linux-x86_64.zip https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VER}/protoc-${PROTOC_VER}-linux-x86_64.zip \
&& unzip protoc-${PROTOC_VER}-linux-x86_64.zip \
&& sudo cp -vv ./bin/protoc /usr/local/bin/protoc
- name: Protoc-gen-go
env:
PROTOC_GEN_GO_VER: 1.3.5
run: |
wget -O protoc-gen-go.tar.gz https://github.com/golang/protobuf/archive/v${PROTOC_GEN_GO_VER}.tar.gz \
&& tar xvf protoc-gen-go.tar.gz \
&& cd protobuf-${PROTOC_GEN_GO_VER} \
&& make install
- name: Check out code into the Go module directory
uses: actions/checkout@v2

Expand Down Expand Up @@ -85,23 +68,6 @@ jobs:
- name: Mingw
run: brew install mingw-w64

- name: Protoc
env:
PROTOC_VER: 3.11.4
run: |
wget -O protoc-${PROTOC_VER}-osx-x86_64.zip https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VER}/protoc-${PROTOC_VER}-osx-x86_64.zip \
&& unzip protoc-${PROTOC_VER}-osx-x86_64.zip \
&& sudo cp -vv ./bin/protoc /usr/local/bin/protoc
- name: Protoc-gen-go
env:
PROTOC_GEN_GO_VER: 1.3.5
run: |
wget -O protoc-gen-go.tar.gz https://github.com/golang/protobuf/archive/v${PROTOC_GEN_GO_VER}.tar.gz \
&& tar xvf protoc-gen-go.tar.gz \
&& cd protobuf-${PROTOC_GEN_GO_VER} \
&& make install
- name: Check out code into the Go module directory
uses: actions/checkout@v2

Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,6 @@ jobs:
git build-essential zlib1g zlib1g-dev wget zip unzip \
mingw-w64 binutils-mingw-w64 g++-mingw-w64 gcc-multilib
- name: Protoc
env:
PROTOC_VER: 3.11.4
run: |
wget -O protoc-${PROTOC_VER}-linux-x86_64.zip https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VER}/protoc-${PROTOC_VER}-linux-x86_64.zip \
&& unzip protoc-${PROTOC_VER}-linux-x86_64.zip \
&& sudo cp -vv ./bin/protoc /usr/local/bin/protoc
- name: Protoc-gen-go
env:
PROTOC_GEN_GO_VER: 1.3.5
run: |
wget -O protoc-gen-go.tar.gz https://github.com/golang/protobuf/archive/v${PROTOC_GEN_GO_VER}.tar.gz \
&& tar xvf protoc-gen-go.tar.gz \
&& cd protobuf-${PROTOC_GEN_GO_VER} \
&& make install
- name: Check out code into the Go module directory
uses: actions/checkout@v2

Expand Down Expand Up @@ -76,23 +59,6 @@ jobs:
- name: Mingw
run: brew install mingw-w64

- name: Protoc
env:
PROTOC_VER: 3.11.4
run: |
wget -O protoc-${PROTOC_VER}-osx-x86_64.zip https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VER}/protoc-${PROTOC_VER}-osx-x86_64.zip \
&& unzip protoc-${PROTOC_VER}-osx-x86_64.zip \
&& sudo cp -vv ./bin/protoc /usr/local/bin/protoc
- name: Protoc-gen-go
env:
PROTOC_GEN_GO_VER: 1.3.5
run: |
wget -O protoc-gen-go.tar.gz https://github.com/golang/protobuf/archive/v${PROTOC_GEN_GO_VER}.tar.gz \
&& tar xvf protoc-gen-go.tar.gz \
&& cd protobuf-${PROTOC_GEN_GO_VER} \
&& make install
- name: Check out code into the Go module directory
uses: actions/checkout@v2

Expand Down
18 changes: 6 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@

release-*

# Generated by makefile
client/version/version.go
server/assets/version.go

# Diffs
*.orig

# Binaries
sliver-server
sliver-server_arm64
sliver.exe
/sliver-server
/sliver-server_arm64
/sliver.exe

sliver-client
sliver-client_arm64
sliver-client.exe
/sliver-client
/sliver-client_arm64
/sliver-client.exe

sliver-server-linux.zip
sliver-server-macos.zip
Expand All @@ -39,6 +35,4 @@ sliver-server-windows.zip
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/

*.pb.go

.DS_Store
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
FROM golang:1.16.2
FROM golang:1.16.3

#
# IMPORTANT: This Dockerfile is used for testing, I do not recommend deploying
# Sliver using this container configuration! However, if you do want
# a Docker deployment this is probably a good place to start.
#

ENV PROTOC_VER 3.11.4
ENV PROTOC_GEN_GO_VER 1.3.5
ENV PROTOC_VER 3.15.8

ENV PROTOC_GEN_GO_VER v1.26.0
ENV GRPC_GO v1.1.0

# Base packages
RUN apt-get update --fix-missing && apt-get -y install \
Expand All @@ -31,7 +33,6 @@ RUN mkdir -p /home/sliver/ && chown -R sliver:sliver /home/sliver
#
# > Metasploit
#

RUN curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall \
&& chmod 755 msfinstall \
&& ./msfinstall
Expand All @@ -48,10 +49,8 @@ RUN wget -O protoc-${PROTOC_VER}-linux-x86_64.zip https://github.com/protocolbuf
&& unzip protoc-${PROTOC_VER}-linux-x86_64.zip \
&& cp -vv ./bin/protoc /usr/local/bin

RUN wget -O protoc-gen-go.tar.gz https://github.com/golang/protobuf/archive/v${PROTOC_GEN_GO_VER}.tar.gz \
&& tar xvf protoc-gen-go.tar.gz \
&& cd protobuf-${PROTOC_GEN_GO_VER} \
&& make install
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOC_GEN_GO_VER} \
&& go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@${GRPC_GO}

# assets
WORKDIR /go/src/github.com/bishopfox/sliver
Expand All @@ -61,7 +60,8 @@ RUN ./go-assets.sh
ADD . /go/src/github.com/bishopfox/sliver/
RUN go mod vendor && make linux && cp -vv sliver-server /opt/sliver-server

RUN ls -lah && /opt/sliver-server unpack --force \
RUN ls -lah \
&& /opt/sliver-server unpack --force \
&& /go/src/github.com/bishopfox/sliver/go-tests.sh
RUN make clean \
&& rm -rf /go/src/* \
Expand Down
25 changes: 15 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ LDFLAGS = -ldflags "-s -w \
# Prerequisites
#
# https://stackoverflow.com/questions/5618615/check-if-a-program-exists-from-a-makefile
EXECUTABLES = protoc protoc-gen-go uname sed git zip go date
EXECUTABLES = uname sed git zip date $(GO)
K := $(foreach exec,$(EXECUTABLES),\
$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH")))

Expand All @@ -42,6 +42,14 @@ UNAME_P := $(shell uname -p)
# If the target is Windows from Linux/Darwin, check for mingw
CROSS_COMPILERS = x86_64-w64-mingw32-gcc x86_64-w64-mingw32-g++

# Programs required for generating protobuf/grpc files
PB_COMPILERS = protoc protoc-gen-go protoc-gen-go-grpc
ifeq ($(MAKECMDGOALS), pb)
K := $(foreach exec,$(PB_COMPILERS),\
$(if $(shell which $(exec)),some string,$(error "Missing cross-compiler $(exec) in PATH")))
ENV += CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++
endif

# *** Start Darwin ***
ifeq ($(UNAME_S),Darwin)
SED_INPLACE := sed -i ''
Expand Down Expand Up @@ -86,27 +94,27 @@ endif
# Targets
#
.PHONY: default
default: clean pb
default: clean
$(ENV) $(GO) build -trimpath $(TAGS),server $(LDFLAGS) -o sliver-server ./server
$(ENV) $(GO) build -trimpath $(TAGS),client $(LDFLAGS) -o sliver-client ./client

.PHONY: macos
macos: clean pb
macos: clean
GOOS=darwin GOARCH=amd64 $(ENV) $(GO) build -trimpath $(TAGS),server $(LDFLAGS) -o sliver-server ./server
GOOS=darwin GOARCH=amd64 $(ENV) $(GO) build -trimpath $(TAGS),client $(LDFLAGS) -o sliver-client ./client

.PHONY: macos-arm64
macos-arm64: clean pb
macos-arm64: clean
GOOS=darwin GOARCH=arm64 $(ENV) $(GO) build -trimpath $(TAGS),server $(LDFLAGS) -o sliver-server_arm64 ./server
GOOS=darwin GOARCH=arm64 $(ENV) $(GO) build -trimpath $(TAGS),client $(LDFLAGS) -o sliver-client_arm64 ./client

.PHONY: linux
linux: clean pb
linux: clean
GOOS=linux $(ENV) $(GO) build -trimpath $(TAGS),server $(LDFLAGS) -o sliver-server ./server
GOOS=linux $(ENV) $(GO) build -trimpath $(TAGS),client $(LDFLAGS) -o sliver-client ./client

.PHONY: windows
windows: clean pb
windows: clean
GOOS=windows $(ENV) $(GO) build -trimpath $(TAGS),server $(LDFLAGS) -o sliver-server.exe ./server
GOOS=windows $(ENV) $(GO) build -trimpath $(TAGS),client $(LDFLAGS) -o sliver-client.exe ./client

Expand All @@ -115,7 +123,7 @@ pb:
protoc -I protobuf/ protobuf/commonpb/common.proto --go_out=paths=source_relative:protobuf/
protoc -I protobuf/ protobuf/sliverpb/sliver.proto --go_out=paths=source_relative:protobuf/
protoc -I protobuf/ protobuf/clientpb/client.proto --go_out=paths=source_relative:protobuf/
protoc -I protobuf/ protobuf/rpcpb/services.proto --go_out=plugins=grpc,paths=source_relative:protobuf/
protoc -I protobuf/ protobuf/rpcpb/services.proto --go_out=paths=source_relative:protobuf/ --go-grpc_out=protobuf/ --go-grpc_opt=paths=source_relative

.PHONY: clean-all
clean-all: clean
Expand All @@ -127,8 +135,5 @@ clean-all: clean

.PHONY: clean
clean:
rm -f ./protobuf/client/*.pb.go
rm -f ./protobuf/sliver/*.pb.go
rm -f sliver-client_arm64 sliver-server_arm64
rm -f sliver-client sliver-server *.exe

2 changes: 1 addition & 1 deletion client/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func printLogo(sliverApp *grumble.App, rpc rpcpb.SliverRPCClient) {
fmt.Println("All hackers gain " + abilities[insecureRand.Intn(len(abilities))])
fmt.Printf(Info+"Server v%s - %s%s\n", serverSemVer, serverVer.Commit, dirty)
if version.GitCommit != serverVer.Commit {
fmt.Printf(Info+"Client v%s\n", version.FullVersion())
fmt.Printf(Info+"Client %s\n", version.FullVersion())
}
fmt.Println(Info + "Welcome to the sliver shell, please type 'help' for options")
fmt.Println()
Expand Down
2 changes: 1 addition & 1 deletion go-assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# Creates the static go asset archives

GO_VER="1.16.2"
GO_VER="1.16.3"
GARBLE_VER="1.16.2"

GO_ARCH_1="amd64"
Expand Down
12 changes: 7 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/fatih/color v1.10.0
github.com/gen2brain/shm v0.0.0-20200228170931-49f9650110c5 // indirect
github.com/gofrs/uuid v3.3.0+incompatible
github.com/golang/protobuf v1.4.3
github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.5 // indirect
github.com/google/uuid v1.2.0
github.com/gorilla/mux v1.8.0
Expand All @@ -35,12 +35,14 @@ require (
github.com/spf13/cobra v1.1.1
github.com/stretchr/testify v1.6.1
golang.org/x/crypto v0.0.0-20210317152858-513c2a44f670
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4
golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57
golang.zx2c4.com/wireguard v0.0.20200121
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200609130330-bd2cb7843e1b
google.golang.org/grpc v1.36.0-dev.0.20210208035533-9280052d3665
google.golang.org/protobuf v1.25.0 // indirect
google.golang.org/genproto v0.0.0-20210406143921-e86de6bf7a46 // indirect
google.golang.org/grpc v1.37.0
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 // indirect
google.golang.org/protobuf v1.26.0
gopkg.in/AlecAivazis/survey.v1 v1.8.8
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
gorm.io/driver/mysql v1.0.3
Expand Down
Loading

0 comments on commit 9343b2a

Please sign in to comment.