Skip to content

Commit

Permalink
Merge pull request #1 from fukuda-lab/improvement/prepare-for-open-so…
Browse files Browse the repository at this point in the history
…urcing

Prepare for open sourcing.
  • Loading branch information
l-laura authored Jul 11, 2023
2 parents 970d00a + b86d191 commit a99aa5a
Show file tree
Hide file tree
Showing 78 changed files with 5,264 additions and 1,496 deletions.
41 changes: 41 additions & 0 deletions .ci/run_sample_configurations.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail


# Set path variables.
repo_root="$(realpath $(dirname $BASH_SOURCE[0])/..)"
conf_path="$repo_root/configurations/examples"

# Move to repository root to make sure all subsequent commands
# run from the right directory.
cd "$repo_root"

# Run all training examples sequentially.
counter=1
for p in $(ls $conf_path/train); do
echo "-----------------------------------------------"
echo "$counter: running example configuration from $p"
echo "-----------------------------------------------"
((++counter))

python3 code/IoT-AD.py -c "$conf_path/train/$p" || \
{ echo "Error while running $conf_path/train/$p"; exit 1; }
done

# Run all test examples sequentially.
counter=1
for p in $(ls $conf_path/test); do
echo "-----------------------------------------------"
echo "$counter: running example configuration from $p"
echo "-----------------------------------------------"
((++counter))

python3 code/IoT-AD.py -c "$conf_path/test/$p" || \
{ echo "Error while running $conf_path/test/$p"; exit 1; }
done

echo "---------"
echo "Finished!"
echo "---------"
43 changes: 43 additions & 0 deletions .ci/run_sample_configurations_multithreaded.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail


# Set path variables.
repo_root="$(realpath $(dirname $BASH_SOURCE[0])/..)"
conf_path="$repo_root/configurations/examples"

# Move to repository root to make sure all subsequent commands
# run from the right directory.
cd "$repo_root"

# Run all training examples sequentially.
counter=1
for p in $(ls $conf_path/train); do
echo "-----------------------------------------------"
echo "$counter: running example configuration from $p"
echo "-----------------------------------------------"
((++counter))

python3 code/IoT-AD.py -c "$conf_path/train/$p" &
done

wait

# Run all test examples sequentially.
counter=1
for p in $(ls $conf_path/test); do
echo "-----------------------------------------------"
echo "$counter: running example configuration from $p" &
echo "-----------------------------------------------"
((++counter))

python3 code/IoT-AD.py -c "$conf_path/test/$p"
done

wait

echo "---------"
echo "Finished!"
echo "---------"
41 changes: 41 additions & 0 deletions .github/workflows/run-samples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Set up SIURU and run sample configurations

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8"]

steps:
- uses: actions/checkout@v3
- name: Initialize submodules
run: git submodule update --init --recursive
- name: Install Ubuntu dependencies
run: sudo apt install libpcap-dev
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r code/requirements.txt
- name: Build and install PcapPlusPlus
run: |
cd code/cpp-extract-features/PcapPlusPlus
cmake -S . -B cmake-build
cmake --build cmake-build --config Release
sudo cmake --install cmake-build
- name: Build feature extractor
run: |
cd code/cpp-extract-features
mkdir cmake-build && cd cmake-build
cmake ../..
cmake --build . --config Release
sudo setcap cap_net_raw+ep $(pwd)/pcap-feature-extraction
- name: Build and test sample configurations
run: ./.ci/run_sample_configurations.bash
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/code/cpp-extract-features/cmake-build/
/code/cpp-extract-features/PcapPlusPlus/cmake-build/
/data/
!/data/README.md
!/data/MQTTset-reduced/
/influxdb/
/logs/
/models/
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "code/cpp-extract-features/PcapPlusPlus"]
path = code/cpp-extract-features/PcapPlusPlus
url = [email protected]:seladb/PcapPlusPlus.git
url = https://github.com/seladb/PcapPlusPlus.git
[submodule "data/MQTTset-reduced"]
path = data/MQTTset-reduced
url = https://github.com/l-laura/MQTTset-reduced
8 changes: 8 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Copyright © 2023 Laura Lahesoo
Copyright © 2023 Fukuda-lab, National Institute of Informatics, Japan

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit a99aa5a

Please sign in to comment.