feat: complete all SecOps tasks with full content

هذا الالتزام موجود في:
AbdulRhmanAbdulGhaffar
2026-07-27 14:53:15 +03:00
الأصل 582bf1214d
التزام f113a14171
16 ملفات معدلة مع 213 إضافات و0 حذوفات

عرض الملف

@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<title>Ghaymah SIEM Console</title>
<style>
body { background-color: #0f172a; color: #f8fafc; font-family: monospace; padding: 20px; }
.alert-box { background-color: #991b1b; padding: 15px; border-radius: 5px; margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { border: 1px solid #334155; padding: 10px; text-align: right; }
th { background-color: #1e293b; }
</style>
</head>
<body>
<h2>نظام مراقبة الأحداث الأمنية - Ghaymah SIEM</h2>
<div class="alert-box">
<strong>[تنبيه حرِج]:</strong> تم كشف محاولات اختراق نشطة على الـ API الخاص بتسجيل الدخول.
</div>
<h3>عناوين IP المشبوهة</h3>
<table>
<tr>
<th>عنوان IP</th>
<th>نوع التهديد</th>
<th>العدد</th>
<th>الإجراء</th>
</tr>
<tr>
<td>192.168.1.45</td>
<td>Brute Force / API</td>
<td>18 محاولة</td>
<td><b style="color: #ef4444;">مستبعد تلقائياً</b></td>
</tr>
</table>
</body>
</html>

عرض الملف

@@ -0,0 +1,24 @@
import re
from collections import defaultdict
LOG_FILE = "ghaymah_access.log"
FAILED_THRESHOLD = 5
ip_failures = defaultdict(int)
log_pattern = re.compile(r'(?P<ip>\d+\.\d+\.\d+\.\d+) - - \[.*?\] "(?P<method>\w+) (?P<path>\S+) HTTP/.*?" (?P<status>\d{3})')
try:
with open(LOG_FILE, 'r') as f:
for line in f:
match = log_pattern.search(line)
if match:
data = match.groupdict()
if data['status'] == '401' and '/login' in data['path']:
ip_failures[data['ip']] += 1
if ip_failures[data['ip']] >= FAILED_THRESHOLD:
print(f"[ALERT] High Brute Force Risk: {data['ip']} ({ip_failures[data['ip']]} failed attempts)")
if "select" in data['path'].lower() or "union" in data['path'].lower():
print(f"[CRITICAL] Potential SQL Injection from {data['ip']}: {data['path']}")
except FileNotFoundError:
print(f"Log file {LOG_FILE} not found. Ready for deployment.")

عرض الملف

@@ -0,0 +1,5 @@
# طريقة النشر على Ghaymah Block Storage
1. إنشاء **Ghaymah Block Storage Volume** بمساحة مناسبة لجمع الـ Logs.
2. عمل `Mount` للـ Volume داخل المسار `/var/log/siem_logs` في سيرفر التحليل.
3. إعداد أداة `logrotate` لضمان ضغط السجلات وتفريغ المساحة بشكل دائم بدون التأثير على أداء الـ I/O.