From 4764de69d1771fa10c6b8334e170dbedf840ad55 Mon Sep 17 00:00:00 2001 From: adfoster-r7 Date: Fri, 8 Dec 2023 00:03:19 +0000 Subject: [PATCH] Add github actions for Windows C Meterpreter payload --- .github/workflows/python.yml | 90 ++++++++++++----------- .github/workflows/windows_meterpreter.yml | 59 ++++++++++++--- 2 files changed, 95 insertions(+), 54 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index a617d9525..3ae0469b6 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -19,55 +19,57 @@ permissions: on: push: paths: - - 'python/**' + - 'c/**' + - '.github/**' pull_request: paths: - - 'python/**' + - 'c/**' + - '.github/**' -jobs: - verify: - strategy: - fail-fast: false - matrix: - os: - - macos-11 - - windows-2019 - - ubuntu-20.04 - runtime_version: - - 3.6 - - 3.8 - - 3.11 - include: - # We run older Python versions in Docker - as Github Actions does not support installing these versions on the host - - { os: ubuntu-20.04, runtime_version: 2.7, docker_image: 'python:2.7-alpine' } - - { os: ubuntu-20.04, runtime_version: 3.3, docker_image: 'python:3.3-alpine' } - - { os: ubuntu-20.04, runtime_version: 3.4, docker_image: 'python:3.4-alpine' } - - { os: ubuntu-20.04, runtime_version: 3.5, docker_image: 'python:3.5-alpine' } +# jobs: +# verify: +# strategy: +# fail-fast: false +# matrix: +# os: +# - macos-11 +# - windows-2019 +# - ubuntu-20.04 +# runtime_version: +# - 3.6 +# - 3.8 +# - 3.11 +# include: +# # We run older Python versions in Docker - as Github Actions does not support installing these versions on the host +# - { os: ubuntu-20.04, runtime_version: 2.7, docker_image: 'python:2.7-alpine' } +# - { os: ubuntu-20.04, runtime_version: 3.3, docker_image: 'python:3.3-alpine' } +# - { os: ubuntu-20.04, runtime_version: 3.4, docker_image: 'python:3.4-alpine' } +# - { os: ubuntu-20.04, runtime_version: 3.5, docker_image: 'python:3.5-alpine' } - timeout-minutes: 40 - runs-on: ${{ matrix.os }} - name: Python ${{ matrix.runtime_version }} ${{ matrix.docker_image && 'Docker' || matrix.os }} +# timeout-minutes: 40 +# runs-on: ${{ matrix.os }} +# name: Python ${{ matrix.runtime_version }} ${{ matrix.docker_image && 'Docker' || matrix.os }} - steps: - - name: Checkout code - uses: actions/checkout@v3 +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 - - name: Run tests in docker - if: ${{ matrix.docker_image }} - env: - DOCKER_IMAGE: ${{ matrix.docker_image }} - run: | - cd python/meterpreter - docker run --rm -w $(pwd) -v $(pwd):$(pwd) ${DOCKER_IMAGE} /bin/sh -c 'ls -lah; pip install mock; python -m unittest discover -v ./tests' +# - name: Run tests in docker +# if: ${{ matrix.docker_image }} +# env: +# DOCKER_IMAGE: ${{ matrix.docker_image }} +# run: | +# cd python/meterpreter +# docker run --rm -w $(pwd) -v $(pwd):$(pwd) ${DOCKER_IMAGE} /bin/sh -c 'ls -lah; pip install mock; python -m unittest discover -v ./tests' - - name: Set up Python on host - if: ${{ !matrix.docker_image }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.runtime_version }} +# - name: Set up Python on host +# if: ${{ !matrix.docker_image }} +# uses: actions/setup-python@v4 +# with: +# python-version: ${{ matrix.runtime_version }} - - name: Run tests on host - if: ${{ !matrix.docker_image }} - run: | - cd python/meterpreter - python -m unittest discover -v ./tests +# - name: Run tests on host +# if: ${{ !matrix.docker_image }} +# run: | +# cd python/meterpreter +# python -m unittest discover -v ./tests diff --git a/.github/workflows/windows_meterpreter.yml b/.github/workflows/windows_meterpreter.yml index 2a63c0f9f..aa4e36e4f 100644 --- a/.github/workflows/windows_meterpreter.yml +++ b/.github/workflows/windows_meterpreter.yml @@ -20,22 +20,61 @@ on: push: paths: - 'c/**' + - '.github/**' pull_request: paths: - 'c/**' + - '.github/**' jobs: - verify: - runs-on: ubuntu-latest + # mingw: + # runs-on: ubuntu-latest + # timeout-minutes: 40 + # name: Meterpreter MinGW Docker Build + # steps: + # - name: Checkout code + # uses: actions/checkout@v3 + # with: + # submodules: 'recursive' + + # - name: Compile + # run: | + # cd c/meterpreter + # script --return --command 'make docker' + + windows: + runs-on: windows-latest timeout-minutes: 40 - name: Meterpreter MinGW Docker Build + name: Meterpreter vsdev build steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: 'recursive' + # - name: Checkout code + # uses: actions/checkout@v3 + # with: + # submodules: 'recursive' + + # - name: Install Visual Studio Dependencies + # shell: powershell + # # https://github.com/actions/runner-images/issues/4051#issuecomment-916971476 + # run: |- + # Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" + # $InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Preview" + # $WorkLoads = '--add Microsoft.VisualStudio.Component.WinXP' + # $Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"", $WorkLoads, '--quiet', '--norestart', '--nocache') + # $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden + # if ($process.ExitCode -eq 0) + # { + # Write-Host "components have been successfully added" + # } + # else + # { + # Write-Host "components were not installed" + # exit 1 + # } - name: Compile - run: | - cd c/meterpreter - script --return --command 'make docker' + shell: cmd + run: |- + dir "C:\Program Files (x86)" + dir "C:\Program Files\Microsoft Visual Studio" + "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\VsDevCmd.bat" && make.bat + working-directory: c/meterpreter