// 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 = /