PM2 command to run ecosystem file

Once the file is properly configured in JSON format, run this command: pm2 start ecosystem.json The output should be similar to this: [PM2] Applying action restartProcessId on app [x509](ids: [ 0 ]) [PM2] [x509](0) ✓ ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user …

SCRYPT demo in Node.JS v15

SCRYPT is yet another password-based key derivation function that allows you to tweak its arguments in order to discourage brute-force attacks. Basically you can adjust the options to make it slower, and therefore brute-force attacks will need more time to be performed. Here is an example of how to use SCRYPT to generate keys and IVs to use with all …

Password Based Key Derivation Function 2 (PBKDF2) demo in Node.JS v15

A quick demo on how to use Password Based Key Derivation Function 2 (PBKDF2) to generate keys and IVs to use with all different ciphers available in Node.JS v15.x. const crypto = require(‘crypto’); const PASSWORD = “My_Secret_Password”; // Could be the password/key used to encrypt a message const ITERATIONS = 10; const DIGEST = “sha256”; crypto.getCiphers().forEach(cipher => { let cipherInfo …

Node.JS Ciphers Info in version 15.x

After the deprecation of methods createCipher(…) and createDecipher(…) due to the introduction of createCipheriv(…) and createDecipheriv(…) a lot of us had issues when specifying the keys and IVs because sometimes the key would be the incorrect size and same for the IVs. I developed a kind of brute force tester to determine the correct values and keep them in a …

How to install Visual Studio Code in Raspbian 10 (Buster)

1- Get the .deb file from https://code.visualstudio.com/docs/?dv=linuxarmhf_deb 2- Double click on it and hit Install when asked if you want to install the file 3- Type in your password when prompted for it 4- Done, you can find the program under Raspberry Start Menu > Programming > Visual Studio Code

How to Encrypt / Decrypt strings with RSA in Node.JS

Interesting things that go through my mind during lock-down haha! const crypto = require(‘crypto’); const PASSPHRASE = ‘I had learned that some things are best kept secret.’; const KEY_PAIR_OPTIONS = { modulusLength: 2048, publicKeyEncoding: { type: ‘spki’, format: ‘pem’ }, privateKeyEncoding: { type: ‘pkcs8’, format: ‘pem’, cipher: ‘aes-256-cbc’, passphrase: PASSPHRASE } }; const KEY_PAIR = crypto.generateKeyPairSync(‘rsa’, KEY_PAIR_OPTIONS); const RSA_PRK = …

Random Password Generator in Node.JS

The other day I thought about how to generate passwords from random arrays. Here is what I came up with: /* * RaNdom Password Generator */ const crypto = require(‘crypto’); const PASSWORD_LENGTH = 18; const LOWERCASE_ALPHABET = ‘abcdefghijklmnopqrstuvwxyz’; // 26 chars const UPPERCASE_ALPHABET = ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’; // 26 chars const NUMBERS = ‘0123456789’; // 10 chars const SYMBOLS = ‘,./<>?;\'”:[]\\|}{=-_+`~!@#$%^&*()’; // …

How to deploy Express.JS web application on HawkHost with cPanel?

Here is a step by step guide based on my experience on how to deploy your Express.JS web application with cPanel on HawkHost servers. First, the versions I am using are: cPanel v90.0.16 Express.JS v4.16.0 Node.JS v12.16.1 NPM v6.14.4 Now it’s time to login to your cPanel, and do the following Upload your application folder to the server: You can …