diff --git a/.github/workflows/CI-winpeas_PR.yml b/.github/workflows/CI-winpeas_PR.yml new file mode 100644 index 0000000..06c3077 --- /dev/null +++ b/.github/workflows/CI-winpeas_PR.yml @@ -0,0 +1,23 @@ +name: CI-winpeas_PR + +on: + push: + branches: + - winpeas_dev + paths: + - 'build_lists\sensitive_files.yaml' + - 'winPEAS\winPEASexe\**' + +jobs: + build: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + + - uses: actions/checkout@v2 + - name: pull-request + uses: repo-sync/pull-request@v2 + with: + destination_branch: "master" + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/CI-winpeas_test.yml b/.github/workflows/CI-winpeas_test.yml new file mode 100644 index 0000000..5889b7c --- /dev/null +++ b/.github/workflows/CI-winpeas_test.yml @@ -0,0 +1,48 @@ +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 + + # Install the .NET Core workload + - name: Install .NET 4.x.x + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 4.5.2 + + # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.0.2 + + # Restore the packages for testing + - name: Restore the application + run: msbuild -m $env:Solution_Path /t:Restore /p:Configuration=$env:Configuration + + # 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/winPEAS.Tests/Properties/AssemblyInfo.cs b/winPEAS/winPEASexe/winPEAS.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4a29b7d --- /dev/null +++ b/winPEAS/winPEASexe/winPEAS.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("winPEAS.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("winPEAS.Tests")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("52a3b7ff-a1ad-4b41-ab4c-21c7f95ce42f")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/winPEAS/winPEASexe/winPEAS.Tests/SmokeTests.cs b/winPEAS/winPEASexe/winPEAS.Tests/SmokeTests.cs new file mode 100644 index 0000000..1cc6dd4 --- /dev/null +++ b/winPEAS/winPEASexe/winPEAS.Tests/SmokeTests.cs @@ -0,0 +1,23 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +namespace winPEAS.Tests +{ + [TestClass] + public class SmokeTests + { + [TestMethod] + public void ShouldRunWinPeass() + { + try + { + string[] args = new string[0]; + Program.Main(args); + } + catch (Exception e) + { + Assert.Fail($"Exception thrown: {e.Message}"); + } + } + } +} diff --git a/winPEAS/winPEASexe/winPEAS.Tests/packages.config b/winPEAS/winPEASexe/winPEAS.Tests/packages.config new file mode 100644 index 0000000..630c1de --- /dev/null +++ b/winPEAS/winPEASexe/winPEAS.Tests/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/winPEAS/winPEASexe/winPEAS.Tests/winPEAS.Tests.csproj b/winPEAS/winPEASexe/winPEAS.Tests/winPEAS.Tests.csproj new file mode 100644 index 0000000..e424d5c --- /dev/null +++ b/winPEAS/winPEASexe/winPEAS.Tests/winPEAS.Tests.csproj @@ -0,0 +1,86 @@ + + + + + + + + Debug + AnyCPU + {52A3B7FF-A1AD-4B41-AB4C-21C7F95CE42F} + Library + Properties + winPEAS.Tests + winPEAS.Tests + v4.5.2 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Microsoft.CodeCoverage.16.10.0\lib\net45\Microsoft.VisualStudio.CodeCoverage.Shim.dll + + + ..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + + + + + + + + + + + + {d934058e-a7db-493f-a741-ae8e3df867f4} + winPEAS + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + \ No newline at end of file diff --git a/winPEAS/winPEASexe/winPEAS.sln b/winPEAS/winPEASexe/winPEAS.sln index 6e6c8c8..13c82b3 100755 --- a/winPEAS/winPEASexe/winPEAS.sln +++ b/winPEAS/winPEASexe/winPEAS.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.29326.143 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "winPEAS", "winPEAS\winPEAS.csproj", "{D934058E-A7DB-493F-A741-AE8E3DF867F4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "winPEAS.Tests", "winPEAS.Tests\winPEAS.Tests.csproj", "{52A3B7FF-A1AD-4B41-AB4C-21C7F95CE42F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +29,18 @@ Global {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|x64.Build.0 = Release|x64 {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|x86.ActiveCfg = Release|x86 {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|x86.Build.0 = Release|x86 + {52A3B7FF-A1AD-4B41-AB4C-21C7F95CE42F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {52A3B7FF-A1AD-4B41-AB4C-21C7F95CE42F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52A3B7FF-A1AD-4B41-AB4C-21C7F95CE42F}.Debug|x64.ActiveCfg = Debug|Any CPU + {52A3B7FF-A1AD-4B41-AB4C-21C7F95CE42F}.Debug|x64.Build.0 = Debug|Any CPU + {52A3B7FF-A1AD-4B41-AB4C-21C7F95CE42F}.Debug|x86.ActiveCfg = Debug|Any CPU + {52A3B7FF-A1AD-4B41-AB4C-21C7F95CE42F}.Debug|x86.Build.0 = Debug|Any CPU + {52A3B7FF-A1AD-4B41-AB4C-21C7F95CE42F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {52A3B7FF-A1AD-4B41-AB4C-21C7F95CE42F}.Release|Any CPU.Build.0 = Release|Any CPU + {52A3B7FF-A1AD-4B41-AB4C-21C7F95CE42F}.Release|x64.ActiveCfg = Release|Any CPU + {52A3B7FF-A1AD-4B41-AB4C-21C7F95CE42F}.Release|x64.Build.0 = Release|Any CPU + {52A3B7FF-A1AD-4B41-AB4C-21C7F95CE42F}.Release|x86.ActiveCfg = Release|Any CPU + {52A3B7FF-A1AD-4B41-AB4C-21C7F95CE42F}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/winPEAS/winPEASexe/winPEAS/Helpers/Beaprint.cs b/winPEAS/winPEASexe/winPEAS/Helpers/Beaprint.cs index 9a05937..8388fb6 100644 --- a/winPEAS/winPEASexe/winPEAS/Helpers/Beaprint.cs +++ b/winPEAS/winPEASexe/winPEAS/Helpers/Beaprint.cs @@ -154,27 +154,37 @@ namespace winPEAS.Helpers ///////////////////////////////// public static void GreatPrint(string toPrint) { + // print_title Console.WriteLine(); Console.WriteLine(); int halfTotal = 60; - Console.WriteLine(LCYAN + " " + new String('=', halfTotal - toPrint.Length) + "(" + NOCOLOR + YELLOW + toPrint + LCYAN + ")" + new String('=', halfTotal - toPrint.Length) + NOCOLOR); + //Console.WriteLine(LCYAN + " " + new String('=', halfTotal - toPrint.Length) + "(" + NOCOLOR + YELLOW + toPrint + LCYAN + ")" + new String('=', halfTotal - toPrint.Length) + NOCOLOR); + + Console.WriteLine($"{LCYAN}════════════════════════════════════╣ {GREEN}{toPrint}{LCYAN} ╠════════════════════════════════════{NOCOLOR}"); } public static void MainPrint(string toPrint) { + // print_2title + Console.WriteLine(); - Console.WriteLine(YELLOW + " [+] " + GREEN + toPrint + NOCOLOR); + //Console.WriteLine(YELLOW + " [+] " + GREEN + toPrint + NOCOLOR); + Console.WriteLine($"{LCYAN}╔══════════╣ {GREEN}{toPrint}{NOCOLOR}"); } public static void LinkPrint(string link, string comment = "") { - Console.WriteLine(YELLOW + " [?] " + LBLUE + comment + " " + LYELLOW + link + NOCOLOR); + // print_info + //Console.WriteLine(YELLOW + " [?] " + LBLUE + comment + " " + LYELLOW + link + NOCOLOR); + Console.WriteLine($"{LCYAN}╚ {LBLUE}{comment} {LYELLOW}{link}{NOCOLOR}"); } public static void InfoPrint(string toPrint) { - Console.WriteLine(YELLOW + " [i] " + LBLUE + toPrint + NOCOLOR); + // print_info + //Console.WriteLine(YELLOW + " [i] " + LBLUE + toPrint + NOCOLOR); + Console.WriteLine($"{LCYAN}╚ {LBLUE}{toPrint}{NOCOLOR}"); } public static void NotFoundPrint() @@ -361,6 +371,7 @@ namespace winPEAS.Helpers foreach (string elem in list_to_print) { Console.WriteLine(" " + elem); + // printf ${BLUE}"═╣ "$GREEN"$1"$NC #There is 1 "═" } } else