diff --git a/aegis-util/aegis/main.py b/aegis-util/aegis/main.py index b589a34..f2badae 100644 --- a/aegis-util/aegis/main.py +++ b/aegis-util/aegis/main.py @@ -18,7 +18,7 @@ def run_cli(): pull_images() elif action == "Start Container": image = questionary.select("Select an image", choices=[ - "fonalex45/aegis:dev", "dfonalex45/aegis:latest"]).ask() + "fonalex45/aegis:dev", "fonalex45/aegis:latest"]).ask() use_host_network = questionary.confirm("Enable host networking?").ask() project_dir = questionary.text( "Enter the project directory path:").ask() diff --git a/aegis-util/setup.py b/aegis-util/setup.py index cdabbf3..08553ab 100644 --- a/aegis-util/setup.py +++ b/aegis-util/setup.py @@ -9,7 +9,7 @@ "docker==7.1.0", "tqdm==4.67.0", "questionary==2.0.1", - "pycrypto==2.6.1", + "pycryptodome==3.21.0", "fabric==3.2.2", "paramiko==3.5.0", "paramiko-jump==0.1.3" diff --git a/wrapper/README.md b/wrapper/README.md new file mode 100644 index 0000000..b994746 --- /dev/null +++ b/wrapper/README.md @@ -0,0 +1,8 @@ +# Aegis + +A Python wrapper/TUI to manage Docker containers for the Aegis project. + +## Installation + +```bash +pip install . diff --git a/wrapper/aegis/__init__.py b/wrapper/aegis/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/wrapper/aegis/config.py b/wrapper/aegis/config.py new file mode 100644 index 0000000..4e155bb --- /dev/null +++ b/wrapper/aegis/config.py @@ -0,0 +1,6 @@ +import yaml + + +def load_profiles(): + with open("aegis/profiles.yaml", "r") as file: + return yaml.safe_load(file)["profiles"] diff --git a/wrapper/aegis/docker_utils.py b/wrapper/aegis/docker_utils.py new file mode 100644 index 0000000..91ec146 --- /dev/null +++ b/wrapper/aegis/docker_utils.py @@ -0,0 +1,38 @@ +import docker +from questionary import confirm +import os + +client = docker.from_env() + + +def pull_image(image_name): + print(f"Pulling image: {image_name}") + client.images.pull(image_name) + + +def start_container(profile, mount_path=None): + print(f"Starting container: {profile['name']}") + host_network = profile['options'].get('host_networking', False) + default_mount = profile['options'].get('default_mount', '') + + if not mount_path and default_mount: + mount_path = default_mount + + mounts = {} + if mount_path: + src, target = mount_path.split(":") + mounts[src] = {'bind': target, 'mode': 'rw'} + + client.containers.run( + profile['image'], + detach=True, + network_mode="host" if host_network else None, + volumes=mounts, + tty=True, + ) + + +def stop_container(container_id): + container = client.containers.get(container_id) + container.stop() + container.remove() diff --git a/wrapper/aegis/main.py b/wrapper/aegis/main.py new file mode 100644 index 0000000..e69de29 diff --git a/wrapper/aegis/profiles.yaml b/wrapper/aegis/profiles.yaml new file mode 100644 index 0000000..9e4d852 --- /dev/null +++ b/wrapper/aegis/profiles.yaml @@ -0,0 +1,15 @@ +profiles: + - name: "Dev" + image: "fonalex45/aegis:dev" + description: "Container for offensive security tools." + options: + host_networking: false + default_mount: "./projects:/workspace" + - name: "Main" + image: "fonalex45/aegis:latest" + description: "Container for offensive security tools." + options: + host_networking: true + default_mount: "./projects:/workspace" + + diff --git a/wrapper/requirements.txt b/wrapper/requirements.txt new file mode 100644 index 0000000..04aae31 --- /dev/null +++ b/wrapper/requirements.txt @@ -0,0 +1,7 @@ +docker==7.1.0 +tqdm==4.67.0 +questionary==2.0.1 +pycryptodome==3.21.0 +fabric==3.2.2 +paramiko==3.5.0 +paramiko-jump==0.1.3 diff --git a/wrapper/setup.py b/wrapper/setup.py new file mode 100644 index 0000000..7f498bb --- /dev/null +++ b/wrapper/setup.py @@ -0,0 +1,23 @@ +from setuptools import setup, find_packages + +setup( + name="aegis", + version="0.2.0", + packages=find_packages(), + install_requires=[ + "docker==7.1.0", + "tqdm==4.67.0", + "questionary==2.0.1", + "pycryptodome==3.18.0", + "fabric==3.2.2", + "paramiko==3.5.0", + "paramiko-jump==0.1.3", + "pyyaml==6.0", + ], + entry_points={ + "console_scripts": [ + "aegis=aegis.main:main" + ] + }, + python_requires=">=3.6", +)