-
Notifications
You must be signed in to change notification settings - Fork 0
/
usb.js
50 lines (44 loc) · 1.25 KB
/
usb.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
/**
* This program aim to detect if the right USB key has been inserted in the first part of the escape game
*/
var usbDetect = require('usb-detection');
var figlet = require('figlet');
var loadingbar = require('./utils/loading');
const { printLogo, printSkull } = require('./utils/assets');
const { textSync } = require('figlet');
// Consts to identify the right usb device
const VENDORID = 8644;
const PRODUCTID = 43064;
// Detecting new USB device
usbDetect.startMonitoring();
// Detect add/insert usb keys
usbDetect.on('add', function (device) {
if (device.vendorId == VENDORID && device.productId == PRODUCTID) {
success();
} else {
fail();
}
});
// Display styyyyyled things
printLogo();
console.log(figlet.textSync('Malware loading Astus\'s software'));
console.log('Pls insert the usb key...');
/**
* If the right key is plugged in
*/
function success() {
console.log('Malware detected successfully');
var bar = new loadingbar(50, '==', '--', 100, 'Loading the malware', () => {
console.log(figlet.textSync('Successfully loaded'));
usbDetect.stopMonitoring();
});
bar.start();
}
/**
* If a wrong key is plugged in
*/
function fail() {
console.log('Failed, no malware detected');
printSkull();
console.log('Try again');
}