-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·73 lines (60 loc) · 2.76 KB
/
setup.py
File metadata and controls
executable file
·73 lines (60 loc) · 2.76 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
import os
import sys
import subprocess
import platform
import random
import string
import shutil
def generate_password(length=12):
characters = string.ascii_letters + string.digits + string.punctuation
return ''.join(random.choice(characters) for _ in range(length))
def check_wsl_support():
if platform.system() != 'Windows':
return False
try:
result = subprocess.run(['wsl', '--status'], capture_output=True, text=True)
return result.returncode == 0
except FileNotFoundError:
return False
def setup_project():
print("🚀 Starting project setup...")
# Step 1: Install npm dependencies
print("\n📦 Installing npm dependencies...")
subprocess.run(['npm', 'install'], check=True)
# Step 2: Install Python dependencies
print("\n📦 Installing Python dependencies...")
subprocess.run([sys.executable, '-m', 'pip', 'install', '-r', 'backend/requirements.txt'], check=True)
# Step 3: Check and setup WSL
print("\n🐧 Checking WSL support...")
if check_wsl_support():
print("WSL is supported on your system!")
try:
# Check if Kali Linux is installed
result = subprocess.run(['wsl', '-l', '-v'], capture_output=True, text=True)
if 'kali-linux' not in result.stdout.lower():
print("Installing Kali Linux...")
subprocess.run(['wsl', '--install', '-d', 'kali-linux'], check=True)
# Create honeypot user
password = generate_password()
print(f"\n🔑 Generated password for honeypot user: {password}")
# Create .env file from example
if os.path.exists('backend/.env.example'):
shutil.copy('backend/.env.example', 'backend/.env')
with open('backend/.env', 'a') as f:
f.write(f'\nWSL_PASSWORD={password}\n')
print("\n📄 Created .env file with WSL password")
except subprocess.CalledProcessError as e:
print(f"Error setting up WSL: {e}")
else:
print("⚠️ WSL is not supported on your system. Some features may not work.")
# Step 4: Instructions for API setup
print("\n🔑 Important Setup Steps:")
print("\n1. Please register for Google App Password at:")
print(" https://support.google.com/accounts/answer/185833?hl=en")
print(" After getting the password, add it to backend/.env as GMAIL_PASSWORD")
print("\n2. Register for AbuseIPDB API at:")
print(" https://www.abuseipdb.com/")
print(" After getting the API key, add it to backend/.env as ABUSEIPDB_API_KEY")
print("\n✅ Setup complete! You can now run the project using run.py")
if __name__ == "__main__":
setup_project()