From 0392c91da696a40c752de9519838a19d1a31e5af Mon Sep 17 00:00:00 2001 From: FamALouiz Date: Sat, 30 Aug 2025 09:56:21 +0200 Subject: [PATCH 1/2] doc: updates python command to specify state file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7fb1226..e4084ab 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ npm run dev ### 2. Initialize Network Topology ```bash -python3 commands/init_network.py +python3 commands/init_network.py --state-file ./public/simplified_state.json ``` ### 3. Access the Application From b1644a45d9d268124ae3007c9141492a60db51fc Mon Sep 17 00:00:00 2001 From: FamALouiz Date: Sat, 30 Aug 2025 10:07:38 +0200 Subject: [PATCH 2/2] doc: added virtual environment section --- README.md | 11 +++++++++++ commands/init_network.py | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e4084ab..8ff17f3 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,17 @@ cd LLMGuard npm install ``` +#### (Optional but recommended) Create virtual environment + +```bash +pip install virtualenv + +python3 -m venv .venv + +source .venv/bin/activate # for linux +.venv\Scripts\activate # for windows +``` + #### Python Dependencies ```bash diff --git a/commands/init_network.py b/commands/init_network.py index 5ee2dbf..8bdec14 100644 --- a/commands/init_network.py +++ b/commands/init_network.py @@ -84,7 +84,7 @@ def get_container_image_and_config(self, node_type: str) -> tuple[str, Dict[str, """Get Docker image and config for node type""" configs = { 'firewall': { - 'image': 'alpine:latest', + 'image': 'alpine:3.19.8', 'command': 'sh -c "apk add --no-cache iptables traceroute && tail -f /dev/null"', 'cap_add': ['NET_ADMIN'], 'privileged': True, @@ -98,28 +98,28 @@ def get_container_image_and_config(self, node_type: str) -> tuple[str, Dict[str, 'ports': {'80/tcp': None, '443/tcp': None} }, 'router': { - 'image': 'alpine:latest', + 'image': 'alpine:3.19.8', 'command': 'sh -c "apk add --no-cache iproute2 iptables traceroute && echo 1 > /proc/sys/net/ipv4/ip_forward && tail -f /dev/null"', 'cap_add': ['NET_ADMIN'], 'privileged': True, 'ports': {} }, 'switch': { - 'image': 'alpine:latest', + 'image': 'alpine:3.19.8', 'command': 'sh -c "apk add --no-cache bridge-utils iptables iproute2 && tail -f /dev/null"', 'cap_add': ['NET_ADMIN'], 'privileged': True, 'ports': {} }, 'user': { - 'image': 'alpine:latest', + 'image': 'alpine:3.19.8', 'command': 'sh -c "sleep 3 && apk add --no-cache iptables && tail -f /dev/null"', 'cap_add': [], 'privileged': True, # TODO: Change to non-privileged 'ports': {} }, 'external': { - 'image': 'alpine:latest', + 'image': 'alpine:3.19.8', 'command': 'sh -c "apk add --no-cache iptables iproute2 && tail -f /dev/null"', 'cap_add': ['NET_ADMIN'], 'privileged': True,