{"id":13648640,"url":"https://github.com/thu-cs-lab/jieplag","last_synced_at":"2025-04-11T01:10:36.337Z","repository":{"id":200009727,"uuid":"322172565","full_name":"thu-cs-lab/jieplag","owner":"thu-cs-lab","description":"Plagiarism detection tool in Rust (inspired by Stanford Moss)","archived":false,"fork":false,"pushed_at":"2024-12-10T01:41:40.000Z","size":320,"stargazers_count":50,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-24T21:51:09.091Z","etag":null,"topics":["plagiarism-detection","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/thu-cs-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-12-17T03:46:08.000Z","updated_at":"2025-03-03T06:33:40.000Z","dependencies_parsed_at":"2024-07-11T06:47:46.635Z","dependency_job_id":"5f778895-65a5-4a9a-a3de-0a0a4bc3ddec","html_url":"https://github.com/thu-cs-lab/jieplag","commit_stats":null,"previous_names":["thu-cs-lab/jieplag"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thu-cs-lab%2Fjieplag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thu-cs-lab%2Fjieplag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thu-cs-lab%2Fjieplag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thu-cs-lab%2Fjieplag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thu-cs-lab","download_url":"https://codeload.github.com/thu-cs-lab/jieplag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248322600,"owners_count":21084337,"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":["plagiarism-detection","rust"],"created_at":"2024-08-02T01:04:25.042Z","updated_at":"2025-04-11T01:10:36.314Z","avatar_url":"https://github.com/thu-cs-lab.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# JiePlag\n\nJiePlag is a plagiarism checker for checking code similarity. It currently supports the following languages:\n\n1. C/C++\n2. Rust\n3. Python\n4. Verilog\n5. SQL\n6. JavaScript\n7. Lua\n\nIt supports standalone mode (see `Local binaries` section) and client-server mode (see `Run server` section).\n\n## Local binaries\n\n* `core/src/bin/find_pairs.rs`: Find pairs of files that contain possible plagiarism\n* `core/src/bin/compute_matches.rs`: Compute matched text blocks from two source files (and optional teamplte file)\n\nExample for `find_pairs`:\n\n```shell\n$ RUST_LOG=info cargo run --bin find_pairs -- --source-directory examples/aplusb/students --template-directory examples/aplusb/template --include cpp\nPossible plagarism: examples/aplusb/students/student1 and examples/aplusb/students/student3: 3 matches\n```\n\nExample for `compute_matches`:\n\n```shell\n$ cargo run --bin compute_matches -- --left examples/aplusb/students/student1/main.cpp --right examples/aplusb/students/student3/main.cpp\nMatch #1:\nL0-L14:\n#include \u003cstdio.h\u003e\n\nint aplusb(int a, int b) {\n  // implement aplusb\n  return a+b;\n}\n\nint main() {\n  // implement input/output\n  int a, b;\n  scanf(\"%d%d\", \u0026a, \u0026b);\n  int c = aplusb(a, b);\n  printf(\"%d\\n\", c);\n  return 0;\n}\nMatch #1:\nL0-L14:\n#include \u003cstdio.h\u003e\n\nint aplusb(int a, int b)\n{\n  return a + b;\n}\n\nint main()\n{\n  int a, b;\n  scanf(\"%d %d\", \u0026a, \u0026b);\n  int c = aplusb(a, b);\n  printf(\"%d\\n\", c);\n  return 0;\n}\n$ cargo run --bin compute_matches -- --left examples/aplusb/students/student1/main.cpp --right examples/aplusb/students/student4/main.cpp\nMatch #1:\nL4-L14:\n  return a+b;\n}\n\nint main() {\n  // implement input/output\n  int a, b;\n  scanf(\"%d%d\", \u0026a, \u0026b);\n  int c = aplusb(a, b);\n  printf(\"%d\\n\", c);\n  return 0;\n}\nMatch #1:\nL4-L14:\n  return a-b+b+b;\n}\n\nint main() {\n  // implement input/output\n  int a, b;\n  scanf(\"%d%d\", \u0026a, \u0026b);\n  int c = aplusb(a, b);\n  printf(\"%d\\n\", c);\n  return 0;\n}\n```\n\n## Run server\n\nConfiguration: `server/.env.sample`.\n\n* `server/src/bin/create_user.rs`: Create users in database\n* `server/src/bin/server.rs`: Run web server to accept requests\n* `client/srv/bin/cli.rs`: CLI tool to submit to server\n\nAfter submission via CLI, a link will be generated to view in browser. An example webpage is provided at `examples/aplusb/html`, you can view it via:\n\n```shell\ncd examples/aplusb/html\npython3 -m http.server\n# in another shell\nopen http://127.0.0.1:8000/\n```\n\nTo setup jieplag server, the following steps are required:\n\n1. Setup postgresql database\n2. Copy `server/.env.sample` to `.env` and change the contents accordingly\n3. Build server and run it\n4. Use `create_user` to create new user\n5. Use `cli` to submit code to jieplag\n\nSetup postgres database in postgres shell:\n\n```sql\ncreate database jieplag;\ncreate user jieplag with encrypted password 'REDACTED';\ngrant all privileges on database jieplag to jieplag;\n\\c jieplag postgres\ngrant all on schema public to jieplag;\n```\n\nCopy `.env.sample` to `.env` and edit:\n\n```env\nDATABASE_URL=postgres://DB_USER_HERE:DB_PASSWORD_HERE@DB_HOSTNAME_HERE/jieplag\nCOOKIE_SECRET=PUT_SOME_RANDOM_LONG_SECRET_HERE\nPUBLIC_URL=http://PUBLIC_HOSTNAME_HERE/SUBPATH_IS_SUPPORTED\n```\n\nRun server:\n\n```shell\nRUST_LOG=info cargo run --bin server\n```\n\nPlease ensure you are running server under the same (or descendant) directory where `.env` is located, due to how `dotenv` works.\n\nCreate user:\n\n```shell\ncargo run --bin create_user -- --user-name USER_NAME_HERE --password PASSWORD_NAME_HERE [--force]\n```\n\nSubmit code:\n\n```shell\ncargo run --bin cli -- --language cc --user-name USER_NAME_HERE --password PASSWORD_HERE [--template PATH_TO_TEMPLATE_CODE] PATH_TO_STUDENT1_CODE PATH_TO_STUDENT2_CODE ...\n```\n\n## Acknowledgements\n\nJiePlag is highly influenced by Stanford MOSS. Due to frequent outage of Stanford MOSS, we created JiePlag as a open source software clone. We re-implemented [winnow](https://theory.stanford.edu/~aiken/publications/papers/sigmod03.pdf) algorithm and mimicked the web interface of Stanford MOSS.\n\nWe highly thanked Stanford MOSS for their great contributions to the teaching community.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthu-cs-lab%2Fjieplag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthu-cs-lab%2Fjieplag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthu-cs-lab%2Fjieplag/lists"}