File size: 3,452 Bytes
23804b3 |
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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
#!/bin/bash
# Cyber-LLM Project Setup Script
# Author: Muzan Sano
# Email: [email protected]
set -e
echo "π Setting up Cyber-LLM project..."
# Check Python version
python_version=$(python3 --version 2>&1 | cut -d' ' -f2)
echo "π Python version: $python_version"
# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
echo "π¦ Creating virtual environment..."
python3 -m venv venv
fi
# Activate virtual environment
echo "π Activating virtual environment..."
source venv/bin/activate
# Upgrade pip
echo "β¬οΈ Upgrading pip..."
pip install --upgrade pip
# Install requirements
echo "π Installing requirements..."
pip install -r requirements.txt
# Create necessary directories
echo "π Creating project directories..."
mkdir -p logs
mkdir -p outputs
mkdir -p models
chmod +x src/deployment/cli/cyber_cli.py
# Set up DVC (if available)
if command -v dvc &> /dev/null; then
echo "π Initializing DVC..."
dvc init --no-scm 2>/dev/null || echo "DVC already initialized"
fi
# Set up pre-commit hooks (if available)
if command -v pre-commit &> /dev/null; then
echo "π§ Setting up pre-commit hooks..."
pre-commit install 2>/dev/null || echo "Pre-commit hooks setup skipped"
fi
# Download sample data (placeholder)
echo "π₯ Setting up sample data..."
mkdir -p src/data/raw/samples
echo "Sample cybersecurity dataset placeholder" > src/data/raw/samples/sample.txt
# Create initial configuration files
echo "βοΈ Creating configuration files..."
cat > configs/training_config.yaml << 'EOF'
# Training Configuration for Cyber-LLM
model:
base_model: "microsoft/Phi-3-mini-4k-instruct"
max_length: 2048
lora:
r: 16
lora_alpha: 32
lora_dropout: 0.1
training:
batch_size: 4
learning_rate: 2e-4
num_epochs: 3
mlops:
use_wandb: false
use_mlflow: false
experiment_name: "cyber-llm-local"
EOF
# Run initial tests
echo "π§ͺ Running initial tests..."
python -c "
import sys
print('β
Python import test passed')
try:
import torch
print(f'β
PyTorch {torch.__version__} available')
print(f' CUDA available: {torch.cuda.is_available()}')
except ImportError:
print('β οΈ PyTorch not available - install manually if needed')
try:
import transformers
print(f'β
Transformers {transformers.__version__} available')
except ImportError:
print('β οΈ Transformers not available - install manually if needed')
"
# Create sample workflow
echo "π Creating sample workflow files..."
mkdir -p src/orchestration/workflows
cat > src/orchestration/workflows/basic_red_team.yaml << 'EOF'
name: "Basic Red Team Assessment"
description: "Standard red team workflow"
phases:
- name: "reconnaissance"
agents: ["recon"]
parallel: false
safety_check: true
human_approval: true
- name: "initial_access"
agents: ["c2"]
parallel: false
safety_check: true
human_approval: true
depends_on: ["reconnaissance"]
EOF
echo ""
echo "β
Cyber-LLM setup completed successfully!"
echo ""
echo "π Next steps:"
echo " 1. Activate virtual environment: source venv/bin/activate"
echo " 2. Run CLI: python src/deployment/cli/cyber_cli.py --help"
echo " 3. Train adapters: python src/training/train.py --help"
echo " 4. Check README.md for detailed instructions"
echo ""
echo "π For red team operations, ensure you have proper authorization!"
echo "π§ Questions? Contact: [email protected]"
echo ""
|