Skip to content

brunomnsilva/moodle2moss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Moodle MOSS Script

License: MIT

This repository provides a Bash script to automate the extraction and analysis of programming assignments downloaded from Moodle using MOSS (Measure Of Software Similarity).

📌 Prerequisites

Before running the script, ensure you have the following installed:

  • zip
  • 7z
  • convmv
  • unrar
  • mktemp
  • find
  • basename
  • mv
  • mkdir
  • rmdir
  • perl

Additionally, you need to manually download the moss.pl script by registering with MOSS at https://theory.stanford.edu/~aiken/moss/.

📁 Input Requirements

  • Moodle assignment submissions ZIP file (from the “Download all submissions” option).
  • Ensure “Download submissions in folders” is unchecked.
  • Create exclusion lists:
    • exclude_c.txt — list of common files to exclude for C submissions.
    • exclude_java.txt — list of common files to exclude for Java submissions.

The folder structure should be something like:

moodle2moss
├── Group1.zip
├── Group2.zip
├── Group3.zip
├── exclude_c.txt
├── exclude_java.txt
├── moodle2moss.sh
└── moss.pl

Each Group<id>.zip file contains submissions for the same assignment. In this example, there are three files because submission links were provided separately by three different teachers. However, a single ZIP file is sufficient if all submissions are collected together.

⚙️ How It Works

The script performs the following steps:

  1. Validates required tools and files.
  2. Accepts a language argument (C or Java).
  3. Extracts all student submissions (including nested archives).
  4. Fixes filename encodings from Windows-1252 to UTF-8.
  5. Extracts relevant source files (applying exclusions) into _SRC_ folders.
  6. Compresses all _SRC_ folders into a single archive src_submissions.zip.
  7. Invokes the moss.pl script to analyze similarities.

▶️ Usage

%> bash moodle2moss.sh <C|Java>

Example:

%> bash moodle2moss.sh Java

🗃 Output

  • submissions/: directory with all extracted and processed student submissions.
  • src_submissions.zip: archive containing all collected source files.
  • A URL to view MOSS results will be printed at the end.

🧼 Cleanup

The script removes temporary files automatically. You may delete the submissions/ directory manually if desired.

📝 Notes

  • Ensure moss.pl is placed in the same directory as the script.
  • Avoid spaces in folder and filenames when possible.
  • The script automatically handles name collisions and deeply nested archives.

📄 License

This script is released under the MIT License.

About

A script to process Moodle submissions for MOSS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages