-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick_start.py
More file actions
93 lines (78 loc) · 3.12 KB
/
quick_start.py
File metadata and controls
93 lines (78 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env python3
"""
Quick start script for AWS Security Groups Analysis
This script provides a simple interface to run the analysis with different options
"""
import sys
import os
import subprocess
from pathlib import Path
def install_dependencies():
"""Install required Python packages"""
print("Installing dependencies...")
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
print("✅ Dependencies installed successfully!")
return True
except subprocess.CalledProcessError as e:
print(f"❌ Error installing dependencies: {e}")
return False
def run_analysis():
"""Run the security group analysis"""
print("Running security group analysis...")
try:
subprocess.check_call([sys.executable, "security_group_analyzer.py"])
print("✅ Analysis completed! Check the reports directory for CSV files.")
return True
except subprocess.CalledProcessError as e:
print(f"❌ Error running analysis: {e}")
return False
def launch_dashboard():
"""Launch the Streamlit dashboard"""
print("Launching interactive dashboard...")
try:
subprocess.check_call([sys.executable, "-m", "streamlit", "run", "dashboard.py"])
return True
except subprocess.CalledProcessError as e:
print(f"❌ Error launching dashboard: {e}")
return False
def main():
"""Main function to handle user choices"""
print("🔒 AWS Security Groups Traffic Analysis Tool")
print("=" * 50)
# Check if we're in the right directory
if not Path("security_group_analyzer.py").exists():
print("❌ Error: Please run this script from the project directory containing security_group_analyzer.py")
sys.exit(1)
while True:
print("\nSelect an option:")
print("1. Install/Update Dependencies")
print("2. Run Security Group Analysis (CLI)")
print("3. Launch Interactive Dashboard")
print("4. Run Analysis + Launch Dashboard")
print("5. Exit")
choice = input("\nEnter your choice (1-5): ").strip()
if choice == "1":
install_dependencies()
elif choice == "2":
if run_analysis():
print("\n📁 Reports have been generated in the 'reports' directory")
print("📊 You can now launch the dashboard to visualize the results")
elif choice == "3":
print("🌐 Dashboard will open in your default web browser")
print("🔄 Use Ctrl+C to stop the dashboard when finished")
launch_dashboard()
elif choice == "4":
if install_dependencies():
print("\n" + "="*50)
if run_analysis():
print("\n" + "="*50)
print("🌐 Now launching dashboard...")
launch_dashboard()
elif choice == "5":
print("👋 Goodbye!")
sys.exit(0)
else:
print("❌ Invalid choice. Please select 1-5.")
if __name__ == "__main__":
main()