-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerized kanku-sho, now it is more portable. Also fixed a bug in th…
…e interface about HTTP headers, and updated README.md.
- Loading branch information
Showing
13 changed files
with
159 additions
and
19 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM python:3 | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY requirements.txt . | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
RUN echo "wireshark-common wireshark-common/install-setuid boolean false" | debconf-set-selections | ||
RUN apt-get update -y && apt-get install -y --force-yes rsync sqlite3 tcpdump tshark | ||
|
||
COPY . . | ||
|
||
CMD ["./docker_wrapper.sh"] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
services: | ||
kanku-sho: | ||
build: | ||
context: . | ||
dockerfile: ./Dockerfile | ||
network: host | ||
image: kanku-sho | ||
volumes: | ||
- ./volume/:/usr/src/app/volume/ | ||
ports: | ||
- "8000:8000" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
# This is intended to run the main modules in Docker, because Docker allows only one CMD at a time | ||
srcPath=/usr/src/app/src | ||
vol=/usr/src/app/volume | ||
config="$vol/config.JSON" | ||
python -u "$srcPath/init_database.py" "$config" > "$vol/init_database_log.txt" | ||
declare -a pids | ||
nohup python -u "$srcPath/flask_interface.py" "$config" > "$vol/flask_interface_log.txt" 2>&1 & | ||
pids[0]=$! | ||
nohup python -u "$srcPath/remote_sniffer.py" "$config" > "$vol/remote_sniffer_log.txt" 2>&1 & | ||
pids[1]=$! | ||
nohup python -u "$srcPath/analysis_controller.py" "$config" > "$vol/analysis_controller_log.txt" 2>&1 & | ||
pids[2]=$! | ||
for pid in ${pids[*]}; do | ||
wait $pid | ||
done |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
import json | ||
import sys | ||
import os | ||
|
||
from sqlite_functions import init_database | ||
|
||
|
||
if __name__ == "__main__": | ||
with open('config.JSON', 'r') as f: | ||
if len(sys.argv) < 2: | ||
config_name = 'config.JSON' | ||
else: | ||
config_name = sys.argv[1] | ||
with open(config_name, 'r') as f: | ||
config = json.load(f) | ||
traffic_db = config['traffic_db'] | ||
init_database(traffic_db['db_name']) | ||
traffic_db = config['traffic_db']['db_name'] | ||
db_name = traffic_db.split("/")[-1] | ||
traffic_dir = os.listdir("/".join(traffic_db.split("/")[:-1])) | ||
if db_name not in traffic_dir: | ||
init_database(traffic_db) | ||
else: | ||
print("init_database.py: Database already initialized.") |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"run": { | ||
"flask_interface": true, | ||
"remote_sniffer": false, | ||
"analysis_controller": false | ||
}, | ||
"global": { | ||
"flag_regex": "flg\\{[A-Za-z0-9-_]{1,}\\}", | ||
"round_timeout": 60, | ||
"user": "mininet", | ||
"host": "192.168.122.115", | ||
"port": "22", | ||
"identity_file": "/usr/src/app/volume/remote_VM_ssh_id" | ||
}, | ||
"capture": { | ||
"remote_interface": "any", | ||
"remote_pcap_folder": "/home/mininet", | ||
"local_pcap_folder": "/usr/src/app/volume/traffic_queue", | ||
"local_pcap_backup": "/usr/src/app/volume/traffic_analysed", | ||
"cap_filename_prefix": "remote_VM", | ||
"run_with_sudo": false, | ||
"time_string": "%d_%m_%Y_%H:%M", | ||
"num_circular_files": 500, | ||
"initial_sleep_time": 10, | ||
"capture_file_size": 1, | ||
"preserve_all": false, | ||
"local_capture": false | ||
}, | ||
"traffic_db": { | ||
"db_name": "/usr/src/app/volume/traffic.db" | ||
}, | ||
"flask": { | ||
"port": 8000, | ||
"host": "0.0.0.0", | ||
"debug": true | ||
} | ||
} |