commit a28f51b1c186073a73219700410cb6acf33f4215 Author: Nikiroy78 <35032449+Nikiroy78@users.noreply.github.com> Date: Sun Oct 15 03:14:48 2023 +0300 Add files via upload diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..9dc2160 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,74 @@ +{ + "name": "password-manager", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "crypto": "^1.0.1", + "prompt-sync": "^4.2.0" + } + }, + "node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "engines": { + "node": ">=6" + } + }, + "node_modules/crypto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", + "integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==", + "deprecated": "This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in." + }, + "node_modules/prompt-sync": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/prompt-sync/-/prompt-sync-4.2.0.tgz", + "integrity": "sha512-BuEzzc5zptP5LsgV5MZETjDaKSWfchl5U9Luiu8SKp7iZWD5tZalOxvNcZRwv+d2phNFr8xlbxmFNcRKfJOzJw==", + "dependencies": { + "strip-ansi": "^5.0.0" + } + }, + "node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + } + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==" + }, + "crypto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", + "integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==" + }, + "prompt-sync": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/prompt-sync/-/prompt-sync-4.2.0.tgz", + "integrity": "sha512-BuEzzc5zptP5LsgV5MZETjDaKSWfchl5U9Luiu8SKp7iZWD5tZalOxvNcZRwv+d2phNFr8xlbxmFNcRKfJOzJw==", + "requires": { + "strip-ansi": "^5.0.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..54279e7 --- /dev/null +++ b/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "crypto": "^1.0.1", + "prompt-sync": "^4.2.0" + } +} diff --git a/password-manager.js b/password-manager.js new file mode 100644 index 0000000..c25b206 --- /dev/null +++ b/password-manager.js @@ -0,0 +1,32 @@ +const crypto = require("crypto"); +const sha1 = crypto.createHash("sha1"); +const prompt = require("prompt-sync")({ sigint: true }); + +const keyword = prompt("Введите ключевое слово: "); +console.log("-".repeat(16)); +console.log("Предпочтительные идентификаторы для сервисов"); +console.log( + Object.entries({ + vk: "ВКонтакте", + facebook: "Facebook", + ok: "Одноклассники", + }) + .map( + ([serviveId, serviceDescription]) => + `${serviveId} | ${serviceDescription}`, + ) + .join("\n"), +); +console.log("-".repeat(16)); +console.log( + "Рекомендуется вводить только доменное имя неизвестного сервиса например для EXAMPLE ORG: (example.org)", +); +console.log("-".repeat(16)); +const service = prompt("Введите сервис: ").toLowerCase(); +const login = prompt("Введите логин: ").toLowerCase(); + +const password = (() => { + sha1.update(`${keyword}::${service}::${login}`); + return sha1.digest("base64") + "#"; +})(); +console.log(`Ваш пароль: ${password}`); \ No newline at end of file