-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcli.js
66 lines (48 loc) · 1.46 KB
/
cli.js
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
//import important packages
const chalk = require('chalk');
const clear = require('clear');
const figlet = require('figlet');
const chaklani = require('chalk-animation');
// import libs files here
const files = require('./libs/files');
const inquirer = require('./libs/inquirer');
clear();
console.log(
chalk.blue.bold(
figlet.textSync('Packet Sniffer', { horizontalLayout: 'full' })
)
);
const run = async () => {
const credentials = await inquirer.askSniffCredentials();
console.log(credentials);
if(credentials['method']=='TCP'){
var spawn = require('child_process').spawn;
const py = spawn('python3', ['./Python/TCP.py']);
py.stdout.on('data' , data =>{
console.log(data.toString());
});
}
else if(credentials['method']=='UDP'){
var spawn = require('child_process').spawn;
const py = spawn('python3', ['./Python/UDP.py']);
py.stdout.on('data' , data =>{
console.log(data.toString());
});
}
else if(credentials['method']=='ICMP'){
var spawn = require('child_process').spawn;
const py = spawn('python3', ['./Python/ICMP.py']);
py.stdout.on('data' , data =>{
console.log(data.toString());
});
}
else if(credentials['method']=='Final'){
var spawn = require('child_process').spawn;
const py = spawn('python3', ['./Python/Final.py']);
console.log(py.spawnargs);
py.stdout.on('data' , data =>{
console.log(data.toString());
});
}
};
run();