Async waterfall example nodejs

To avoid callback hell , a very useful tool for structuring calls in a sequence and make sure the steps pass the data to the next step. nJoy 😉

Node.js Start script or run command and handoff to OS (no waiting)

Sometimes you want to run something in the OS from your node code but you do not want to follow it or have a callback posted on your stack. The default for child_process spawning is to hold on to a handle and park a callback on the stack. however there is an option which is…

Identify OS on remote host

For nmap to even make a guess, nmap needs to find at least 1 open and 1 closed port on a remote host. Using the previous scan results, let us find out more about the host 192.168.0.115: # nmap -O -sV 192.168.0.115 Output: Starting Nmap 7.80 ( https://nmap.org ) at 2020-10-02 12:21 CEST Nmap scan…

How to quit ESXi SSH and leave background tasks running

In Linux when a console session is closed most background jobs (^Z and bg %n) will stop running when the parent ( the ssh session ) is closed because the parent sends a SIGHUP to all its children when closing (properly). Some programs can catch and ignore the SIGHUP or not handle it at all…

DHCP debugging with tcpdump

tcpdump filter to match DHCP packets including a specific Client MAC Address: tcpdump -i br0 -vvv -s 1500 ‘((port 67 or port 68) and (udp[38:4] = 0x3e0ccf08))’ tcpdump filter to capture packets sent by the client (DISCOVER, REQUEST, INFORM): tcpdump -i br0 -vvv -s 1500 ‘((port 67 or port 68) and (udp[8:1] = 0x1))’ Sample…

Convert Large numbers to binary in Excel

=DEC2BIN(MOD(QUOTIENT($A$1,16^7),16),4)&” “&DEC2BIN(MOD(QUOTIENT($A$1,16^6),16),4)&” “&DEC2BIN(MOD(QUOTIENT($A$1,16^5),16),4)&” “&DEC2BIN(MOD(QUOTIENT($A$1,16^4),16),4)&” “&DEC2BIN(MOD(QUOTIENT($A$1,16^3),16),4)&” “&DEC2BIN(MOD(QUOTIENT($A$1,16^2),16),4)&” “&DEC2BIN(MOD(QUOTIENT($A$1,16^1),16),4)&” “&DEC2BIN(MOD(QUOTIENT($A$1,16^0),16),4) The above code will convert large numbers up to 32 bit. nJoy 😉

Get ssh key fingerprint for comparing safely

SSh keys can be long and unwieldy to compare. Many platforms digest them to md5 formats for non disclosure such as github. This command will give you the digested fingerprint of an ssh key in linux / Mac. nJoy 😉

Get Days in a month from a bash script

Useful listing of days in a month to populate directories or run scripts for backing up getting the correct dates of days in a month and year.     YEAR=2020 MONTH=2 for DAY in $(DAYS=`cal $MONTH $YEAR | awk ‘NF {DAYS = $NF}; END {print DAYS}’` && seq -f ‘%02G’ $DAYS) ;do DATE=”$YEAR-$MONTH-$DAY” echo $DATE…

SYSTEMD – controls

Starting with Ubuntu 15.04, Upstart will be deprecated in favor of Systemd. With Systemd to manage the services we can do the following: systemctl start SERVICE – Use it to start a service. Does not persist after reboot systemctl stop SERVICE – Use it to stop a service. Does not persist after reboot systemctl restart…