Skip to content

C program implementing a fork-based parallel brute-force password cracker dividing tasks among child processes for faster search.

Notifications You must be signed in to change notification settings

soh2970/C-password-cracking-fork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Assignment 1: Password Cracking with Fork-based Parallelism

Overview

This project implements a brute-force password cracking tool that simulates both sequential and parallel processing using the fork() system call. The password is a 12-character string divided into 4 segments. Each segment is independently brute-forced using printable ASCII characters.

Implementation Details

  • The checkPassword function (provided externally) validates if a guessed 3-character string matches part of the secret password at a specified offset.
  • The program supports two modes:
    • Sequential mode: cracks each segment one after another.
    • Parallel mode: uses 4 child processes, each cracking one segment concurrently using fork().

Files

File Name Description
assignment-1.c Main C program containing brute-force logic with optional forking
checkPassword.h Header file declaring checkPassword
checkPassword.o Compiled object file containing the actual implementation

Compilation

Compile with the provided object file:

gcc assignment-1.c checkPassword.o -o assignment1

Usage

Run in sequential mode:

./assignment1

Run in parallel mode using fork:

./assignment1 -f

Output Example

Process 12345 with parent 6789 cracking the password...
Process 12346 with parent 12345 finds 0-2: X7h
Process 12347 with parent 12345 finds 3-5: Bk1
...
All child processes completed.

Notes

  • The brute-force approach tests all combinations of printable ASCII characters (from code 33 to 126).
  • Each child process in forked mode handles one fixed 3-character segment: [0–2], [3–5], [6–8], and [9–11].
  • The solution mimics distributed effort for computationally intensive cracking tasks.

License

This project is part of CS 3305A - Operating Systems at Western University. For academic use only.

About

C program implementing a fork-based parallel brute-force password cracker dividing tasks among child processes for faster search.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages