PEASS-ng/.github/workflows/CI-master_tests.yml
2021-12-29 16:54:35 +00:00

194 lines
6.8 KiB
YAML

name: CI-master_test
on:
pull_request:
branches:
- master
workflow_dispatch:
jobs:
Build_and_test_winpeas_master:
runs-on: windows-latest
needs: Build_test_and_release_linpeas_master
# environment variables
env:
Solution_Path: 'winPEAS\winPEASexe\winPEAS.sln'
Configuration: 'Release'
DotFuscatorGeneratedPath: 'winPEAS\winPEASexe\binaries\Obfuscated Releases\Dotfuscated'
steps:
# checkout
- name: Checkout
uses: actions/checkout@master
with:
persist-credentials: false
# Otherwise, you will failed to push refs to dest repo.
fetch-depth: 0
ref: refs/heads/${{ github.head_ref }}
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.0.2
# Setup NuGet
- name: Setup NuGet.exe
uses: nuget/setup-nuget@v1
# Restore the packages for testing
- name: Restore the application
run: nuget restore $env:Solution_Path
# build
- name: run MSBuild
run: msbuild $env:Solution_Path
# Execute all unit tests in the solution
- name: Execute unit tests
run: dotnet test $env:Solution_Path
# Build & update all versions
- name: Build all versions
run: |
echo "build x64"
msbuild -m $env:Solution_Path /t:Rebuild /p:Configuration=$env:Configuration /p:Platform="x64"
echo "build x86"
msbuild -m $env:Solution_Path /t:Rebuild /p:Configuration=$env:Configuration /p:Platform="x86"
echo "build Any CPU"
msbuild -m $env:Solution_Path /t:Rebuild /p:Configuration=$env:Configuration /p:Platform="Any CPU"
# Copy the built versions
- name: Copy all versions
run: |
echo "copy x64"
cp winPEAS\winPEASexe\winPEAS\bin\x64\$env:Configuration\winPEAS.exe winPEAS\winPEASexe\binaries\x64\$env:Configuration\winPEASx64.exe
echo "copy x86"
cp winPEAS\winPEASexe\winPEAS\bin\x86\$env:Configuration\winPEAS.exe winPEAS\winPEASexe\binaries\x86\$env:Configuration\winPEASx86.exe
echo "copy Any"
cp winPEAS\winPEASexe\winPEAS\bin\$env:Configuration\winPEAS.exe winPEAS\winPEASexe\binaries\$env:Configuration\winPEASany.exe
# Setup DotFuscator
- name: Setup DotFuscator
run: |
7z x winPEAS\winPEASexe\Dotfuscator\DotfuscatorCE.zip
whoami
mkdir -p $env:USERPROFILE\AppData\Local\"PreEmptive Solutions"\"Dotfuscator Community Edition"\6.0 -erroraction 'silentlycontinue'
cp DotfuscatorCE\license\* $env:USERPROFILE\AppData\Local\"PreEmptive Solutions"\"Dotfuscator Community Edition"\6.0\
# build obfuscated versions
- name: Build obfuscated versions
run: |
DotfuscatorCE\dotfuscator.exe "winPEAS\winPEASexe\binaries\Obfuscated Releases\x64.xml"
DotfuscatorCE\dotfuscator.exe "winPEAS\winPEASexe\binaries\Obfuscated Releases\x86.xml"
DotfuscatorCE\dotfuscator.exe "winPEAS\winPEASexe\binaries\Obfuscated Releases\any.xml"
# copy the files
- name: Copy Dotfuscator generated files
run: |
cp $env:DotFuscatorGeneratedPath\x64\winPEASx64.exe "winPEAS\winPEASexe\binaries\Obfuscated Releases\winPEASx64.exe"
cp $env:DotFuscatorGeneratedPath\x86\winPEASx86.exe "winPEAS\winPEASexe\binaries\Obfuscated Releases\winPEASx86.exe"
cp $env:DotFuscatorGeneratedPath\any\winPEASany.exe "winPEAS\winPEASexe\binaries\Obfuscated Releases\winPEASany.exe"
# Git add
- name: Create local changes
run: |
git add winPEAS\winPEASexe\binaries\Release\*
git add winPEAS\winPEASexe\binaries\x64\*
git add winPEAS\winPEASexe\binaries\x86\*
git add "winPEAS\winPEASexe\binaries\Obfuscated Releases\*.exe"
# Git commit
- name: Commit results to Github
run: |
git config --local user.email "ci@winpeas.com"
git config --global user.name "CI-winpeas"
git pull origin "${{ github.ref }}" --autostash --rebase -Xours
git commit -m "winpeas binaries auto update" -a --allow-empty
# Git push
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: refs/heads/${{ github.head_ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true
Build_test_and_release_linpeas_master:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: refs/heads/${{ github.head_ref }}
- uses: actions/setup-go@v2
- name: Build linpeas
run: |
python3 -m pip install PyYAML
cd linPEAS
python3 -m builder.linpeas_builder
#- name: Build linpeas binaries
# run: |
# git clone https://github.com/carlospolop/sh2bin
# cd sh2bin
# bash build.sh ../linPEAS/linpeas.sh
# mv builds/sh2bin_386 ../linPEAS/binaries/linpeas_386
# mv builds/sh2bin_amd64 ../linPEAS/binaries/sh2bin_amd64
# mv builds/sh2bin_arm ../linPEAS/binaries/linpeas_arm
# mv builds/sh2bin_arm64 ../linPEAS/binaries/linpeas_arm64
# cd ..
# rm -rf sh2bin
- name: Run linpeas help
run: linPEAS/linpeas.sh -h
#- name: Run linpeas
# run: linPEAS/linpeas.sh -t
- name: Upload linpeas.sh
uses: actions/upload-artifact@v2
with:
name: linpeas.sh
path: linPEAS/linpeas.sh
- name: Create local changes
run: git add linPEAS/.
- name: Commit results to Github
run: |
git config --local user.email ""
git config --global user.name "CI-linpeas-ubuntu"
git pull origin "${{ github.ref }}" --autostash --rebase -Xours
git commit -m "linpeas.sh auto update" -a --allow-empty
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: refs/heads/${{ github.head_ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true
Build_and_test_macpeas_master:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Build macpeas
run: |
python3 -m pip install PyYAML
python3 -m pip install requests
cd linPEAS
python3 -m builder.linpeas_builder
- name: Run macpeas help
run: linPEAS/linpeas.sh -h
- name: Run macpeas
run: linPEAS/linpeas.sh -o system_information,container,procs_crons_timers_srvcs_sockets,network_information,users_information,software_information