-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
48 lines (38 loc) · 1.54 KB
/
index.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
const RandomString = require("randomstring") //Dependencies npm i randomstring
const Fs = require("fs")
const Self_Args = process.argv.slice(2) //Variables
//Main beguns
if(!Self_Args.length){
console.log("node index.js <length> <quantity> <filename>")
return
}
if(isNaN(Self_Args[0])){
console.log("length is not a number.")
return
}
if(isNaN(Self_Args[1])){
console.log("amount is not a number.")
return
}
if(!Self_Args[2]){
console.log("output is invalid.")
return
}
var passwords = []
console.log("\t\=========================================================\n")
// console.log("\t \n")
console.log("\t -----| Indestructible Password Generator |----- \n")
// console.log("\t \n")
console.log("\t=========================================================\n")
console.log("\t \n")
console.log("\t******** Generating passwords Processing *******\n")
for( let i = 0; i <= Self_Args[1]; i++){
passwords.push(RandomString.generate({
charset: "ABCDEFGHIJKLMNOPQRSTUVWXYZ_+)(*&^%$#@!}{;/.?><|0123456789",
length: Self_Args[0]
}))
}
console.log(" ******** Done Your Indestructible Password is Generated ******* \n")
console.log(`Saving your Indestructible Generated Passwords to ${Self_Args[2]}`)
Fs.writeFileSync(Self_Args[2], passwords.join("\n"), "utf8")
console.log(`Your Generated passwords has been saved to ${Self_Args[2]}`)