-
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.
- Loading branch information
Showing
7 changed files
with
156 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Aegis | ||
|
||
A Python wrapper/TUI to manage Docker containers for the Aegis project. | ||
|
||
## Installation | ||
|
||
```bash | ||
pip install . |
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 @@ | ||
__version__ = "0.1.0" |
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,100 @@ | ||
import os | ||
from tqdm import tqdm | ||
import questionary | ||
import docker | ||
import sys | ||
from . import aegis_cli # Assuming aegis_cli is the main CLI handler | ||
|
||
|
||
def main(): | ||
aegis_cli.run() | ||
|
||
|
||
IMAGE_DEV = "fonalex45/aegis:dev" | ||
IMAGE_LATEST = "dfonalex45/aegis:latest" | ||
|
||
client = docker.from_env() | ||
|
||
|
||
def create_project_directory(base_dir): | ||
folders = ["recon", "exploit", "www", "privesc", "report", "loot"] | ||
os.makedirs(base_dir, exist_ok=True) | ||
for folder in folders: | ||
os.makedirs(os.path.join(base_dir, folder), exist_ok=True) | ||
print(f"Project directory created at {base_dir}") | ||
|
||
|
||
def pull_images(): | ||
for image in [IMAGE_DEV, IMAGE_LATEST]: | ||
print(f"Pulling {image}...") | ||
client.images.pull(image) | ||
print("Images pulled successfully.") | ||
|
||
|
||
def start_container(image, use_host_network, project_dir): | ||
volumes = {project_dir: {'bind': '/workspace', 'mode': 'rw'}} | ||
networking = 'host' if use_host_network else None | ||
container = client.containers.run( | ||
image, | ||
network_mode=networking, | ||
volumes=volumes, | ||
detach=True | ||
) | ||
print(f"Container started: {container.id}") | ||
|
||
|
||
def stop_container(container_id): | ||
container = client.containers.get(container_id) | ||
container.stop() | ||
print(f"Container {container_id} stopped.") | ||
|
||
|
||
def destroy_container(container_id): | ||
container = client.containers.get(container_id) | ||
container.remove(force=True) | ||
print(f"Container {container_id} destroyed.") | ||
|
||
|
||
def main(): | ||
action = questionary.select( | ||
"What do you want to do?", | ||
choices=["Pull Images", "Start Container", "Stop Container", | ||
"Destroy Container", "Create Project Directory", "Help"] | ||
).ask() | ||
|
||
if action == "Pull Images": | ||
pull_images() | ||
elif action == "Start Container": | ||
image = questionary.select("Select an image", choices=[ | ||
IMAGE_DEV, IMAGE_LATEST]).ask() | ||
use_host_network = questionary.confirm("Enable host networking?").ask() | ||
project_dir = questionary.text( | ||
"Enter the project directory path:").ask() | ||
create_project_directory(project_dir) | ||
start_container(image, use_host_network, project_dir) | ||
elif action == "Stop Container": | ||
container_id = questionary.text( | ||
"Enter the container ID to stop:").ask() | ||
stop_container(container_id) | ||
elif action == "Destroy Container": | ||
container_id = questionary.text( | ||
"Enter the container ID to destroy:").ask() | ||
destroy_container(container_id) | ||
elif action == "Create Project Directory": | ||
project_dir = questionary.text( | ||
"Enter the project directory path:").ask() | ||
create_project_directory(project_dir) | ||
elif action == "Help": | ||
print(""" | ||
aegis commands: | ||
pull - Pull the latest images | ||
start - Start a container | ||
stop - Stop a container | ||
destroy - Destroy a container | ||
create-project - Create project directory | ||
help - Show this help menu | ||
""") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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,7 @@ | ||
docker==7.1.0 | ||
tqdm==4.67.0 | ||
questionary==2.0.1 | ||
pycrypto==2.6.1 | ||
fabric==3.2.2 | ||
paramiko==3.5.0 | ||
paramiko-jump==0.1.3 |
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,34 @@ | ||
|
||
from setuptools import setup, find_packages | ||
|
||
setup( | ||
name="aegis", | ||
version="0.1.0", | ||
packages=find_packages(), | ||
install_requires=[ | ||
"docker==7.1.0", | ||
"tqdm==4.67.0", | ||
"questionary==2.0.1", | ||
"pycrypto==2.6.1", | ||
"fabric==3.2.2", | ||
"paramiko==3.5.0", | ||
"paramiko-jump==0.1.3" | ||
], | ||
entry_points={ | ||
"console_scripts": [ | ||
"aegis=aegis.main:main" | ||
] | ||
}, | ||
author="Sean Fontaine", | ||
author_email="[email protected]", | ||
description="A Docker wrapper/TUI for managing aegis containers", | ||
long_description=open("README.md").read(), | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/alexrf45/aegis.git", | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
], | ||
python_requires=">=3.6", | ||
) |
This file was deleted.
Oops, something went wrong.
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