add dynamic analysis #1775
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
pull_request: | |
branches: [ master ] | |
release: | |
types: [edited, published] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: PyInstaller for ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# set to false for debugging | |
fail-fast: true | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
# use old linux so that the shared library versioning is more portable | |
artifact_name: capa | |
asset_name: linux | |
- os: windows-2019 | |
artifact_name: capa.exe | |
asset_name: windows | |
- os: macos-11 | |
# use older macOS for assumed better portability | |
artifact_name: capa | |
asset_name: macos | |
steps: | |
- name: Checkout capa | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
submodules: true | |
# using Python 3.8 to support running across multiple operating systems including Windows 7 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0 | |
with: | |
python-version: 3.8 | |
- if: matrix.os == 'ubuntu-20.04' | |
run: sudo apt-get install -y libyaml-dev | |
- name: Upgrade pip, setuptools | |
run: python -m pip install --upgrade pip setuptools | |
- name: Install capa with build requirements | |
run: pip install -e .[build] | |
- name: Cache the rule set | |
run: python ./scripts/cache-ruleset.py ./rules/ ./cache/ | |
- name: Build standalone executable | |
run: pyinstaller --log-level DEBUG .github/pyinstaller/pyinstaller.spec | |
- name: Does it run (PE)? | |
run: dist/capa "tests/data/Practical Malware Analysis Lab 01-01.dll_" | |
- name: Does it run (Shellcode)? | |
run: dist/capa "tests/data/499c2a85f6e8142c3f48d4251c9c7cd6.raw32" | |
- name: Does it run (ELF)? | |
run: dist/capa "tests/data/7351f8a40c5450557b24622417fc478d.elf_" | |
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: ${{ matrix.asset_name }} | |
path: dist/${{ matrix.artifact_name }} | |
test_run: | |
name: Test run on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: [build] | |
strategy: | |
matrix: | |
include: | |
# OSs not already tested above | |
- os: ubuntu-22.04 | |
artifact_name: capa | |
asset_name: linux | |
- os: windows-2022 | |
artifact_name: capa.exe | |
asset_name: windows | |
steps: | |
- name: Download ${{ matrix.asset_name }} | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: ${{ matrix.asset_name }} | |
- name: Set executable flag | |
if: matrix.os != 'windows-2022' | |
run: chmod +x ${{ matrix.artifact_name }} | |
- name: Run capa | |
run: ./${{ matrix.artifact_name }} -h | |
zip_and_upload: | |
# upload zipped binaries to Release page | |
if: github.event_name == 'release' | |
name: zip and upload ${{ matrix.asset_name }} | |
runs-on: ubuntu-20.04 | |
needs: [build] | |
strategy: | |
matrix: | |
include: | |
- asset_name: linux | |
artifact_name: capa | |
- asset_name: windows | |
artifact_name: capa.exe | |
- asset_name: macos | |
artifact_name: capa | |
steps: | |
- name: Download ${{ matrix.asset_name }} | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: ${{ matrix.asset_name }} | |
- name: Set executable flag | |
run: chmod +x ${{ matrix.artifact_name }} | |
- name: Set zip name | |
run: echo "zip_name=capa-${GITHUB_REF#refs/tags/}-${{ matrix.asset_name }}.zip" >> $GITHUB_ENV | |
- name: Zip ${{ matrix.artifact_name }} into ${{ env.zip_name }} | |
run: zip ${{ env.zip_name }} ${{ matrix.artifact_name }} | |
- name: Upload ${{ env.zip_name }} to GH Release | |
uses: svenstaro/upload-release-action@2728235f7dc9ff598bd86ce3c274b74f802d2208 # v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN}} | |
file: ${{ env.zip_name }} | |
tag: ${{ github.ref }} |