-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·76 lines (59 loc) · 2.29 KB
/
Copy pathindex.js
File metadata and controls
executable file
·76 lines (59 loc) · 2.29 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
68
69
70
71
72
73
74
75
76
#!/usr/bin/env node
'use strict'
const debug = require('debug')('kickthemout:flow')
const chalk = require('chalk')
const Spinner = require('cli-spinner').Spinner
const { checkForUpdate, isRoot, printLogoAndCredits } = require('./lib/utility')
const Attack = require('./lib/Attack')
const Network = require('./lib/Network')
const Inquiries = require('./lib/Inquiries')
debug('Debug enabled.')
const network = new Network()
const ask = new Inquiries()
async function main () {
debug('Printing logo and credits')
console.log(await printLogoAndCredits())
// root permission required
if (!isRoot()) throw new Error('root permission required')
console.log(chalk.green(' ✓ Running as', chalk.bold('root')))
debug('Checks for available update..')
await checkForUpdate()
// starting questions
await ask.whatToDo()
// get Interfaces
const ifaces = await network.getInterfaces()
// select Interface
const iface = await ask.selectInterface(ifaces)
network.selectInterface(iface)
// host discovery
const myIP = iface.ip_address
const spinner = new Spinner(' Scanning LAN.. %s')
spinner.setSpinnerString('|/-\\')
spinner.start()
const hosts = await network.scan(myIP)
debug('hosts found:', hosts)
if (!hosts.length) throw new Error('No hosts found!')
spinner.stop()
// adding iface mac (if found)
const gateway = hosts.find((host) => host.ip === iface.gateway_ip)
network.iface.gateway_mac_address = gateway ? gateway.mac : 'Not found'
// removing ourself and the iface ip from targetHosts.
network.hosts = network.hosts.filter((host) => host.ip !== myIP && host.ip !== iface.gateway_ip)
// getting target hosts' vendors (new prop. vendor)
network.resolveVendors()
console.log(chalk.blue(chalk.green('\n ✓'), 'Gateway', chalk.yellow(network.iface.gateway_ip), 'has', chalk.green(network.hosts.length), 'hosts up\n'))
// attack options
const targets = await ask.attackOption(network.hosts)
// starting attack
const attack = new Attack()
attack.setInterface(network.iface)
.setTarget(targets)
.start()
console.log(chalk.green(' ✓'), chalk.blue('Attack running...'))
await ask.nextStep(attack, 'pause')
}
main().catch((err) => {
console.log(chalk.red('Error: ' + (err && (err.message || err))))
debug('Fatal error:', err)
process.exit(1)
})