CMOS (C Moss) is a simplified plagiarism detection tool inspired by MOSS (Measure of Software Similarity). It utilizes lexical analysis and the Winnowing algorithm to identify potential similarities between student-submitted C programs.
- Tokenizes C source code to remove irrelevant features (e.g., comments, whitespace, variable names).
- Generates numeric token sequences for each submission.
- Creates digital fingerprints using overlapping k-mers and a simple hash function.
- Computes similarity scores between submissions based on shared fingerprints.
- Produces a ranked report of similar submissions for manual review.
To compile and run CMOS, you need:
- A Unix-like environment
flex(for lexical analysis)g++(for compiling the C++ program)
Clone the repository and compile the project:
makeRun CMOS by specifying the directory containing student submissions:
./PlagarismDetector <directory>This will:
- Tokenize each file in the directory.
- Generate a
tokens.txtfile. - Perform fingerprint analysis.
- Output a ranked list of similar submissions.
cmos.l: A FLEX lexer for tokenizing C code.cmos.cpp: A C++ program that implements the Winnowing algorithm for similarity detection.Makefile: Automates the compilation process.PlagarismDetector: A provided Bash script that processes multiple files and runs the analysis.
- Tokenization: Removes comments, whitespace, and normalizes tokens.
- Winnowing Algorithm:
- Converts token sequences into overlapping k-mers.
- Hashes k-mers and selects minimum hash values from each window.
- Compares fingerprints across submissions to determine similarity.
- Similarity Scoring:
- Computes shared fingerprints between submissions.
- Generates a similarity percentage for each pair.
The program generates a report containing:
- Pairs of submissions ranked by similarity.
- The tool is designed for use on
pu3(the instructor's test machine). - Ensure compatibility by testing on a school-provided environment.
This project is for educational purposes and follows academic integrity guidelines.