-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.js
More file actions
36 lines (31 loc) · 1.02 KB
/
Copy pathExample.js
File metadata and controls
36 lines (31 loc) · 1.02 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
const { execSync } = require('child_process')
/**
* Run Shell Command And Return Output
* Params: CommandString
*/
function runShellCommand(commandString) {
try {
const outputBuffer = execSync(commandString, { encoding: 'utf8' })
return outputBuffer.trim()
} catch (error) {
return 'Command Failed'
}
}
/**
* Main Execution Example
*/
function mainExample() {
const plainText = 'Hello Enigma - by NeaByteLab'
const password = 'SuperSecret'
const stealthMode = true
console.log('Original Text:', plainText)
// Encrypt
const encryptCommand = `node Enigma-Cipher.js encrypt "${plainText}" --pass ${password} ${stealthMode ? '--stealth' : ''}`
const encryptedText = runShellCommand(encryptCommand)
console.log('Encrypted Text:', encryptedText)
// Decrypt
const decryptCommand = `node Enigma-Cipher.js decrypt "${encryptedText}" --pass ${password} ${stealthMode ? '--stealth' : ''}`
const decryptedText = runShellCommand(decryptCommand)
console.log('Decrypted Text:', decryptedText)
}
mainExample()