* Enable testing exploit * Fix unused result warning * Fix oversight in CI * Fix oversight in CI II * Fix oversight in CI III * Fix oversight in CI IV * Debugging CI * Debugging CI * Debugging CI * Debugging & supplying custom libc * Trying out stuff. * Triggering CI? * Testing around. * Fix test_exploit CI. * Fix test_exploit CI.
116 lines
3.0 KiB
YAML
116 lines
3.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
name: Build vuln
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Build with CMake
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
cmake .. -G "Unix Makefiles"
|
|
make
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: vuln-artifact
|
|
path: build/vuln
|
|
retention-days: 1
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
name: Test correct program
|
|
needs: build
|
|
|
|
env:
|
|
FNETD_PASSWORD: 1234
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/download-artifact@v3
|
|
name: Download build artifacts
|
|
with:
|
|
name: vuln-artifact
|
|
path: build/
|
|
|
|
- name: Install fnetd
|
|
run: |
|
|
wget https://cloud.sec.in.tum.de/index.php/s/n5cJnDqnnpSeEpd/download/fnetd.tar.xz -O fnetd.tar.xz
|
|
tar -xf fnetd.tar.xz
|
|
mkdir fnetd/build
|
|
cd fnetd/build
|
|
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
|
|
make
|
|
cd ../..
|
|
|
|
- name: Setup get_flag
|
|
run: gcc tests/get_flag.c -o get_flag -O3
|
|
|
|
- uses: JarvusInnovations/background-action@v1.0.5
|
|
name: Start fnetd
|
|
with:
|
|
run: |
|
|
chmod +x build/vuln
|
|
fnetd/build/fnetd -p 1337 -lt 2 -lm 536870912 build/vuln &
|
|
|
|
tail: true
|
|
wait-on: tcp:localhost:1337
|
|
wait-for: 10s
|
|
|
|
- name: Setup python libs
|
|
run: pip install -r tests/requirements.txt
|
|
|
|
- name: Run tests
|
|
# idk why we need to pipe the output to /dev/null here, but else the pipeline does not finish
|
|
run: python -m unittest discover tests/ &> /dev/null
|
|
|
|
test_exploit:
|
|
runs-on: ubuntu-latest
|
|
name: Test exploit
|
|
needs: build
|
|
|
|
env:
|
|
FNETD_PASSWORD: 1234
|
|
RELEASE_PORT: 8080
|
|
DEBUG_PORT: 8081
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: JarvusInnovations/background-action@v1
|
|
name: Build docker container
|
|
with:
|
|
run: |
|
|
cp tests/Dockerfile .
|
|
sh -c "docker build --no-cache -t exploit_test --build-arg RELEASE_PORT=$RELEASE_PORT --build-arg DEBUG_PORT=$DEBUG_PORT --build-arg FNETD_PASSWORD=$FNETD_PASSWORD ."
|
|
sh -c "docker run -d -p $RELEASE_PORT:$RELEASE_PORT -p $DEBUG_PORT:$DEBUG_PORT --name exploit_test exploit_test"
|
|
|
|
tail: true
|
|
wait-on: |
|
|
tcp:localhost:${{ env.DEBUG_PORT }}
|
|
tcp:localhost:${{ env.RELEASE_PORT }}
|
|
wait-for: 2m
|
|
|
|
- name: Setup python libs
|
|
run: pip install -r tests/requirements.txt
|
|
|
|
- name: Run exploit tests
|
|
# idk why we need to pipe the output to /dev/null here, but else the pipeline does not finish
|
|
run: |
|
|
python3 exploit/test_exploit.py -f activation_key.txt &> log.txt
|
|
cat log.txt
|
|
|
|
- name: Stop docker
|
|
run: docker stop exploit_test |