From faefb80ec43a70f43ea80178f8c1bb00f683448b Mon Sep 17 00:00:00 2001 From: makikvues Date: Wed, 7 Jul 2021 10:46:51 +0200 Subject: [PATCH] - updated winpeas tests - updated CI-winpeas_build_test.yml --- .github/workflows/CI-winpeas_build_test.yml | 89 +++++++++++++++++++++ .github/workflows/CI-winpeas_test.yml | 47 ----------- winPEAS/winPEASexe/Tests/SmokeTests.cs | 20 ++++- 3 files changed, 108 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/CI-winpeas_build_test.yml delete mode 100644 .github/workflows/CI-winpeas_test.yml diff --git a/.github/workflows/CI-winpeas_build_test.yml b/.github/workflows/CI-winpeas_build_test.yml new file mode 100644 index 0000000..5cb58bb --- /dev/null +++ b/.github/workflows/CI-winpeas_build_test.yml @@ -0,0 +1,89 @@ +name: CI-winpeas_test + +on: + pull_request: + branches: + - winpeas_dev + paths: + - 'build_lists\sensitive_files.yaml' + - 'winPEAS\winPEASexe\**' + + workflow_dispatch: + +jobs: + + Build_and_test_winpeas: + runs-on: windows-latest + + # environment variables + env: + Solution_Path: 'winPEAS\winPEASexe\winPEAS.sln' + Configuration: 'Release' + + steps: + # checkout + - name: Checkout + uses: actions/checkout@v2 + + # 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 + + # Git add + - name: Create local changes + run: git add winPEAS\winPEASexe\binaries\* + + # Git commit + - name: Commit results to Github + run: | + git config --local user.email "" + git config --global user.name "CI-winpeas" + git commit -m "winpeas binaries auto update" -a --allow-empty + + # Git push + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} + \ No newline at end of file diff --git a/.github/workflows/CI-winpeas_test.yml b/.github/workflows/CI-winpeas_test.yml deleted file mode 100644 index daa92a4..0000000 --- a/.github/workflows/CI-winpeas_test.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: CI-winpeas_test - -on: - pull_request: - branches: - - winpeas_dev - paths: - - 'build_lists\sensitive_files.yaml' - - 'winPEAS\winPEASexe\**' - - workflow_dispatch: - -jobs: - - Build_and_test_winpeas: - runs-on: windows-latest - - # environment variables - env: - Solution_Path: 'winPEAS\winPEASexe\winPEAS.sln' - Configuration: 'Release' - - steps: - # checkout - - name: Checkout - uses: actions/checkout@v2 - - # 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: msbuild -m $env:Solution_Path /t:Restore /p:Configuration=$env:Configuration - 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 diff --git a/winPEAS/winPEASexe/Tests/SmokeTests.cs b/winPEAS/winPEASexe/Tests/SmokeTests.cs index a7abc47..9cf428c 100644 --- a/winPEAS/winPEASexe/Tests/SmokeTests.cs +++ b/winPEAS/winPEASexe/Tests/SmokeTests.cs @@ -11,7 +11,25 @@ namespace winPEAS.Tests { try { - string[] args = new string[] { "systeminfo", "userinfo", "networkinfo", "servicesinfo","processinfo" }; + string[] args = new string[] { + "systeminfo", "networkinfo", "servicesinfo", "processinfo", "applicationsinfo", "browserinfo", "debug" + }; + Program.Main(args); + } + catch (Exception e) + { + Assert.Fail($"Exception thrown: {e.Message}"); + } + } + + [TestMethod] + public void ShouldDisplayHelp() + { + try + { + string[] args = new string[] { + "help", + }; Program.Main(args); } catch (Exception e)