Parsing Passwd files

From BHaFSec Pentesting Notes Wiki
Jump to: navigation, search

Parse AIX /etc/security/passwd file

suitable for JohnTheRipper

cat /etc/security/passwd |egrep ":|password" | sed 's/password = //g' | tr -d "\t " |sed ':a;N;$!ba;s/:\n/:/g' |grep -v password= | sed '/\*/d' > username-hash.txt

suitable for Hashcat

cat /etc/security/passwd |egrep ":|password" | sed 's/password = //g' | tr -d "\t " |sed ':a;N;$!ba;s/:\n/:/g' |grep -v password= | sed '/\*/d'|awk -F':' '{print $2}' > hash.txt