Wednesday, December 15, 2021
Share folder from macOS to VirtualBox
Thursday, December 09, 2021
[Solved] error: ‘getrusage’ was not declared in this scope
Thursday, November 25, 2021
[How To] Use Cryptopp in Kali Linux
Crypto++ is a popular C++ library for cryptography. Instruction in this article can be used to install Cryptopp for all operating systems similar to Kali Linux. Check out this article if you want to use it with Xcode in macOS.
Step 1: Download Crypto++ using this link
Step 2: Extract Crypto++ and switch to that directory from the terminal or shell.
Step 3: $ make
Step 4: $ make test
Step 5: $ sudo make install
Step 6: Compile your program using
g++ -I/usr/local/include -L/usr/local/lib yourCode.cpp -lcryptopp
Friday, November 12, 2021
Automate onboarding in Google Workspace
This tutorial demonstrates the use of Google Workspace apps to automate the onboarding experience for new users by adding them to a google group and sending automated welcome emails after they are added.
Thursday, November 11, 2021
Automate User Creation in Google Workspace
This tutorial demonstrates how to automate the user creation process in Google workspace using Admin SDK.
Tuesday, November 09, 2021
[How to] Redirect URL in WordPress
In this tutorial, I will walk you through redirecting a URL in WordPress without using any plugins.
You can open a Terminal or Command Prompt window and do the following:
$cd to /var/www/html
$ls -loa
$sudo nano .htaccess
Append to the end of file “Redirect 301 old-URL new-URL”
Save the file and exit
$sudo service apache2 restart
Monday, November 08, 2021
[How To] Generate KEY and IV for CryptoPP in C++
In this tutorial, I will share strategies to generate random keys and initialization vector in C++ using CryptoPP library.
AutoSeededRandomPool prng;
prng.GenerateBlock(key, key.size());
prng.GenerateBlock(iv, iv.size());
Wednesday, October 20, 2021
Oracle Virtualbox crashing (aborting) on macOS [Solved]
I run into issues every time I update my VirtualBox version on my MacBook Pro. If you run into issues where you can't start a VM instance, try this fix.
Open Virtualbox >> Go to your VM image >> Click on Settings >> Go to Audio >> Uncheck the "Enable Audio" box.
Binary file (standard input) matches
$ sudo cat /var/log/syslog | grep "tree"
Binary file (standard input) matches
$ sudo cat /var/log/syslog | grep "tree" --text
Jul 14 17:43:00 osboxes kernel: [ 3.042582] vboxguest: loading out-of-tree module taints kernel.
Jul 15 13:24:47 osboxes kernel: [ 3.420002] vboxguest: loading out-of-tree module taints kernel.
Jul 15 13:54:22 osboxes kernel: [ 3.027623] vboxguest: loading out-of-tree module taints kernel.
Sep 28 12:59:21 osboxes kernel: [ 3.165531] vboxguest: loading out-of-tree module taints kernel.
Sep 28 13:46:04 osboxes kernel: [ 2.755048] vboxguest: loading out-of-tree module taints kernel.
Sep 28 13:51:08 osboxes kernel: [ 3.508174] vboxguest: loading out-of-tree module taints kernel.
Oct 19 21:04:41 osboxes kernel: [ 2.762903] vboxguest: loading out-of-tree module taints kernel.
Oct 19 21:11:51 osboxes kernel: [ 2.566860] vboxguest: loading out-of-tree module taints kernel.
Sunday, October 17, 2021
[Solved] 'cryptopp/aes.h' file not found; Expected namespace name
If you are facing errors like "'cryptopp/aes.h' file not found" or getting "Expected namespace name" error for "using namespace CryptoPP;" or similar compilation errors, refer to the following settings:
- Add "/usr/local/include" in Header search paths
- Add "/usr/local/lib" in Library search paths
- Add -lcryptopp as a Linker flag
Refer to this article for more information: https://com.puter.tips/2021/02/how-to-use-cryptopp-in-xcode.html
[How To] Use Boost in Xcode
$ brew install boost
[Solved] code signature not valid for use in process using Library Validation
dyld: Library not loaded: /usr/local/lib/libcryptopp.dylib
Referenced from: /Users/devharsh/Library/Developer/Xcode/DerivedData/server-bohvcuztzndrrzhcoglrvuijfasj/Build/Products/Debug/server
Reason: no suitable image found. Did find:
/usr/local/lib/libcryptopp.dylib: code signature in (/usr/local/lib/libcryptopp.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
/usr/local/lib/libcryptopp.dylib: code signature in (/usr/local/lib/libcryptopp.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
/usr/local/lib/libcryptopp.dylib: code signature in (/usr/local/lib/libcryptopp.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
Program ended with exit code: 9
Thursday, October 14, 2021
[Solved] Google Sign-in Error: "sign in using your corporate mobile device"
"We detected an unusual sign-in attempt. To ensure that someone else isn't trying to access your account, your organization needs you to sign in using your corporate mobile device (the phone or tablet you normally use to access your corporate account). If you don't have your corporate mobile device with you right now, try again later when you have your corporate mobile device with you. If you continue to have problems signing in, contact your administrator."
- Login to Google Admin: https://admin.google.com/
- Go to Users >> Open the user account
- Go to "Login challenge."
- Click on "Turn off for 10 mins."
- Try to log in again, and it should be fine
Saturday, September 18, 2021
Unable to revert mtime: /Library/Fonts [Solved]
% python3 my-random-script.py
Unable to revert mtime: /Library/Fonts
% brew install libmagic
Friday, September 17, 2021
NTRU in python3
- NTRU – Nth Degree Truncated Polynomial Ring Units (or R = Z[X] / ( X^N-1 ))
- NTRU is the first public-key cryptosystem not based on factorization or discrete logarithmic problems.
- NTRU is a lattice-based alternative to RSA and ECC and is based on the shortest vector problem in a lattice.
- NTRU is an open-source public-key cryptosystem that uses lattice-based cryptography to encrypt and decrypt data.
- It consists of two algorithms: NTRUEncrypt, which is used for encryption, and NTRUSign, which is used for digital signatures.
- Unlike other popular public-key cryptosystems, it is resistant to attacks using Shor's algorithm.
- NTRUEncrypt was patented, but it was placed in the public domain in 2017. NTRUSign is patented, but it can be used by software under the GPL.
% python3 --version
Python 3.9.1
% pip3 install --user sympy
% pip3 install --user numpy
% pip3 install --user docopt
Wednesday, April 21, 2021
[How To] Save Space on Google Photos
Google Photos is a photo-sharing and storage service developed by Google. It was announced in May 2015 and separated from Google+, the company's former social network. In its free tier, Google Photos stores unlimited photos and videos up to 16 megapixels and 1080p resolution, respectively (anything larger gets down-scaled to these sizes). This free tier will end on June 1, 2021. Photos and videos uploaded after that date get counted towards the 15 GB free quota shared across the user's Google services. There are subscriptions offered for users wanting to store their photos and videos at their "original" quality and requiring more storage than the 15 GB offered free.
Storage (GB) | Per Month (USD) | Annual (USD) |
15 | 0 | 0 |
100 | 1.99 | 19.99 |
200 | 2.99 | 29.99 |
2000 | 9.99 | 99.99 |
Tuesday, March 30, 2021
[How To] Install Free SSL Certificate for WordPress
In this tutorial, I have installed a free SSL certificate from Let's Encrypt using the Certbot tool on Google Cloud Platform VM running Debian OS that hosts a WordPress site using Apache server. You can follow similar steps for other Cloud providers / OS distributions / CMS vendors / Web servers.
Part-1: Configure Virtual Host for your domain on Apache
cd /var/www/html
wp option update home 'https://example.com'
wp option update siteurl 'https://example.com'
sudo nano /etc/apache2/sites-available/example.com.conf
sudo apache2ctl configtest
sudo a2ensite example.com
sudo systemctl reload apache2
Thursday, March 11, 2021
Random Number Generation in C++
Code:
//
// main.cpp
// VaultBox
//
// Created by Devharsh Trivedi on 3/11/21.
//
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <random>
#include <cmath>
#include <vector>
int main(int argc, const char * argv[]) {
std::random_device ranDev;
unsigned int num_ranDev = ranDev();
std::cout << num_ranDev << std::endl;
std::mt19937 mtGen(num_ranDev);
std::vector<unsigned long> indexes(10);
iota(indexes.begin(), indexes.end(), 0);
for(int i=0; i<10; i++) {
std::cout << indexes[i] << "\t";
}
std::cout << std::endl;
[How To] Save as an unlocked PDF
Steps to save a locked (password protected) PDF as an unlocked PDF:
- Download / Save / Copy the locked PDF to a folder
- Open Google Chrome
- Go to File Menu >> Open File >> Select your locked PDF
- Enter password
- Click on the Print button and select Save as a PDF
- The saved PDF will be unlocked
Friday, February 26, 2021
setsockopt: Protocol not available [Solved]
Problem code:
if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt)))
{
perror("setsockopt");
exit(EXIT_FAILURE);
}
Solution:
if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)))
{
perror("setsockopt");
exit(EXIT_FAILURE);
}
Ref.: https://stackoverflow.com/a/59807281/4064166
Wednesday, February 24, 2021
[How To] Fix "Waiting to Upload" in iCloud Drive
1. Check if you have enough free storage on iCloud
2. Go to Settings (iOS / iPadOS) or System Preferences (macOS) >> iCloud >> Sign Out
3. Wait for a minute or two after you have successfully logged out
4. Log in to iCloud again
5. Go to iCloud settings and >> iCloud Drive >> Options... >> select the checkbox for "Desktop & Documents Folder" >> Done
Sunday, February 21, 2021
Best tablets to buy in 2021
Brand - Apple
Storage - 256 GB
Display - 10.9"
Resolution - 2360 x 1640
Operating System - iPadOS 14
stylus pen for iPad with palm rejection - https://amzn.to/3aEluxP
iPad Air 4th generation keyboard case - https://amzn.to/3kbOT5D
iPad Air glass screen protector - https://amzn.to/3aG5xY1
[How To] Use Cryptopp in Xcode
- Crypto++ Library is a free C++ class library of cryptographic schemes. Currently the library contains the following algorithms: algorithm type name authenticated encryption schemes GCM, CCM, EAX, ChaCha20Poly1305 and XChaCha20Poly1305 high speed stream ciphers ChaCha (8/12/20), ChaCha (IETF), Panama, Salsa20, Sosemanuk, XSalsa20, XChaCha20 AES and AES candidates AES (Rijndael), RC6, MARS, Twofish, Serpent, CAST-256 ARIA, Blowfish, Camellia, CHAM, HIGHT, IDEA, Kalyna (128/256/512), LEA, SEED, RC5, SHACAL-2, other block ciphers SIMON (64/128), Skipjack, SPECK (64/128), Simeck, SM4, Threefish (256/512/1024), Triple-DES (DES-EDE2 and DES-EDE3), TEA, XTEA block cipher modes of operation ECB, CBC, CBC ciphertext stealing (CTS), CFB, OFB, counter mode (CTR), XTS message authentication codes BLAKE2s, BLAKE2b, CMAC, CBC-MAC, DMAC, GMAC, HMAC, Poly1305, Poly1305 (IETF), SipHash, Two-Track-MAC, VMAC BLAKE2s, BLAKE2b, Keccack (F1600), SHA-1, hash functions SHA-2 (224/256/384/512), SHA-3 (224/256/384/512), SHAKE (128/256), SipHash, SM3, Tiger, RIPEMD (128/160/256/320), WHIRLPOOL RSA, DSA, Deterministic DSA, ElGamal, public-key cryptography Nyberg-Rueppel (NR), Rabin-Williams (RW), LUC, LUCELG, EC-based German Digital Signature (ECGDSA), DLIES (variants of DHAES), ESIGN padding schemes for public-key PKCS#1 v2.0, OAEP, PSS, PSSR, IEEE P1363 systems EMSA2 and EMSA5 Diffie-Hellman (DH), Unified Diffie-Hellman (DH2), key agreement schemes Menezes-Qu-Vanstone (MQV), Hashed MQV (HMQV), Fully Hashed MQV (FHMQV), LUCDIF, XTR-DH elliptic curve cryptography ECDSA, Deterministic ECDSA, ed25519, ECNR, ECIES, ECDH, ECMQV, x25519 insecure or obsolescent MD2, MD4, MD5, Panama Hash, DES, ARC4, SEAL algorithms retained for backwards 3.0, WAKE-OFB, DESX (DES-XEX3), RC2, compatibility and historical SAFER, 3-WAY, GOST, SHARK, CAST-128, Square value
Friday, February 12, 2021
[How To] check if Intel SGX is enabled
Steps to check if Intel SGX is enabled on your system:
1. Download test-sgx.c from https://github.com/ayeks/SGX-hardware
2. % gcc test-sgx.c -o test-sgx
3. % ./test-sgx
eax: 806ea ebx: 4100800 ecx: 7ffafbbf edx: bfebfbff
stepping 10
model 14
family 6
processor type 0
extended model 8
extended family 0
smx: 0
Extended feature bits (EAX=07H, ECX=0H)
eax: 0 ebx: 29c67af ecx: 0 edx: 9c002600
sgx available: 1
sgx launch control: 0
CPUID Leaf 12H, Sub-Leaf 0 of Intel SGX Capabilities (EAX=12H,ECX=0)
eax: 0 ebx: 0 ecx: 0 edx: 0
sgx 1 supported: 0
sgx 2 supported: 0
MaxEnclaveSize_Not64: 0
MaxEnclaveSize_64: 0
CPUID Leaf 12H, Sub-Leaf 1 of Intel SGX Capabilities (EAX=12H,ECX=1)
eax: 0 ebx: 0 ecx: 0 edx: 0
CPUID Leaf 12H, Sub-Leaf 2 of Intel SGX Capabilities (EAX=12H,ECX=2)
eax: 0 ebx: 0 ecx: 0 edx: 0
CPUID Leaf 12H, Sub-Leaf 3 of Intel SGX Capabilities (EAX=12H,ECX=3)
eax: 0 ebx: 0 ecx: 0 edx: 0
CPUID Leaf 12H, Sub-Leaf 4 of Intel SGX Capabilities (EAX=12H,ECX=4)
eax: 0 ebx: 0 ecx: 0 edx: 0
CPUID Leaf 12H, Sub-Leaf 5 of Intel SGX Capabilities (EAX=12H,ECX=5)
eax: 0 ebx: 0 ecx: 0 edx: 0
CPUID Leaf 12H, Sub-Leaf 6 of Intel SGX Capabilities (EAX=12H,ECX=6)
eax: 0 ebx: 0 ecx: 0 edx: 0
CPUID Leaf 12H, Sub-Leaf 7 of Intel SGX Capabilities (EAX=12H,ECX=7)
eax: 0 ebx: 0 ecx: 0 edx: 0
CPUID Leaf 12H, Sub-Leaf 8 of Intel SGX Capabilities (EAX=12H,ECX=8)
eax: 0 ebx: 0 ecx: 0 edx: 0
CPUID Leaf 12H, Sub-Leaf 9 of Intel SGX Capabilities (EAX=12H,ECX=9)
eax: 0 ebx: 0 ecx: 0 edx: 0
4. sgx available = 1 means that the system has a CPU that supports Intel SGX
5. From sgx1 supported = 0 and max enclave size64 = 0 we infer that Intel SGX is disabled from BIOS
Tuesday, February 02, 2021
iOS v/s Android - Comparing 'Apples' to 'Oranges'
Apple iOS | Google Android | |
Released | July 29, 2007 | September 23, 2008 |
Latest Version | 14 | 11 |
Website | ||
OS Model | Proprietary | Open Source |
Languages | 40 | 100 |
Assistant | Siri | Google Assistant |
Apps | 1,000,000 on App Store | 2,000,000 on Play Store |
Operating System | Unix | Linux |
Latest Phone | iPhone 12 | Pixel 5 |
Phone Website |