{"id":27215605,"url":"https://github.com/anubislms/mayat","last_synced_at":"2025-10-15T03:31:30.792Z","repository":{"id":42395000,"uuid":"460069492","full_name":"AnubisLMS/Mayat","owner":"AnubisLMS","description":"Experimental AST-Based Source Code Similarity Detection Tool","archived":false,"fork":false,"pushed_at":"2024-04-10T06:22:50.000Z","size":884,"stargazers_count":23,"open_issues_count":3,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-16T02:04:14.133Z","etag":null,"topics":["anticheat","antiplagiarism","ast","c","education","plagiarism-checker","plagiarism-detection","python"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AnubisLMS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-16T15:45:23.000Z","updated_at":"2025-03-16T08:22:52.000Z","dependencies_parsed_at":"2025-04-10T04:32:48.105Z","dependency_job_id":"34877851-5f6e-48c9-bd39-5b461ef98336","html_url":"https://github.com/AnubisLMS/Mayat","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/AnubisLMS/Mayat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnubisLMS%2FMayat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnubisLMS%2FMayat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnubisLMS%2FMayat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnubisLMS%2FMayat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnubisLMS","download_url":"https://codeload.github.com/AnubisLMS/Mayat/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnubisLMS%2FMayat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260083860,"owners_count":22956407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anticheat","antiplagiarism","ast","c","education","plagiarism-checker","plagiarism-detection","python"],"created_at":"2025-04-10T04:26:08.819Z","updated_at":"2025-10-15T03:31:25.752Z","avatar_url":"https://github.com/AnubisLMS.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mayat\n\n**Mayat** is a code similarity detection tool developed by [Tian(Maxwell) Yang](https://github.com/AlpacaMax). It works by comparing the Abstract Syntax Trees of students' code solutions and generate a similarity score for each pair of students' code.\n\n## Install\n\n```\npip install mayat\npython -m mayat.install_langs\n```\n\n## Usage\nLet's say we need to check all students' `uniq.c` for homework1. The path for each `uniq.c` has the format `homework1/\u003cunique-id\u003e/user/uniq.c`. All we need to do is run:\n```\npython -m mayat.frontends.TS_C homework1/*/user/uniq.c\n```\n\nIf we only want to check the `main` function, we can do:\n```\npython -m mayat.frontends.TS_C homework1/*/user/uniq.c -f main\n```\n\nAdditionally, we can pass more optional arguments for `C.py`:\n   - `--threshold`: Specify the granularity for the matching algorithm. Default to `5`. A smaller value will cause it to check trivial details, which increases the similarity score of two code even though they might not be similar. A larger value will cause it to overlook some common cheat tricks such as swapping two function definitions.\n\n## Supported Languages\n- **C**:\n  - `mayat.TS_C`\n  - `mayat.C`(Legacy)\n- **Python**:\n  - `mayat.TS_Python`\n  - `mayat.Python`(Legacy)\n- **Java**:\n  - `mayat.TS_Java`\n\n## Implement a New PL's frontend\nWe implement a new programming language's frontend by using classes and functions defined in `mayat`. They are:\n- `mayat.AST.AST`: The base class for Abstract Syntax Tree. For a new PL you should inherit this and implement the `AST.create(path)` class method, which takes the path of a program as a parameter and returns the AST representation of that program. Currently it is preferred to use `tree-sitter` parsers to implement language frontends, whose corresponding file should be prefixed with `TS_`.\n- `mayat.args.arg_parser`: A `argparse.ArgumentParser` object. We need to use this object to retrieve command arguments. We can add new arguments if needed.\n- `mayat.driver.driver`: The driver function that takes the inherited AST class and the parsed arguments as parameters and run the plagiarism detection algorithm.\n\nAn example of this can be find in `mayat/frontends/TS_C.py`, which is a C frontend implemented using `tree-sitter-c` parser.\n\n## Testing\n```\ncd tests\npython test.py -v\n```\n\n## Limitations\nThis tool will never work for assembly code as the code has to be written in a high level programming language that can be converted into an AST. We can potentially figure out a way to automatically reverse engineer assembly code back to C and then convert it to AST. However, there's no guarantee that the reverse-engineered code can be a good representation for its assembly counterpart.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanubislms%2Fmayat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanubislms%2Fmayat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanubislms%2Fmayat/lists"}