What is MOSS?
MOSS is an automatic system for determining the similarity of programs. It has been used extensively in programming courses to detect plagiarism by:- Comparing student submissions against each other
- Detecting shared code between assignments
- Identifying base code that should be ignored
- Supporting multiple programming languages
Obtaining a MOSS User ID
Registration
- Send an email to
[email protected]with the following body:
-
Replace
[email protected]with your institutional email address -
You will receive a reply with:
- Your MOSS user ID
- The MOSS Perl script
- Instructions for use
User ID Format
Your MOSS user ID is a numeric value, for example:Configuring MOSS
Locate the MOSS Script
The MOSS script is located at:Set User ID
Open the MOSS script and locate line 167:MOSS_USER_ID with your actual MOSS user ID:
Make Script Executable
Ensure the MOSS script has execute permissions:Verify Configuration
Test the script is properly configured:MOSS Script Usage
Basic Usage
The general syntax for using MOSS:Common Options
-l language
Specify the programming language:
c,cc(C/C++)javaml(ML)pascaladalisp,schemehaskellfortranperlpythonjavascriptcsharpvb(Visual Basic)matlabmips(Assembly)- And many more (see line 157 in the script)
-d (Directory Mode)
Treat submissions by directory:
-b basefile (Base File)
Exclude instructor-provided code from matching:
-m # (Max Matches)
Set maximum occurrences before ignoring a code passage:
-m 2: Only report code appearing in exactly 2 programs-m 10(default): Ignore code appearing in more than 10 programs-m 1000000: Report all matches
-c "string" (Comment)
Add a comment to the report:
-n # (Number of Results)
Number of matching files to show (default: 250):
Example Commands
Testing MOSS Integration
Create Test Files
Create sample files to test MOSS:test1.py
test2.py
Run MOSS
Interpret Results
MOSS will output a URL:- Percentage of matching code
- Line-by-line comparison
- Highlighted similarities
Integration with Wecode
Automated MOSS Checking
Wecode can automatically run MOSS checks on submissions. Configure the MOSS integration in your application.Batch Processing
Process multiple assignments:Scheduled Checks
Set up a cron job to run periodic plagiarism checks:File Permissions
Ensure proper permissions for the MOSS script:Troubleshooting
Permission Denied
Problem:bash: ./tester/moss_original: Permission denied
Solution:
Invalid User ID
Problem:Error: Invalid userid
Solutions:
- Verify you’ve replaced
MOSS_USER_IDwith your actual numeric ID - Check there are no spaces or quotes around the ID
- Ensure the ID is numeric only
Connection Failed
Problem:Could not connect to server moss.stanford.edu
Solutions:
- Check internet connectivity
- Verify firewall allows outbound connections to port 7690
- Ensure
moss.stanford.eduis reachable:
Perl Not Found
Problem:perl: command not found
Solution:
Install Perl:
File Not Found Errors
Problem:File ... does not exist
Solutions:
- Verify file paths are correct
- Use absolute paths if relative paths fail
- Check files are readable:
Best Practices
- Base Files: Always use base files to exclude instructor-provided code
- Regular Checks: Run MOSS checks periodically, not just at the end of the course
- Privacy: Keep MOSS user ID secure and never commit it to version control
- Documentation: Document which submissions were flagged for manual review
- False Positives: Always manually review matches before making accusations
- Language Settings: Use the correct language flag for accurate results
- Sensitivity: Adjust
-mparameter based on assignment complexity - Comments: Use
-cto label reports for future reference
Understanding MOSS Results
Match Percentages
- 90-100%: Very high similarity, likely plagiarism
- 70-90%: High similarity, requires investigation
- 50-70%: Moderate similarity, may be coincidental
- Below 50%: Low similarity, likely not plagiarism
Line-by-Line Review
MOSS provides:- Color-coded matches
- Side-by-side comparison
- Line numbers for reference
- Percentage calculations
Additional Resources
- MOSS Homepage: http://theory.stanford.edu/~aiken/moss/
- MOSS Paper: “Winnowing: Local Algorithms for Document Fingerprinting”
- Support: [email protected] (for registration issues only)
Limitations
- MOSS is a detection tool, not proof of plagiarism
- Cannot detect plagiarism from non-submitted sources
- May miss heavily obfuscated code
- Requires manual review of results
- Service availability depends on Stanford’s servers

