Skip to content

Commit

Permalink
Update tools. go version plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu committed Dec 8, 2023
1 parent 489904b commit 243d0e6
Show file tree
Hide file tree
Showing 15 changed files with 301 additions and 203 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
${{ runner.os }}-go-
- name: Release
run: |
wget https://github.com/upx/upx/releases/download/v4.1.0/upx-4.1.0-amd64_linux.tar.xz
tar -xvf upx-4.1.0-amd64_linux.tar.xz
chmod +x upx-4.1.0-amd64_linux/upx
sudo cp upx-4.1.0-amd64_linux/upx /usr/local/bin/
wget https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-amd64_linux.tar.xz
tar -xvf upx-4.2.1-amd64_linux.tar.xz
chmod +x upx-4.2.1-amd64_linux/upx
sudo cp upx-4.2.1-amd64_linux/upx /usr/local/bin/
npm config set //npm.pkg.github.com/:_authToken=$GITHUB_TOKEN
npm config set //registry.npmjs.org/:_authToken=$NPMJS_AUTH_TOKEN
bash build.sh
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:
${{ runner.os }}-go-
- name: Build
run: |
wget https://github.com/upx/upx/releases/download/v4.1.0/upx-4.1.0-amd64_linux.tar.xz
tar -xvf upx-4.1.0-amd64_linux.tar.xz
chmod +x upx-4.1.0-amd64_linux/upx
sudo cp upx-4.1.0-amd64_linux/upx /usr/local/bin/
wget https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-amd64_linux.tar.xz
tar -xvf upx-4.2.1-amd64_linux.tar.xz
chmod +x upx-4.2.1-amd64_linux/upx
sudo cp upx-4.2.1-amd64_linux/upx /usr/local/bin/
bash build.sh
pip3 install blint
blint -i plugins -o /tmp/reports
Expand Down
29 changes: 16 additions & 13 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
New-Item -ItemType Directory -Path plugins\goversion -Force
New-Item -ItemType Directory -Path plugins\cargo-auditable -Force
New-Item -ItemType Directory -Path plugins\osquery -Force
New-Item -ItemType Directory -Path plugins\dosai -Force

Invoke-WebRequest -Uri https://github.com/upx/upx/releases/download/v4.1.0/upx-4.1.0-win64.zip -UseBasicParsing -OutFile upx-4.1.0-win64.zip
Expand-Archive -Path upx-4.1.0-win64.zip -DestinationPath . -Force
Invoke-WebRequest -Uri https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-win64.zip -UseBasicParsing -OutFile upx-4.2.1-win64.zip
Expand-Archive -Path upx-4.2.1-win64.zip -DestinationPath . -Force

Invoke-WebRequest -Uri https://github.com/osquery/osquery/releases/download/5.9.1/osquery-5.9.1.windows_x86_64.zip -UseBasicParsing -OutFile osquery-5.9.1.windows_x86_64.zip
Expand-Archive -Path osquery-5.9.1.windows_x86_64.zip -DestinationPath . -Force
copy "osquery-5.9.1.windows_x86_64\Program Files\osquery\osqueryi.exe" plugins\osquery\osqueryi-windows-amd64.exe
upx-4.1.0-win64\upx.exe -9 --lzma plugins\osquery\osqueryi-windows-amd64.exe
Invoke-WebRequest -Uri https://github.com/osquery/osquery/releases/download/5.10.2/osquery-5.10.2.windows_x86_64.zip -UseBasicParsing -OutFile osquery-5.10.2.windows_x86_64.zip
Expand-Archive -Path osquery-5.10.2.windows_x86_64.zip -DestinationPath . -Force
copy "osquery-5.10.2.windows_x86_64\Program Files\osquery\osqueryi.exe" plugins\osquery\osqueryi-windows-amd64.exe
upx-4.2.1-win64\upx.exe -9 --lzma plugins\osquery\osqueryi-windows-amd64.exe

Invoke-WebRequest -Uri https://github.com/owasp-dep-scan/dosai/releases/latest/download/Dosai.exe -UseBasicParsing -OutFile plugins/dosai/dosai-windows-amd64.exe

set CGO_ENABLED=0
set GOOS=windows
set GOARCH=amd64
New-Item -ItemType Directory -Path plugins\goversion -Force
cd thirdparty\goversion
go build -ldflags "-H=windowsgui -s -w" -o build\goversion-windows-amd64.exe
..\..\upx-4.1.0-win64\upx.exe -9 --lzma build\goversion-windows-amd64.exe
..\..\upx-4.2.1-win64\upx.exe -9 --lzma build\goversion-windows-amd64.exe
copy build\* ..\..\plugins\goversion\
Remove-Item build -Recurse -Force
cd ..\..

New-Item -ItemType Directory -Path plugins\cargo-auditable -Force
cd thirdparty\cargo-auditable
go build -ldflags "-H=windowsgui -s -w" -o build\cargo-auditable-windows-amd64.exe
..\..\upx-4.1.0-win64\upx.exe -9 --lzma build\cargo-auditable-windows-amd64.exe
..\..\upx-4.2.1-win64\upx.exe -9 --lzma build\cargo-auditable-windows-amd64.exe
copy build\* ..\..\plugins\cargo-auditable\
Remove-Item build -Recurse -Force
cd ..\..

New-Item -ItemType Directory -Path plugins\trivy -Force
cd thirdparty\trivy
go build -ldflags "-H=windowsgui -s -w" -o build\trivy-windows-amd64.exe
..\..\upx-4.1.0-win64\upx.exe -9 --lzma build\trivy-windows-amd64.exe
..\..\upx-4.2.1-win64\upx.exe -9 --lzma build\trivy-windows-amd64.exe
copy build\* ..\..\plugins\trivy\
Remove-Item build -Recurse -Force
cd ..\..

Remove-Item osquery-5.9.1.windows_x86_64 -Recurse -Force
Remove-Item osquery-5.9.1.windows_x86_64.zip -Recurse -Force
Remove-Item upx-4.1.0-win64 -Recurse -Force
Remove-Item upx-4.1.0-win64.zip -Recurse -Force
Remove-Item osquery-5.10.2.windows_x86_64 -Recurse -Force
Remove-Item osquery-5.10.2.windows_x86_64.zip -Recurse -Force
Remove-Item upx-4.2.1-win64 -Recurse -Force
Remove-Item upx-4.2.1-win64.zip -Recurse -Force
27 changes: 18 additions & 9 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,32 @@ rm -rf plugins/goversion
rm -rf plugins/trivy
rm -rf plugins/cargo-auditable
rm -rf plugins/osquery
mkdir -p plugins/osquery
rm -rf plugins/dosai
mkdir -p plugins/osquery plugins/dosai

wget https://github.com/osquery/osquery/releases/download/5.9.1/osquery-5.9.1.windows_x86_64.zip
unzip osquery-5.9.1.windows_x86_64.zip
cp "osquery-5.9.1.windows_x86_64/Program Files/osquery/osqueryi.exe" plugins/osquery/osqueryi-windows-amd64.exe
wget https://github.com/osquery/osquery/releases/download/5.10.2/osquery-5.10.2.windows_x86_64.zip
unzip osquery-5.10.2.windows_x86_64.zip
cp "osquery-5.10.2.windows_x86_64/Program Files/osquery/osqueryi.exe" plugins/osquery/osqueryi-windows-amd64.exe
upx -9 --lzma plugins/osquery/osqueryi-windows-amd64.exe
sha256sum plugins/osquery/osqueryi-windows-amd64.exe > plugins/osquery/osqueryi-windows-amd64.exe.sha256
rm -rf osquery-5.9.1.windows_x86_64
rm osquery-5.9.1.windows_x86_64.zip
rm -rf osquery-5.10.2.windows_x86_64
rm osquery-5.10.2.windows_x86_64.zip

wget https://github.com/osquery/osquery/releases/download/5.9.1/osquery-5.9.1_1.linux_x86_64.tar.gz
tar -xvf osquery-5.9.1_1.linux_x86_64.tar.gz
wget https://github.com/osquery/osquery/releases/download/5.10.2/osquery-5.10.2_1.linux_x86_64.tar.gz
tar -xvf osquery-5.10.2_1.linux_x86_64.tar.gz
cp opt/osquery/bin/osqueryd plugins/osquery/osqueryi-linux-amd64
upx -9 --lzma plugins/osquery/osqueryi-linux-amd64
sha256sum plugins/osquery/osqueryi-linux-amd64 > plugins/osquery/osqueryi-linux-amd64.sha256
rm -rf etc usr var opt
rm osquery-5.9.1_1.linux_x86_64.tar.gz
rm osquery-5.10.2_1.linux_x86_64.tar.gz

curl -L https://github.com/owasp-dep-scan/dosai/releases/latest/download/Dosai -o plugins/dosai/dosai-linux-amd64
chmod +x plugins/dosai/dosai-linux-amd64
upx -9 --lzma plugins/dosai/dosai-linux-amd64
sha256sum plugins/dosai/dosai-linux-amd64 > plugins/dosai/dosai-linux-amd64.sha256

curl -L https://github.com/owasp-dep-scan/dosai/releases/latest/download/Dosai.exe -o plugins/dosai/dosai-windows-amd64.exe
sha256sum plugins/dosai/dosai-windows-amd64.exe > plugins/dosai/dosai-windows-amd64.exe.sha256

for plug in goversion trivy cargo-auditable
do
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cyclonedx/cdxgen-plugins-bin",
"version": "1.4.0",
"version": "1.5.0",
"description": "Binary plugins to supercharge @cyclonedx/cdxgen npm package",
"main": "index.js",
"repository": {
Expand Down
27 changes: 18 additions & 9 deletions packages/arm64/build-arm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,31 @@ rm -rf plugins/goversion
rm -rf plugins/trivy
rm -rf plugins/cargo-auditable
rm -rf plugins/osquery
mkdir -p plugins/osquery
rm -rf plugins/dosai
mkdir -p plugins/osquery plugins/dosai

wget https://github.com/osquery/osquery/releases/download/5.9.1/osquery-5.9.1.windows_arm64.zip
unzip osquery-5.9.1.windows_arm64.zip
cp "osquery-5.9.1.windows_arm64/Program Files/osquery/osqueryi.exe" plugins/osquery/osqueryi-windows-arm64.exe
wget https://github.com/osquery/osquery/releases/download/5.10.2/osquery-5.10.2.windows_arm64.zip
unzip osquery-5.10.2.windows_arm64.zip
cp "osquery-5.10.2.windows_arm64/Program Files/osquery/osqueryi.exe" plugins/osquery/osqueryi-windows-arm64.exe
sha256sum plugins/osquery/osqueryi-windows-arm64.exe > plugins/osquery/osqueryi-windows-arm64.exe.sha256
rm -rf osquery-5.9.1.windows_arm64
rm osquery-5.9.1.windows_arm64.zip
rm -rf osquery-5.10.2.windows_arm64
rm osquery-5.10.2.windows_arm64.zip

wget https://github.com/osquery/osquery/releases/download/5.9.1/osquery-5.9.1_1.linux_aarch64.tar.gz
tar -xvf osquery-5.9.1_1.linux_aarch64.tar.gz
wget https://github.com/osquery/osquery/releases/download/5.10.2/osquery-5.10.2_1.linux_aarch64.tar.gz
tar -xvf osquery-5.10.2_1.linux_aarch64.tar.gz
cp opt/osquery/bin/osqueryd plugins/osquery/osqueryi-linux-arm64
upx -9 --lzma plugins/osquery/osqueryi-linux-arm64
sha256sum plugins/osquery/osqueryi-linux-arm64 > plugins/osquery/osqueryi-linux-arm64.sha256
rm -rf etc usr var opt
rm osquery-5.9.1_1.linux_aarch64.tar.gz
rm osquery-5.10.2_1.linux_aarch64.tar.gz

curl -L https://github.com/owasp-dep-scan/dosai/releases/latest/download/Dosai -o plugins/dosai/dosai-linux-arm64
chmod +x plugins/dosai/dosai-linux-arm64
upx -9 --lzma plugins/dosai/dosai-linux-arm64
sha256sum plugins/dosai/dosai-linux-arm64 > plugins/dosai/dosai-linux-arm64.sha256

curl -L https://github.com/owasp-dep-scan/dosai/releases/latest/download/Dosai-windows-arm64.exe -o plugins/dosai/dosai-windows-arm64.exe
sha256sum plugins/dosai/dosai-windows-arm64.exe > plugins/dosai/dosai-windows-arm64.exe.sha256

for plug in goversion trivy cargo-auditable
do
Expand Down
2 changes: 1 addition & 1 deletion packages/arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cyclonedx/cdxgen-plugins-bin-arm64",
"version": "1.4.0",
"version": "1.5.0",
"description": "Arm64 binary plugins to supercharge @cyclonedx/cdxgen npm package",
"main": "index.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ppc64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cyclonedx/cdxgen-plugins-bin-ppc64",
"version": "1.4.0",
"version": "1.5.0",
"description": "ppc64 binary plugins to supercharge @cyclonedx/cdxgen npm package",
"main": "index.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/goversion/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PATH := $(PATH):/usr/local/go/bin:$HOME/go/bin:
appname := goversion
sources := version.go exe.go xcoff.go file.go
sources := version.go exe.go xcoff.go io.go file.go

build = CGO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build -ldflags "-s -w -extldflags=-Wl,-z,now,-z,relro" -o build/$(appname)-$(1)-$(2)$(3) && upx -9 --lzma build/$(appname)-$(1)-$(2)$(3) || true
sha = cd build && sha256sum $(appname)-$(1)-$(2)$(3) > $(appname)-$(1)-$(2)$(3).sha256
Expand Down
5 changes: 3 additions & 2 deletions thirdparty/goversion/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Introduction

The files in this directory were copied from go binary distribution 1.16.5
The files in this directory were copied from go binary distribution 1.21.4

```
cp /usr/local/go/src/cmd/go/internal/version/*.go .
cp /usr/local/go/src/internal/xcoff/xcoff.go .
cp /usr/local/go/src/internal/xcoff/file.go .
cp /usr/local/go/src/internal/saferio/io.go .
```

Few changes have been made to version.go to make the module compile
Few changes have been made to version.go and file.go to make the module compile
Loading

0 comments on commit 243d0e6

Please sign in to comment.