further mods

This commit is contained in:
Martin Donnelly 2024-02-15 22:36:28 +00:00
parent 0a53f82c23
commit ecc5d3f5c7
4 changed files with 2143 additions and 5 deletions

5
lib/cli.js Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env node
const password = require('./index');
console.log(password.generate());

92
lib/index.js Executable file
View File

@ -0,0 +1,92 @@
const { pwStrength } = require('pw-strength');
const PBrute = require('pbrute');
const pbrute = new PBrute();
Array.prototype.random = function () {
return this[Math.floor((Math.random() * this.length))];
};
const alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
const whitespace = ['.', '~', '#', '!', '$', '+', '-', '+'];
const numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'C', 'X', 'V', 'F', 'Q', 'Z', 'N'];
const left = ['Alabama', 'Alaska', 'Arizona', 'Maryland', 'Nevada', 'Mexico', 'Texas', 'Utah', 'Glasgow', 'Inverness', 'Edinburgh', 'Dumbarton',
'Balloch', 'Renton', 'Cardross', 'Dundee', 'Paisley',
'Hamilton', 'Greenock', 'Falkirk',
'Irvine',
'Renfrew',
'Erskine',
'London',
'Hammersmith',
'Islington',
'Silver', 'Black', 'Yellow', 'Purple', 'White', 'Pink', 'Red', 'Orange', 'Brown', 'Green', 'Blue', 'Amber', 'Aqua',
'Azure', 'Bronze', 'Coral', 'Copper', 'Crimson', 'Cyan', 'Ginger', 'Gold', 'Indigo', 'Jade', 'Ruby', 'Cedar', 'Cream', 'Peach', 'Sepcia',
'Mercyful', 'Cyber', 'Ultra', 'Hunter', 'Electric', 'Steel', 'Fire', 'Smoke', 'Thunder', 'Pewter', 'Stone', 'Iron', 'Shadow', 'Grey', 'Mocha',
'Wood', 'Space', 'Manic', 'Grunt', 'X-Ray', 'Sabbra', 'Atomic', 'Swordfish', 'Dance', 'Tank',
'Lazy', 'Glorious',
'Abstract', 'Abyssal', 'Airborne', 'Ancestral', 'Blazing', 'Bright', 'Burning', 'Colourless',
'Crystal', 'Deadly', 'Exhausted', 'Favourite', 'Final', 'Floating', 'Flying', 'Frozen',
'Geometric', 'Gravity', 'Halcyon', 'Hyper', 'Infinite', 'Inspiring', 'Limitless', 'Lucent',
'Luminous', 'Magnificent', 'Parallax', 'Prime', 'Radiant', 'Raging', 'Rebuilt', 'Reckless',
'Relentless', 'Ruthless', 'Second', 'Serene', 'Shimmering', 'Soaring', 'Speedy', 'Stellar',
'Swift', 'Timeless', 'Towering', 'Tranquil', 'Ultimate', 'Visionary', 'Whispering', 'Winged'
];
const right = ['Aganju', 'Cygni', 'Akeron', 'Antares', 'Aragoth', 'Ardus', 'Carpenter', 'Cooper', 'Dahin', 'Capella', 'Endriago', 'Gallina',
'Fenris', 'Freya', 'Glenn', 'Grissom', 'Jotunheim', 'Lagarto', 'Primus', 'Vega', 'Ragnarok', 'Shepard',
'Slayton', 'Tarsis', 'Mercury', 'Venus', 'Mars', 'Earth', 'Terra', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto', 'Europa', 'Ganymede',
'Callisto', 'Titan', 'Juno', 'Eridanus', 'Scorpius', 'Crux', 'Cancer', 'Taurus', 'Lyra', 'Andromeda', 'Virgo', 'Aquarius', 'Cygnus', 'Corvus',
'Taurus', 'Draco', 'Perseus', 'Pegasus', 'Gemini', 'Columbia', 'Bootes', 'Orion', 'Deneb', 'Merope', 'Agate', 'Amber', 'Beryl', 'Calcite',
'Citrine', 'Coral', 'Diamond', 'Emerald', 'Garnet', 'Jade', 'Lapis', 'Moonstone', 'Obsidian', 'Onyx', 'Opal', 'Pearl', 'Quartz', 'Ruby',
'Sapphire', 'Topaz', 'Iron', 'Lead', 'Nickel', 'Copper', 'Zinc', 'Tin', 'Manes', 'Argon', 'Neon', 'Alpha', 'Bravo', 'Charlie', 'Delta',
'Echo', 'Foxtrot', 'Golf', 'Hotel', 'India', 'Juliett', 'Kilo', 'Lima', 'Mike', 'November', 'Oscar', 'Papa', 'Quebec', 'Romeo', 'Sierra',
'Tango', 'Uniform', 'Victor', 'Whisky', 'Xray', 'Yankee', 'Zulu', 'Fate', 'Miner', 'Blaster', 'Click', 'Noise', 'Cadabra', 'Shotgun',
'Swordfish', 'Dancer', 'Dragon', 'Lotus', 'Storm',
'Songbird', 'Purpose',
'Aegis', 'Anvil', 'Ashes', 'Bard', 'Breath', 'Claws', 'Departure', 'Eagle', 'Falcon', 'Focus',
'Forge', 'Hammer', 'Hand', 'Hawk', 'Marvel', 'Master', 'Mirror', 'Nemesis', 'Omen', 'Pillar',
'Pride', 'Prophecy', 'Reflection', 'Shield', 'Skylark', 'Spear', 'Sword', 'Talon', 'Triumph',
'Victory', 'Vision'
];
const numberCluster = function () {
return numbers.random() + numbers.random() + numbers.random();
};
const randomAmount = function (i) {
let str = '';
for (let t = 0; t < i; t++)
str = str + alpha.random();
return str;
};
module.exports = {
generate() {
// const ws = whitespace.random();
const ws = '.';
const reply = {
'long': (`${left.random()} ${right.random()} ${numberCluster()}`).split(' ').join(ws),
'short': `${randomAmount(5)}.${randomAmount(5)}`
};
reply.longLength = reply.long.length;
reply.longScore = pwStrength(reply.long);
reply.shortScore = pwStrength(reply.short);
reply.pbrute = pbrute.calculate(reply.long);
reply.messages = reply.pbrute.messages;
return reply;
}
};

2033
package-lock.json generated Executable file

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,22 @@
{
"name": "password",
"version": "1.0.0",
"version": "1.0.4",
"description": "",
"bin": {
"password": "./cli.js"
"new-password": "./lib/cli.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"version:bump": "npm version patch --no-git-tag-version --silent",
"version:extract": "cat package.json | grep version | head -1 | awk -F: '{ print $2 }'",
"newPassword":"node ./lib/cli.js"
},
"author": "",
"license": "ISC"
"license": "ISC",
"dependencies": {
"pbrute": "^0.3.0",
"pw-strength": "^1.0.3"
},
"devDependencies": {
"eslint": "^7.7.0"
}
}