Skip to content

Commit

Permalink
Added GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ne0nd0g committed Dec 14, 2023
1 parent 750e8ac commit c0a5b07
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 2 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: "Merlin Agent DLL Build & Test"

on:
push:
pull_request:

jobs:

build:
name: 'Build Job'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
id: checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
check-latest: true

- name: 'Build Merlin Agent DLL'
id: build
run: 'make'

- name: Install 7zip
id: install_7zip
run: sudo apt-get install p7zip-full

- name: Package Release
id: package
run: make package

- name: GoVulnCheck
id: govulncheck
uses: golang/govulncheck-action@v1
with:
go-version-input: '1.21'
go-package: './...'

- name: Gosec Security Scanner
id: gosec
uses: securego/gosec@master
with:
args: '-fmt sarif -out gosec.sarif ./...'

- name: Upload Gosec SARIF file
id: gosec_upload_sarif
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: gosec.sarif

- name: Go Report Card - Install
id: goreportcard_install
working-directory: /tmp
run: |
git clone https://github.com/gojp/goreportcard.git
cd goreportcard
make install
go install ./cmd/goreportcard-cli
- name: Go Report Card - Run
id: goreportcard_run
run: 'goreportcard-cli -v' # This renames the files in the ./rpc directory to *.grc.bak causing builds to fail
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "Merlin Agent DLL Release"

on:
push:
tags:
- 'v*.*.*'

jobs:
release:
name: 'Release Job'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
id: checkout
uses: actions/checkout@v3

- name: Set up Go
id: setup_go
uses: actions/setup-go@v4
with:
go-version: '1.21'
check-latest: true

- name: Install 7zip
id: install_7zip
run: sudo apt-get install p7zip-full

- name: Make Distribution
id: make_distro
run: make distro

- name: Create Draft Release
id: create_draft_release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ github.ref_name }}
name: ${{ github.ref_name }}
draft: true
prerelease: false
artifactErrorsFailBuild: true
artifacts: '*.7z'
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ XSECURE =-X "main.secure=${SECURE}"
LDFLAGS=-ldflags '-s -w ${XSECURE} ${XPARROT} ${XADDR} ${XAUTH} ${XTRANSFORMS} ${XLISTENER} ${XBUILD} ${XPROTO} ${XURL} ${XHOST} ${XPSK} ${XSLEEP} ${XPROXY} $(XUSERAGENT) $(XHEADERS) ${XSKEW} ${XPAD} ${XKILLDATE} ${XRETRY} -buildid='
GCFLAGS=-gcflags=all=-trimpath=$(GOPATH)
ASMFLAGS=-asmflags=all=-trimpath=$(GOPATH)# -asmflags=-trimpath=$(GOPATH)
PASSWORD=merlin
PACKAGE=7za a -p${PASSWORD} -mhe -mx=9
F=README.MD LICENSE data/modules docs data/README.MD data/agents/README.MD data/db/ data/log/README.MD data/x509 data/src data/bin data/html
F2=LICENSE
F=LICENSE

# Make Directory to store executables
$(shell mkdir -p ${DIR})
Expand All @@ -73,11 +73,17 @@ default:
x86_64-w64-mingw32-gcc -shared -pthread -o ${DIR}/merlin.dll ${DIR}/merlin.c ${DIR}/main.a -lwinmm -lntdll -lws2_32 && \
cp ${DIR}/merlin.dll .

distro: clean default package

garble:
export GOGARBLE=${GOGARBLE}; export GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CGO_ENABLED=1; \
garble -tiny -literals -seed ${SEED} build ${LDFLAGS} ${GCFLAGS} ${ASMFLAGS} -buildmode=c-archive -o ${DIR}/main.a main.go; \
cp merlin.c ${DIR}; \
x86_64-w64-mingw32-gcc -shared -pthread -o ${DIR}/merlin.dll ${DIR}/merlin.c ${DIR}/main.a -lwinmm -lntdll -lws2_32

package:
${PACKAGE} ${DIR}/merlin-agent-dll.7z ${DIR}/merlin.dll ${F}
cp ${DIR}/merlin-agent-dll.7z .

clean:
rm -rf ${DIR}*

0 comments on commit c0a5b07

Please sign in to comment.