import sys import crypt ''' Compute the same password hash that Linux does Author: Tim Pierson, Dartmouth CS55, Winter 2021 based example from Du: Computer and Internet Security pg 507 python3 make_linux_passwords.py 'dees' '$6$wDRrWCQz' will output the same linux hash as seed in /etc/shadow to confirm type sudo cat /etc/shadow ''' if __name__ == '__main__': if len(sys.argv) != 3: print(sys.argv) print("Got",len(sys.argv),"arguments, expecting three") print("Usage: python3 make_linux_passwords.py ") else: pwd = sys.argv[1] #'dees' salt = sys.argv[2] #'$6$wDRrWCQz' print(crypt.crypt(pwd,salt)) #does 5,000 rounds of SHA512