Skip to content

Commit 7ebd269

Browse files
authored
Merge branch 'Ne0nd0g:main' into master
2 parents 8f9d1bc + 90ef16b commit 7ebd269

File tree

200 files changed

+40300
-42298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+40300
-42298
lines changed

.github/workflows/go_dev.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# This workflow will build a golang project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3+
4+
name: "Scan, Build, & Test: Development Work"
5+
6+
on:
7+
push:
8+
branches-ignore:
9+
- main
10+
paths-ignore:
11+
- '.github/**'
12+
- 'data/**'
13+
- 'docs/**'
14+
- '.gitattributes'
15+
- '.gitignore'
16+
- '.gitmodules'
17+
- 'LICENSE'
18+
- 'README.MD'
19+
pull_request:
20+
21+
jobs:
22+
23+
build:
24+
name: 'Code Quality Scan & Build: Development Work'
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout Repository
28+
id: checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Go
32+
uses: actions/setup-go@v4
33+
with:
34+
go-version: '1.21'
35+
36+
- name: 'Build Merlin Server'
37+
id: build
38+
run: 'make distro'
39+
40+
- name: 'Test Merlin Server'
41+
id: test
42+
run: 'go test ./...'
43+
44+
- name: GoVulnCheck
45+
id: govulncheck
46+
uses: golang/govulncheck-action@v1
47+
with:
48+
go-version-input: '1.21'
49+
go-package: './...'
50+
51+
- name: Gosec Security Scanner
52+
id: gosec
53+
uses: securego/gosec@master
54+
with:
55+
args: ./...
56+
57+
- name: Go Report Card - Install
58+
id: goreportcard_install
59+
working-directory: /tmp
60+
run: |
61+
git clone https://github.com/gojp/goreportcard.git
62+
cd goreportcard
63+
make install
64+
go install ./cmd/goreportcard-cli
65+
66+
- name: Go Report Card - Run
67+
id: goreportcard_run
68+
run: 'goreportcard-cli -v' # This renames the files in the ./rpc directory to *.grc.bak causing builds to fail

.github/workflows/go_main.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# This workflow will build a golang project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3+
4+
name: "Scan, Build, & Test: Main"
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
paths-ignore:
11+
- '.github/**'
12+
- 'data/**'
13+
- 'docs/**'
14+
- '.gitattributes'
15+
- '.gitignore'
16+
- '.gitmodules'
17+
- 'LICENSE'
18+
- 'README.MD'
19+
20+
jobs:
21+
22+
build:
23+
name: 'Code Quality Scan & Build: main'
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout Repository
27+
id: checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Go
31+
uses: actions/setup-go@v4
32+
with:
33+
go-version: '1.21'
34+
35+
- name: 'Build Merlin Server'
36+
id: build
37+
run: 'make distro'
38+
39+
- name: 'Test Merlin Server'
40+
id: test
41+
run: 'go test ./...'
42+
43+
- name: GoVulnCheck
44+
id: govulncheck
45+
uses: golang/govulncheck-action@v1
46+
with:
47+
go-version-input: '1.21'
48+
go-package: './...'
49+
50+
- name: Gosec Security Scanner
51+
id: gosec
52+
uses: securego/gosec@master
53+
with:
54+
args: '-fmt sarif -out gosec.sarif ./...'
55+
56+
- name: Upload Gosec SARIF file
57+
id: gosec_upload_sarif
58+
uses: github/codeql-action/upload-sarif@v2
59+
with:
60+
sarif_file: gosec.sarif
61+
62+
- name: Go Report Card - Install
63+
id: goreportcard_install
64+
working-directory: /tmp
65+
run: |
66+
git clone https://github.com/gojp/goreportcard.git
67+
cd goreportcard
68+
make install
69+
go install ./cmd/goreportcard-cli
70+
71+
- name: Go Report Card - Run
72+
id: goreportcard_run
73+
run: 'goreportcard-cli -v' # This renames the files in the ./rpc directory to *.grc.bak causing builds to fail

.github/workflows/qodana.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "Qodana: Push"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths-ignore:
7+
- '.github/**'
8+
- 'data/**'
9+
- 'docs/**'
10+
- '.gitattributes'
11+
- '.gitignore'
12+
- '.gitmodules'
13+
- 'qodana.yaml'
14+
- 'qodana.sarif.json'
15+
- 'LICENSE'
16+
- 'README.MD'
17+
18+
19+
jobs:
20+
qodana:
21+
name: 'Qodana Job'
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: write
25+
pull-requests: write
26+
checks: write
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
31+
fetch-depth: 0 # a full history is required for pull request analysis
32+
- name: 'Qodana Scan'
33+
uses: JetBrains/[email protected]
34+
with:
35+
args: --baseline,.qodana/qodana.sarif.json
36+
env:
37+
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}

.github/workflows/qodana_pr.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "Qodana: Pull Request"
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths-ignore:
7+
- '.github/**'
8+
- 'data/**'
9+
- 'docs/**'
10+
- '.gitattributes'
11+
- '.gitignore'
12+
- '.gitmodules'
13+
- 'LICENSE'
14+
- 'README.MD'
15+
16+
jobs:
17+
qodana:
18+
name: 'Qodana Job'
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
pull-requests: write
23+
checks: write
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
28+
fetch-depth: 0 # a full history is required for pull request analysis
29+
- name: 'Qodana Scan'
30+
uses: JetBrains/[email protected]
31+
with:
32+
args: --baseline,.qodana/qodana.sarif.json
33+
pr-mode: false

.github/workflows/release.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: "Merlin Server Release"
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
release:
10+
name: 'Release Job'
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Merlin
14+
id: checkout_merlin
15+
uses: actions/checkout@v4
16+
17+
- name: Checkout Merlin-Agent
18+
id: checkout_merlin_agent
19+
run: git clone https://github.com/Ne0nd0g/merlin-agent.git /home/runner/work/merlin-agent
20+
21+
- name: Checkout Merlin-Agent-DLL
22+
id: checkout_merlin_agent_dll
23+
run: git clone https://github.com/Ne0nd0g/merlin-agent-dll.git /home/runner/work/merlin-agent-dll
24+
25+
- name: Checkout Merlin CLI
26+
id: checkout_merlin_cli
27+
run: git clone https://github.com/Ne0nd0g/merlin-cli.git /home/runner/work/merlin-cli
28+
29+
- name: Set up Go
30+
id: setup_go
31+
uses: actions/setup-go@v4
32+
with:
33+
go-version: '1.21'
34+
35+
# Need 7zip installed to package up the release
36+
- name: Install 7zip
37+
id: install_7zip
38+
run: sudo apt-get install p7zip-full
39+
40+
# Need MingGW installed to build the Agent DLL
41+
- name: Install MingGW
42+
id: install_mingw
43+
run: sudo apt-get install -y -q mingw-w64
44+
45+
- name: Build Merlin Agents
46+
id: build_agents
47+
working-directory: /home/runner/work/merlin-agent
48+
run: |
49+
VERSION=$(cat ./core/core.go |grep "var Version ="|cut -d"\"" -f2)
50+
BUILD=$(git rev-parse HEAD)
51+
DIR=bin/v${VERSION}/${BUILD}
52+
make all
53+
mv $DIR/merlinAgent-* .
54+
55+
- name: Build Merlin Agent DLL
56+
id: build_agent_dll
57+
working-directory: /home/runner/work/merlin-agent-dll
58+
run: make default
59+
60+
- name: Move Agents
61+
id: move_agents
62+
working-directory: /home/runner/work/merlin/merlin
63+
run: |
64+
mkdir -p data/bin
65+
cp /home/runner/work/merlin-agent/merlinAgent-* ./data/bin
66+
cp /home/runner/work/merlin-agent-dll/merlin.dll ./data/bin
67+
68+
- name: Build Merlin CLI
69+
id: build_cli
70+
working-directory: /home/runner/work/merlin-cli
71+
run: make release
72+
73+
- name: Move Merlin CLI
74+
id: move_cli
75+
working-directory: /home/runner/work/merlin/merlin
76+
run: |
77+
cp /home/runner/work/merlin-cli/merlinCLI-* ./data/bin
78+
79+
- name: Build Merlin Server
80+
id: build_server
81+
working-directory: /home/runner/work/merlin/merlin
82+
run: make distro
83+
84+
- name: Package Release
85+
id: package_release
86+
working-directory: /home/runner/work/merlin/merlin
87+
run: |
88+
VERSION=$(cat pkg/merlin.go |grep "const Version ="|cut -d"\"" -f2)
89+
BUILD=$(git rev-parse HEAD)
90+
DIR=data/temp/v${VERSION}/${BUILD}
91+
cp docs/CHANGELOG.MD .
92+
cp $DIR/merlinServer* .
93+
F="LICENSE data/modules CHANGELOG.MD data/README.MD data/agents/README.MD data/log/README.MD data/x509 data/src data/bin"
94+
7za a -pmerlin -mhe -mx=9 merlinServer-Linux-x64.7z $F merlinServer-Linux-x64
95+
7za a -pmerlin -mhe -mx=9 merlinServer-Darwin-x64.7z $F merlinServer-Darwin-x64
96+
7za a -pmerlin -mhe -mx=9 merlinServer-Windows-x64.7z $F merlinServer-Windows-x64.exe
97+
98+
- name: Create Draft Release
99+
id: create_draft_release
100+
uses: ncipollo/release-action@v1
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
with:
104+
tag: ${{ github.ref_name }}
105+
name: ${{ github.ref_name }}
106+
draft: true
107+
prerelease: false
108+
artifactErrorsFailBuild: true
109+
artifacts: '*.7z'

0 commit comments

Comments
 (0)