Cryptography & System Auditing

UNIX Shadow Password Cracker

An automated Python security tool designed to crack legacy UNIX DES-crypt password hashes using salt extraction and dictionary-based analysis.

Python UNIX Crypt Password Cracking System Security

Project Overview

The UNIX Shadow Password Cracker is a command-line security auditing utility developed in Python. It is designed to evaluate the strength of local system accounts on legacy UNIX and Linux environments by programmatically "cracking" password hashes stored in the critical `etc / shadow` file.

This tool automates the retrieval of user credentials, extracts the salt value essential for hashing, and executes a dictionary attack by iteratively comparing locally generated hashes against the compromised shadow entries, highlighting accounts with weak or common passwords.

Technical Architecture & Auditing Pipeline

The script implements a structured offline cracking loop, utilizing a multi-stage approach to reverse-engineer credential hashes:

Read `shadow` File
Extract User & Salt
Open `passwords` file
Compute `crypt()` Hash
Compare and Validate

Key Engineering Principles

Key Python Implementation

Below is the core of the cryptographic reversal routine, managing input stream reading, string manipulation, and the crucial hash comparison loop:

# Standard Python library for traditional UNIX crypt hashing

def testPass(cryptPass):
    # Extract the legacy DES salt (first two characters)
    salt = cryptPass[0:2]

    # Iterate through every potential candidate in the wordlist
    dictFile = open('passwords.txt', 'r')
    for word in dictFile.readlines():
        word = word.strip('\n')
        # Compute the test hash with the system salt
        cryptWord = crypt.crypt(word, salt)
        # Compare the test result to the target shadow hash
        if (cryptWord == cryptPass):
            print "[+] Found Password: " + word
            return
    print "[-] Password Not Found."

Defensive Hardening & Legacy System Migration

This auditing script demonstrates how simple dictionary attacks are incredibly effective against antiquated hashing algorithms. To secure modern UNIX/Linux environments, the following defensive strategies must be enforced: