Skip to content

Commit

Permalink
new
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrf45 committed Nov 30, 2024
1 parent 36a255a commit 29cf5a0
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 97 deletions.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions test/aegis/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

import questionary
from .docker_manager import pull_image, create_project_dir, run_container


def main():
client = docker.from_env()

action = questionary.select(
"What would you like to do?",
choices=[
"Pull Image", "Create Project", "Run Container", "Stop Container",
"Destroy Container", "Exit"
]
).ask()

if action == "Pull Image":
image_choice = questionary.select(
"Select the image to pull:",
choices=list(IMAGE_TAGS.values())
).ask()
pull_image(client, image_choice)

elif action == "Create Project":
project_name = questionary.text("Enter project name:").ask()
create_project_dir(project_name)

elif action == "Run Container":
image_choice = questionary.select(
"Select image to run:", choices=list(IMAGE_TAGS.values())).ask()
project_dir = questionary.text("Enter project directory:").ask()
host_network = questionary.confirm("Enable host networking?").ask()
run_container(client, image_choice, project_dir, host_network)


if __name__ == '__main__':
main()
6 changes: 6 additions & 0 deletions test/aegis/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
IMAGE_TAGS = {
'dev': 'fonalex45/aegis:dev',
'latest': 'dfonalex45/aegis:latest',
}

DEFAULT_DIRECTORIES = ['recon', 'exploit', 'www', 'privesc', 'report', 'loot']
32 changes: 32 additions & 0 deletions test/aegis/docker_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import docker
import os
from tqdm import tqdm


def pull_image(client, image_tag):
print(f"Pulling image: {image_tag}")
for line in client.api.pull(image_tag, stream=True, decode=True):
if 'status' in line:
print(line['status'])


def create_project_dir(project_name):
os.makedirs(project_name, exist_ok=True)
for folder in DEFAULT_DIRECTORIES:
os.makedirs(os.path.join(project_name, folder), exist_ok=True)
print(f"Project directories created under {project_name}.")


def run_container(client, image, project_dir, host_network):
container = client.containers.run(
image,
command='/bin/zsh',
volumes={os.path.abspath(project_dir): {
'bind': '/workspace', 'mode': 'rw'}},
network_mode='host' if host_network else None,
detach=True,
stdin_open=True,
tty=True
)
print(f"Container {container.short_id} started.")
return container
Empty file added test/aegis/utils.py
Empty file.
Empty file added test/requirements.txt
Empty file.
19 changes: 19 additions & 0 deletions test/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

from setuptools import setup, find_packages

setup(
name='aegis',
version='0.1.0',
packages=find_packages(),
install_requires=[
'docker==7.1.0',
'questionary==2.0.1',
'pycryptodome==3.21.0',
'fabric==3.2.2',
],
entry_points={
'console_scripts': [
'aegis = aegis.cli:main',
],
},
)
8 changes: 0 additions & 8 deletions wrapper/README.md

This file was deleted.

6 changes: 0 additions & 6 deletions wrapper/aegis/config.py

This file was deleted.

38 changes: 0 additions & 38 deletions wrapper/aegis/docker_utils.py

This file was deleted.

15 changes: 0 additions & 15 deletions wrapper/aegis/profiles.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions wrapper/requirements.txt

This file was deleted.

23 changes: 0 additions & 23 deletions wrapper/setup.py

This file was deleted.

0 comments on commit 29cf5a0

Please sign in to comment.