Monday, August 15, 2022

Top 7 Free Cyber Security Newsletters

The following is the list of the 7 free, most popular cyber security newsletters:
  1. The Hacker News
  2. SecurityWeek
  3. CSO
  4. SANS Newsletters
  5. WeLiveSecurity by ESET
  6. Cybersecurity Ventures
  7. Naked Security

Tuesday, August 09, 2022

[Solved] Error: No such keg: /usr/local/Cellar/gcc

If you are facing issues with Homebrew while installing or updating the GCC package (or any other module), follow this guide.

The error occurred for me recently during my periodic homebrew updates on my MacBook Pro.

devharsh@Devharshs-MacBook-Pro ~ % brew update && brew upgrade && brew cleanup                                                         

Already up-to-date.

Warning: Skipping gcc: most recent version 12.1.0 not installed

For some reason, I had a warning flashing up for GCC. So I tried to install the missing version.

devharsh@Devharshs-MacBook-Pro ~ % brew install -f gcc@12

Error: gcc 12.1.0_1 is already installed

To install 12.1.0, first run:

  brew unlink gcc

Which unsurprisingly did not work, so I tried unlinking it. 

devharsh@Devharshs-MacBook-Pro ~ % brew unlink gcc

Error: No such keg: /usr/local/Cellar/gcc

And this failed too, hence this post! After some troubleshooting, I could fix the issue.

[How To] Upgrade to Python 3.9 in Google Colab

Google Colaboratory, or “Colab” for short, is a product from Google Research. Colab allows anybody to write and execute arbitrary python code through the browser and is especially well suited to machine learning, data analysis, and education. More technically, Colab is a hosted Jupyter notebook service that requires no setup to use while providing access free of charge to computing resources, including GPUs.

By default, it starts the runtime with Python version 3.7. If you want to upgrade the version in your current notebook, then follow these steps in the given order:

1) !python --version
Python 3.7.13

2) !sudo apt-get update -y
Get:1 bionic InRelease [15.9 kB]
Hit:2 bionic InRelease
Get:3 bionic-cran40/ InRelease [3,626 B]
Get:4 bionic InRelease [15.9 kB]
Hit:5 bionic InRelease
Get:6 bionic-security InRelease [88.7 kB]
Hit:7 bionic InRelease
Get:8 bionic-updates InRelease [88.7 kB]
Get:9 bionic/main Sources [2,077 kB]
Ign:10  InRelease
Get:11  InRelease [1,581 B]
Hit:12  Release
Get:13 bionic/main amd64 Packages [1,064 kB]
Get:14 bionic-backports InRelease [74.6 kB]
Get:15 bionic/main amd64 Packages [45.3 kB]
Get:16  Packages [902 kB]
Get:18 bionic-security/main amd64 Packages [2,905 kB]
Get:19 bionic-updates/universe amd64 Packages [2,306 kB]
Get:20 bionic-updates/main amd64 Packages [3,336 kB]
Get:21 bionic-security/universe amd64 Packages [1,528 kB]
Fetched 14.5 MB in 9s (1,578 kB/s)
Reading package lists... Done

Sunday, July 17, 2022

[How To] Install Pyfhel in macOS


  • Tested on Intel-based (x86_64) MacBook, not tested on M1/M2 (ARM)
  • Apple Clang does not support -fopenmp and -libseal, use GCC or CLANG
  1. % git clone --recursive

2.a) create requirements.txt file


2.b) % pip3 install -r requirements.txt

  1. edit pyproject.toml

Line #111 [Afhel]


  • {Darwin = ["-std=c++17","-O3","-fopenmp"]},


  • {Darwin = ["-fopenmp","-dynamiclib"]},

Repeat the above for [CYTHON EXTENSIONS]

Wednesday, July 13, 2022

[Solved] Jupyter notebook raises Module Not Found Error

I recently ran into issues on my MacBook with Jupyter notebooks, where it could not find any packages and was throwing "ModuleNotFoundError: No module named ****" for several libraries. I already had these packages installed but somehow Jupyter python kernel could not find it. I tried to install these packages in the notebook cells with the command !pip install **** but this did not help either. I also tried %brew reinstall jupyterlab and that did not work as well.

Finally, I found a fix.


Step-1: Install/upgrade jupyter packages:

% pip3 install --upgrade jupyter notebook jupyterlab

Step-2: Run jupyter with this command:

% jupyter-lab

[Solved] ld: library not found for -lntl

NTL: A Library for doing Number Theory

NTL is a high-performance, portable C++ library providing data structures and algorithms for manipulating signed, arbitrary length integers and for vectors, matrices, and polynomials over the integers and over finite fields.

You might face a linking error with NTL in macOS using the Apple Clang compiler:

% make                               

Consolidate compiler generated dependencies of target degrees

[ 25%] Linking CXX executable degrees

ld: library not found for -lntl

clang: error: linker command failed with exit code 1 (use -v to see invocation)


% brew install NTL
% export LIBRARY_PATH=/usr/local/lib
% make

[How To] Run MinimaxComp_degrees in macOS


This algorithm finds optimized degrees for comparison/max/ReLU algorithms using minimax composite polynomial on the RNS-CKKS scheme, which was proposed in and

How to run on macOS using the Apple Clang compiler:

1. % brew install NTL
2. % export LIBRARY_PATH=/usr/local/lib
4. % cd MinimaxComp_degrees
5. % cmake -S . -B build
6. % cd build
7. % make
8. % ./degrees



alpha: 20

epsilon: 0.2002716064453125e-4

mintime: 162

depth: 22


7 13 15 15 59 

Friday, July 08, 2022

[How To] Install CRC RevEng on macOS

CRC RevEng

CRC RevEng is a portable, arbitrary-precision CRC calculator and algorithm finder. It calculates CRCs using any 111 preset algorithms or a user-specified algorithm to any width. It calculates reversed CRCs to give the bit pattern that produces a desired forward CRC. CRC RevEng also reverse-engineers any CRC algorithm from good, correctly formatted message-CRC pairs and optional known parameters. It comprises powerful input interpretation options.

Installation instructions for macOS:

1. Download reveng from SourceForge:

2. Unzip the downloaded reveng zip file

3. % cd Downloads/reveng-3.0.3

4. % make

gcc -O3 -Wall -ansi -fomit-frame-pointer -DPRESETS -DBMPTST -o bmptst bmpbit.c

( ./bmptst && touch bmptst ) || ( rm bmptst bmptst.exe && false )

reveng: configuration fault.  Update config.h with these definitions and recompile:

#define BMP_BIT   64

#define BMP_SUB   32

rm: bmptst.exe: No such file or directory

make: *** [bmptst] Error 1

Top 13 Free Email Newsletters

Saturday, July 02, 2022

[Solved] frame.append method is deprecated and will be removed from pandas


all_results = all_results.append(current_result)


/var/folders/wh/tdg0ff9s1wl59234d5l27_gc0000gn/T/ipykernel_98654/ FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
  all_results = all_results.append(current_result)


all_results = pd.concat([all_results, current_result])

[Solved] seaborn: decrease the size of the markers


ax = sns.swarmplot(y="time_taken", x="dtype", data=all_results, color=".25")


/usr/local/Cellar/jupyterlab/3.3.2/libexec/lib/python3.9/site-packages/seaborn/ UserWarning: 35.9% of the points cannot be placed; you may want to decrease the size of the markers or use stripplot.
  warnings.warn(msg, UserWarning)


ax = sns.swarmplot(y="time_taken", x="dtype", data=all_results, color=".25", size=3.25)

Thursday, June 30, 2022

[How To] Run HELR (Homomorphic Encryption Logistic Regression) in macOS

HELR is a software project for performing a logistic regression training on encrypted data (Secure Logistic Regression based on Homomorphic Encryption: Design and Evaluation (

Step 1: brew install GMP

Step 2: brew install NTL

Step 4: cd HELR

Thursday, June 16, 2022

[How To] Print with staples in macOS

Step 1/3: If you have opened a PDF from Google Chrome, go to the Print dialogue box and click on the link "Print using system dialog.."

Step 2/3: Click on the dropdown menu that says "Media & Quality" and change it to "Finishing Options"

Step 3/3: Click on Staple dropdown options and select the number of staples and the orientation where you want the pages to be stapled.

Monday, June 13, 2022

[Solved] Install matplotlib / basemap in macOS

I have been trying to import the basemap module in my python script using "from mpl_toolkits.basemap import Basemap" but with no luck! I ran into issues while installing basemap with pip. Excerpt from the error:

  Installing build dependencies ... error



  × pip subprocess to install build dependencies did not run successfully.

   exit code: 1

  ╰─> [552 lines of output]

      Ignoring numpy: markers 'python_version >= "3.10"' don't match your environment

      Ignoring numpy: markers 'python_version == "2.6" or (python_version >= "3.2" and python_version <= "3.3")' don't match your environment

      Ignoring cython: markers 'python_version == "3.2"' don't match your environment



        note: This error originates from a subprocess, and is likely not a problem with pip.

      error: legacy-install-failure


      × Encountered error while trying to install package.

      ╰─> numpy


      note: This is an issue with the package mentioned above, not pip.

      hint: See above for output from the failure.

      WARNING: There was an error checking the latest version of pip.

      [end of output]


  note: This error originates from a subprocess, and is likely not a problem with pip.


× pip subprocess to install build dependencies did not run successfully.

 exit code: 1

╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

WARNING: There was an error checking the latest version of pip.

So I did a little digging and searched for necessary packages to compile and install basemap on macOS from the source. I have Python 3.9 and macOS 12.4. Here are the steps that worked for me:

Wednesday, June 01, 2022

[How To] Run Bidirectional LSTM in Python

 This is a sample program to run bidirectional LSTM in Python using Tensorflow. The complete code repository is available at


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
Created on Wed Jun  1 13:34:00 2022.

@author: devharsh

import matplotlib.pyplot as plt
from pandas import read_csv
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from tensorflow import keras
from tensorflow.keras import layers

inputs = keras.Input(shape=(None,), dtype="float64")
xem = layers.Embedding(101, 128)(inputs)
xl1 = layers.Bidirectional(layers.LSTM(64, return_sequences=True))(xem)
xl2 = layers.Bidirectional(layers.LSTM(64))(xl1)
outputs = layers.Dense(1, activation="sigmoid")(xl2)
model = keras.Model(inputs, outputs)

Friday, May 20, 2022

[Solved] Fix upgrade errors in Kali Linux

If you face errors from powershell-empire while upgrading Kali Linux, upgrade the pip packages for Flask and aiohttp with root privileges.

Error - 1:

Traceback (most recent call last):
  File "/usr/share/powershell-empire/", line 11, in <module>
    import empire.server.server as server
  File "/usr/share/powershell-empire/empire/server/", line 23, in <module>
    import flask
  File "/usr/lib/python3/dist-packages/flask/", line 19, in <module>
    from . import json
  File "/usr/lib/python3/dist-packages/flask/json/", line 15, in <module>
    from itsdangerous import json as _json
ImportError: cannot import name 'json' from 'itsdangerous' (/usr/lib/python3/dist-packages/itsdangerous/
dpkg: error processing package powershell-empire (--configure):
 installed powershell-empire package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

[How To] Remove conda from macOS

Follow these steps from a Terminal window to remove conda in macOS:
  • conda install anaconda-clean
  • anaconda-clean --yes
  • rm -rf /Users/devharsh/.anaconda_backup/
    (Replace "devharsh" with user directory)
  • rm -rf ~/anaconda3
  • rm -rf ~/anaconda2
  • rm -rf ~/.condarc ~/.conda ~/.continuum
  • sudo rm ~/.zshrc
  • brew reinstall python
  • /usr/local/opt/python@3.9/bin/python3.9 -m pip install --upgrade pip
  • pip3 list

Tuesday, February 22, 2022

[How To] Draw Vectors in Python

import numpy as np
import matplotlib.pyplot as plt

x_pos = np.linspace(0,5,10)
y_pos = np.linspace(0,10,10)
x_dir = y_dir = np.zeros((10,10))
plt.quiver(x_pos, y_pos, x_dir, y_dir, scale=1)

Rename Algorithm to Procedure in LaTeX

If you want to change the section name from Algorithm to Procedure, you just need to use the \floatname command while the code remains unchanged.

The code for an algorithm:
    \State Hello!

Now to change the label, add the following command before \begin{document}.
The code remains the same.


Sunday, February 06, 2022

[Solved] 15 duplicate symbols for architecture x86_64


If you are getting build failures in Xcode for a C++ program with similar errors then try this fix.

15 duplicate symbols for architecture x86_64

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

  • You can avoid declaring variables in the header and move them to implementation.
  • Or you can declare all the variables in the header file as static.

Thursday, February 03, 2022

[Solved] Enable iCloud Private Replay in Pi-hole

Pi-hole is a network-wide ad-blocking DNS server. iCloud Private Replay is a secure internet relay service. While Pi-hole can protect you from unwanted tracking and advertisements, iCloud Private Relay provides you with privacy when you browse the web in Safari.

When you join the Pi-hole network with a device with iCloud Private Relay enabled, Pi-hole returns NXDOMAIN response for and as per Apple recommendation.

To disable this feature in Pi-hole and allow the functioning of iCloud Private Relay go to /etc/pihole/pihole-FTL.conf and set BLOCK_ICLOUD_PR=false.


[How To] Calculate hash of a vector in C++

This is a sample code to generate SHA256 in C++ using CryptoPP.

For the first string in a vector:
std::vector<std::string> stringVector{"abcde", "fghij", "klmno", "pqrst", "uvwxyz"};
byte digest[SHA256::DIGESTSIZE];
SHA256().CalculateDigest(digest, (const byte*), stringVector.size());
For an entire vector of string:
std::vector<std::string> stringVector{"abcde", "fghij", "klmno", "pqrst", "uvwxyz"};
HexEncoder encoder(new FileSink(std::cout));
std::string digest;
SHA256 hash;

for(auto str: stringVector) { 
hash.Update((const byte*), str.size()); 


std::cout << "Digest: ";
StringSource(digest, true, new Redirector(encoder));
std::cout << std::endl;