فحص

// name: detect-wp-plugins.js
// التشغيل: node detect-wp-plugins.js https://example.com/
import fetch from ‘node-fetch’;

const url = process.argv[2];
if (!url) {
console.log(‘الاستخدام: node detect-wp-plugins.js https://example.com/’);
process.exit(1);
}

function extractPlugins(text) {
const re = /wp-content\/plugins\/([^\/\s”‘<>&]+)/ig;
const set = new Set();
let m;
while ((m = re.exec(text)) !== null) {
set.add(m[1]);
}
return Array.from(set).sort();
}

try {
const resp = await fetch(url, { headers: { ‘User-Agent’: ‘WP-Plugin-Detector/1.0’ } });
const html = await resp.text();

// نجمع روابط محتملة من الوسوم الأساسية عبر regex بسيط
const assets = [];
const linkRe = /]+href=”‘[“‘]/ig;
const scriptRe = /]+src=”‘[“‘]/ig;
const imgRe = /]+src=”‘[“‘]/ig;
let m;

[linkRe, scriptRe, imgRe].forEach(re => {
while ((m = re.exec(html)) !== null) assets.push(m[1]);
});

const combined = html + ‘\n’ + assets.join(‘\n’);
const plugins = extractPlugins(combined);

if (plugins.length) {
console.log(‘الإضافات المكتشفة:’);
plugins.forEach(p => console.log(‘- ‘ + p));
} else {
console.log(‘لم يتم اكتشاف أي إضافات من كود المصدر.’);
}
} catch (e) {
console.error(‘تعذر الفحص:’, e);
process.exit(1);

Scroll to Top