Skip to content

Commit

Permalink
Add github actions for Windows C Meterpreter payload
Browse files Browse the repository at this point in the history
  • Loading branch information
adfoster-r7 committed Dec 8, 2023
1 parent f539248 commit a7b5dba
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 53 deletions.
90 changes: 46 additions & 44 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
61 changes: 52 additions & 9 deletions .github/workflows/windows_meterpreter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,65 @@ 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-2019
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: |
shell: cmd
run: |-
dir "C:\Program Files (x86)"
dir "C:\Program Files"
dir "C:\Program Files (x86)\Microsoft Visual Studio"
dir "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\"
dir "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7"
dir "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools"
cd c/meterpreter
script --return --command 'make docker'
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" && make.bat

0 comments on commit a7b5dba

Please sign in to comment.