Skip to content

Conversation

@ahmed734105204
Copy link
Owner

مشروع استخباراتي

@ahmed734105204
Copy link
Owner Author

file_0000000099ac61f797697ac93d003571-b1a450a4-fa55-4b0f-b3b4-38c26b63f399

@ahmed734105204
Copy link
Owner Author

ahmed734105204 commented Aug 4, 2025

ا// =============================================
// كود "مكان التعليمات" — نسخة عربية خفيفة ومباشرة
// — يجمع مصادر OSINT المرجعية تلقائياً (بدون إرسال تقرير تلقائي)
// — يصنع تقريراً نصياً فقط عند الطلب
// — يصدّر التقرير كملف TXT عند الطلب
// — أوامر جاهزة: ابدأ_التشغيل، أوقف_التشغيل، تقرير، تصدير، ضبط_النطاق، كلمات_مفتاحية
// =============================================
(function () {
// تعريب واجهة النظام (إن كان مدعوماً)
try { window.kimiLang = "ar"; } catch(e){}

// ---------- الإعدادات ----------
const STORAGE_PREFIX = "ai_intel_";
const AUTO_INTERVAL_MIN = 60; // عدد الدقائق بين كل جمع تلقائي عند التشغيل
const SOURCES = [
// مراجع عامة (لا يتم جلب محتوى منها هنا لتجنب القيود/الخصوصية)
"https://www.un.org",
"https://www.osce.org",
"https://www.cia.gov",
"https://www.gov.uk/government/organisations/mi6",
"https://worldview.stratfor.com",
// أمثلة محلية/اجتماعية (مراجع فقط)
"https://x.com/ (حسابات مفتوحة)",
"https://www.facebook.com/ (مجموعات عامة)"
];

// كلمات مفتاحية افتراضية للتصنيف النصي (يمكن تعديلها بأمر كلمات_مفتاحية)
let RISK_KEYWORDS = {
high: ["تفجير","مسلح","اغتيال","هجوم","قنبلة","تهديد جدي"],
medium: ["تحرك","رصد","مراقبة","تجمع","نقل غير اعتيادي"],
low: ["اجتماع","تصريح","زيارة","إعلان"]
};

// نطاق التقارير (افتراضي آخر 24 ساعة)
let rangeStart = () => new Date(Date.now() - 246060*1000);
let rangeEnd = () => new Date();

// حالة التشغيل التلقائي
let autoTimer = null;

// ---------- أدوات مساعدة ----------
function todayKey(d = new Date()){
return STORAGE_PREFIX + d.toISOString().split("T")[0];
}
function readDay(d){
const key = todayKey(d);
return JSON.parse(localStorage.getItem(key) || "[]");
}
function writeEvent(evt, d = new Date()){
const key = todayKey(d);
const arr = JSON.parse(localStorage.getItem(key) || "[]");
arr.push(evt);
localStorage.setItem(key, JSON.stringify(arr));
}
function *dateRange(start, end){
const d = new Date(start);
const e = new Date(end);
while (d <= e) { yield new Date(d); d.setDate(d.getDate()+1); }
}
function getByRange(start, end){
const out = [];
for (const d of dateRange(start, end)) out.push(...readDay(d));
return out;
}

// تصنيف خطورة بسيط بالاعتماد على الكلمات المفتاحية (تحليل نص المصدر كمرجع فقط)
function classify(text){
const has = (arr)=>arr.some(k=> text.includes(k));
if (has(RISK_KEYWORDS.high)) return "high";
if (has(RISK_KEYWORDS.medium)) return "medium";
return "low";
}

// ---------- الجمع التلقائي المرجعي (بدون جلب محتوى خارجي) ----------
async function collectOnce(){
const ts = new Date().toISOString();
// نسجل مرجعاً لكل مصدر كـ "تحديث" مرجعي لتحليله لاحقاً يدوياً إذا رغبت
for (const src of SOURCES) {
const risk = classify(src); // تصنيف تقريبي بالمرجع
writeEvent({
title: تحديث مصدر: ${src},
details: src,
risk,
location: null, // يمكن تزويده يدوياً لاحقاً
relations: [], // يمكن ربط أسماء/أرقام لاحقاً
timestamp: ts
});
}
console.log("✅ تم تسجيل تحديثات المراجع (OSINT refs) — لا يتم إرسال تقرير تلقائي.");
}

function startAuto(){
if (autoTimer) return console.log("ℹ️ التشغيل جارٍ بالفعل.");
collectOnce();
autoTimer = setInterval(collectOnce, AUTO_INTERVAL_MIN * 60 * 1000);
console.log("▶️ تم بدء التشغيل التلقائي لجمع المراجع كل", AUTO_INTERVAL_MIN, "دقيقة.");
}
function stopAuto(){
if (!autoTimer) return console.log("ℹ️ التشغيل غير مفعّل.");
clearInterval(autoTimer);
autoTimer = null;
console.log("⏹️ تم إيقاف التشغيل التلقائي.");
}

// ---------- أوامر إدخال يدوي للأحداث ----------
// يمكنك حقن حدث/معلومة يدوياً (مثلاً بعد تحقق بشري من مصدر)
function سجل_حدث({title, details="", risk="medium", relations=[], location=null}){
writeEvent({
title, details, risk,
relations: Array.isArray(relations) ? relations : [],
location: location && typeof location.lat==="number" && typeof location.lng==="number" ? location : null,
timestamp: new Date().toISOString()
});
console.log("📝 تم تسجيل الحدث:", title);
}

// ---------- بناء التقرير النصي ----------
function buildReport({keywords=[], startDate=rangeStart(), endDate=rangeEnd()} = {}){
const data = getByRange(startDate, endDate);
if (!data.length) return "⚠️ لا توجد بيانات في الفترة المحددة.";

// فلترة اختيارية بالكلمات
let filtered = data;
if (keywords.length){
  filtered = data.filter(d =>
    keywords.some(kw =>
      (d.title||"").includes(kw) ||
      (d.details||"").includes(kw) ||
      (Array.isArray(d.relations) ? d.relations.join(" ") : "").includes(kw)
    )
  );
  if (!filtered.length) return `⚠️ لا توجد أحداث مطابقة للكلمات: ${keywords.join(", ")}`;
}

const high   = filtered.filter(d=>d.risk==="high");
const medium = filtered.filter(d=>d.risk==="medium");
const low    = filtered.filter(d=>d.risk==="low");

const fmt = (d)=> (d||"").toString().trim();
const dd  = (loc)=> loc ? `${loc.lat}, ${loc.lng}` : "غير محدد";

let out = `📊 تقرير استخباراتي نصي\nالفترة: ${startDate.toISOString()} → ${endDate.toISOString()}`;
if (keywords.length) out += `\nفلترة: ${keywords.join(", ")}`;
out += `\n\n`;

if (high.length){
  out += "🔴 عالي الخطورة:\n";
  high.forEach((e,i)=>{
    out += `${i+1}. ${fmt(e.title)}\n   - تفاصيل: ${fmt(e.details)}\n   - علاقات: ${(e.relations||[]).join(", ")||"—"}\n   - موقع: ${dd(e.location)}\n   - وقت: ${e.timestamp}\n`;
  });
  out += "\n";
}
if (medium.length){
  out += "🟡 متوسط الخطورة:\n";
  medium.forEach((e,i)=>{
    out += `${i+1}. ${fmt(e.title)}\n   - تفاصيل: ${fmt(e.details)}\n   - علاقات: ${(e.relations||[]).join(", ")||"—"}\n   - موقع: ${dd(e.location)}\n   - وقت: ${e.timestamp}\n`;
  });
  out += "\n";
}
if (low.length){
  out += "🟢 منخفض الخطورة:\n";
  low.forEach((e,i)=>{
    out += `${i+1}. ${fmt(e.title)}\n   - تفاصيل: ${fmt(e.details)}\n   - علاقات: ${(e.relations||[]).join(", ")||"—"}\n   - موقع: ${dd(e.location)}\n   - وقت: ${e.timestamp}\n`;
  });
  out += "\n";
}

return out.trim();

}

// ---------- تصدير التقرير كملف نصي ----------
function exportTxt(options = {}){
const text = buildReport(options);
const blob = new Blob([text], {type: "text/plain"});
const a = document.createElement("a");
a.href = URL.createObjectURL(blob);
const stamp = new Date().toISOString().split("T")[0];
a.download = intel_report_${stamp}.txt;
a.click();
URL.revokeObjectURL(a.href);
console.log("📤 تم تصدير التقرير كملف نصي.");
}

// ---------- ضبط النطاق والكلمات ----------
function ضبط_النطاق({start, end} = {}){
try {
if (start) rangeStart = ()=> new Date(start);
if (end) rangeEnd = ()=> new Date(end);
console.log("⏱️ تم ضبط نطاق التقارير:", rangeStart().toISOString(), "→", rangeEnd().toISOString());
} catch {
console.log("⚠️ صيغة التاريخ غير صحيحة. استخدم ISO مثل: 2025-08-14T00:00:00Z");
}
}
function كلمات_مفتاحية(newMap){
if (!newMap || typeof newMap !== "object") return console.log("⚠️ أدخل كائناً بشكل {high:[..], medium:[..], low:[..]}");
["high","medium","low"].forEach(level=>{
if (Array.isArray(newMap[level])) RISK_KEYWORDS[level] = newMap[level];
});
console.log("✅ تم تحديث الكلمات المفتاحية:", RISK_KEYWORDS);
}

// ---------- أوامر عامة (تُستدعى من الدردشة/الكونسول) ----------
window.ابدأ_التشغيل = startAuto;
window.أوقف_التشغيل = stopAuto;
window.تقرير = (opts)=> console.log(buildReport(opts||{}));
window.تصدير = (opts)=> exportTxt(opts||{});
window.سجل_حدث = سجل_حدث;
window.ضبط_النطاق = ضبط_النطاق;
window.كلمات_مفتاحية = كلمات_مفتاحية;

// رسالة مساعدة سريعة
console.log(
"✅ الكود جاهز.\n" +
"أوامر متاحة:\n" +
" - ابدأ_التشغيل() → تشغيل الجمع المرجعي تلقائياً كل 60 دقيقة (بدون تقارير تلقائية)\n" +
" - أوقف_التشغيل() → إيقاف الجمع التلقائي\n" +
" - تقرير({keywords:[..], startDate:new Date('..'), endDate:new Date('..')})\n" +
" - تصدير({..نفس خيارات تقرير..}) → تنزيل TXT\n" +
" - سجل_حدث({title, details, risk:'high|medium|low', relations:['اسم'], location:{lat,lng}})\n" +
" - ضبط_النطاق({start:'ISO', end:'ISO'})\n" +
" - كلمات_مفتاحية({high:[..], medium:[..], low:[..]})"
);
})();

@ahmed734105204 ahmed734105204 added this to the gh pr checkout 4 milestone Aug 15, 2025
This was linked to issues Aug 15, 2025
@ahmed734105204 ahmed734105204 self-assigned this Aug 15, 2025
@ahmed734105204 ahmed734105204 added help wanted Extra attention is needed احمد استخبارات القامع استخباراتي bug Something isn't working documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers wontfix This will not be worked on labels Aug 15, 2025
Copy link
Owner Author

@ahmed734105204 ahmed734105204 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gh pr checkout 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed wontfix This will not be worked on احمد استخبارات القامع استخباراتي

Projects

None yet

Development

Successfully merging this pull request may close these issues.

تعريب اضافه

1 participant