Monday, February 22, 2021

extract a certificate

Sometimes you need to extract a certificate from a website.

 openssl s_client -connect site:443 2>/dev/null </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'   

Tuesday, February 2, 2021

resolve all the names & ips

.

canonical names
#!/bin/sh

for i in `cat ./names.txt`
do 
	nslookup $i | grep ^Name -A1| awk '{print $2}';
	echo
done  >> allthenames

ips
#!/bin/sh
for IP in `cat ./ips.txt`;
do
	printf "%-4s", $IP 
	nslookup $IP | grep -v nameserver | cut -f 2 | 
        grep name | cut -f 2 -d "=" | sed 's/ //';
	
done