From 2e87e452c8dbaa89b86f472239e37b2cd4486f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20De=20Keersmaeker?= <francois.dekeersmaeker@uclouvain.be> Date: Fri, 12 Jul 2024 17:05:14 +0200 Subject: [PATCH] Updated CI --- .ci_scripts/install-dependencies.sh | 5 ----- .ci_scripts/run-all-pcaps.py | 20 ++++++++++++++++++++ .ci_scripts/run-all-pcaps.sh | 16 ---------------- .github/workflows/run-script.yml | 5 +++-- 4 files changed, 23 insertions(+), 23 deletions(-) delete mode 100755 .ci_scripts/install-dependencies.sh create mode 100755 .ci_scripts/run-all-pcaps.py delete mode 100755 .ci_scripts/run-all-pcaps.sh diff --git a/.ci_scripts/install-dependencies.sh b/.ci_scripts/install-dependencies.sh deleted file mode 100755 index ecac1d7..0000000 --- a/.ci_scripts/install-dependencies.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -apt update -apt install -y python3-pip -pip3 install -r $GITHUB_WORKSPACE/requirements.txt diff --git a/.ci_scripts/run-all-pcaps.py b/.ci_scripts/run-all-pcaps.py new file mode 100755 index 0000000..7045cee --- /dev/null +++ b/.ci_scripts/run-all-pcaps.py @@ -0,0 +1,20 @@ +#!/bin/python3 + +# Imports +import os +import glob +import pcap_fuzzer + + +### MAIN ### +if __name__ == "__main__": + + # Get paths + workspace_path = os.environ["GITHUB_WORKSPACE"] + traces_dir = os.path.join(workspace_path, "traces") + + # Get all PCAP files + all_pcaps = glob.glob(f"{traces_dir}/*.pcap") + + # Run PCAP fuzzer on all PCAP files + pcap_fuzzer.fuzz_pcaps(all_pcaps) diff --git a/.ci_scripts/run-all-pcaps.sh b/.ci_scripts/run-all-pcaps.sh deleted file mode 100755 index a8c960e..0000000 --- a/.ci_scripts/run-all-pcaps.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -EXITCODE=0 - -for pcap in $GITHUB_WORKSPACE/traces/*.pcap -do - # Run pcap_fuzzer script on pcap file - python3 $GITHUB_WORKSPACE/pcap_fuzzer/pcap_fuzzer.py $pcap - # If the exit code is not 0, set EXITCODE to 1 - if [[ $? -ne 0 ]] - then - EXITCODE=1 - fi -done - -exit $EXITCODE diff --git a/.github/workflows/run-script.yml b/.github/workflows/run-script.yml index 58a7c1f..864821e 100644 --- a/.github/workflows/run-script.yml +++ b/.github/workflows/run-script.yml @@ -15,6 +15,7 @@ jobs: sudo apt-get update sudo apt-get install -y python3-pip pip3 install -r $GITHUB_WORKSPACE/requirements.txt + pip3 install . - - name: Run script on all captures - run: $GITHUB_WORKSPACE/.ci_scripts/run-all-pcaps.sh + - name: Run fuzzer on all PCAP files + run: python3 $GITHUB_WORKSPACE/.ci_scripts/run-all-pcaps.py -- GitLab