Code Monkey home page Code Monkey logo

sharif-judge's Introduction

Sharif Judge

Sharif Judge is a free and open source online judge for C, C++, Java and Python programming courses.

The web interface is written in PHP (CodeIgniter framework) and the main backend is written in BASH.

Python in Sharif Judge is not sandboxed yet. Just a low level of security is provided for python. If you want to use Sharif Judge for python, USE IT AT YOUR OWN RISK or provide sandboxing yourself.

The full documentation is at https://github.com/mjnaderi/Sharif-Judge/tree/docs

Download the latest release from https://github.com/mjnaderi/Sharif-Judge/releases

Features

  • Multiple user roles (admin, head instructor, instructor, student)
  • Sandboxing (not yet for python)
  • Cheat detection (similar codes detection) using Moss
  • Custom rule for grading late submissions
  • Submission queue
  • Download results in excel file
  • Download submitted codes in zip file
  • "Output Comparison" and "Tester Code" methods for checking output correctness
  • Add multiple users
  • Problem Descriptions (PDF/Markdown/HTML)
  • Rejudge
  • Scoreboard
  • Notifications
  • ...

Requirements

For running Sharif Judge, a Linux server with following requirements is needed:

  • Webserver running PHP version 5.3 or later with mysqli extension
  • PHP CLI (PHP command line interface, i.e. php shell command)
  • MySql or PostgreSql database
  • PHP must have permission to run shell commands using shell_exec() php function (specially shell_exec("php");)
  • Tools for compiling and running submitted codes (gcc, g++, javac, java, python2 and python3 commands)
  • It is better to have perl installed for more precise time and memory limit and imposing size limit on output of submitted code.

Installation

  1. Download the latest release from download page and unpack downloaded file in your public html directory.
  2. [Optional] Move folders system and application somewhere outside your public directory. Then save their full path in index.php file ($system_path and $application_folder variables).
  3. Create a MySql or PostgreSql database for Sharif Judge. Do not install any database connection package for C/C++, Java or Python.
  4. Set database connection settings in application/config/database.php.
  5. Make application/cache/Twig writable by php.
  6. Open the main page of Sharif Judge in a web browser and follow the installation process.
  7. Log in with your admin account.
  8. [IMPORTANT] Move folders tester and assignments somewhere outside your public directory. Then save their full path in Settings page. These two folders must be writable by PHP. Submitted files will be stored in assignments folder. So it should be somewhere not publicly accessible.
  9. [IMPORTANT] Secure Sharif Judge

After Installation

License

GPL v3

sharif-judge's People

Contributors

mjnaderi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sharif-judge's Issues

Database details

I have read the instructions of installation, when hit this : "Create a MySql or PostgreSql database for Sharif Judge. Do not install any database connection package for C/C++, Java or Python."
I did not know what the database should I create ?
I created an empty database and I set the settings as it was mentioned in the 4th instruction, but still show a blank page when I try to open the main page .
what are the tables and the fields I should create in order to run the judge ?
Thank you for taking time to read my issue .
Hope you help me .

Queue failed to process if submission take too long to complete?

Long story short, my assignments has one problems with fairly large test case. The whole problem would take Total Execution Time: 37282 ms to complete. And then the submission status just stuck at PENDING

I ssh into the server and execute php index.php queueprocess run to see the output (after change line 56 in index.php to define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); of course)

PHP Fatal error: Call to a member function row() on a non-object in /home/judge/web/testjudge.truongan.name.vn/public_html/application/models/Scoreboard_model.php on line 131

The fatal line was: $scoreboard_enabled = $this->db->select('scoreboard')->get_where('assignments', array('id'=>$assignment_id))->row()->scoreboard;

I tried to var_dump($this->db->select('scoreboard')->get_where('assignments', array('id'=>$assignment_id))) and it print out bool(false)

So my best guess is that the database access failed somehow. I was not familiar with CodeIgniter enough to investigate any further. Even The backtrace failed to printout (I don't know why) though I believe it start from applicatiopns/controllers/Queueprocess.php:135 $this->queue_model->save_judge_result_in_db($submission, $type);

Also the source code was in C++, I had sandbox turned off because it increase execution time too much.
When I did try to upload a simple "Hello world" program to the problem it execute fast enough for the system to just it as wrong. But the solution for the problem just stuck at PENDING because it took longer to executed.

If you need any more information just let me know.

Language new

I want to build more of other languages such as French, then do what?

Compilation Error on all language

hello. when i'm trying judge some codes. it gives me "compilation error" and it gaves me a code like this:

Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f9cfd000000, 2555904, 1) failed; error='Permission denied' (errno=13)
169

and if i try it with C it gaves me "File Not Found"
170

please help me.

Some problems with php7

After install and click the login, show some error information:

Fatal error: Uncaught Error: Call to a member function row() on boolean in /var/www/html/application/models/Settings_model.php:28 Stack trace: #0 /var/www/html/application/controllers/Login.php(49): Settings_model->get_setting('enable_registra...') #1 /var/www/html/system/core/CodeIgniter.php(356): Login->index() #2 /var/www/html/index.php(285): require_once('/var/www/html/s...') #3 {main} thrown in /var/www/html/application/models/Settings_model.php on line 28
A PHP Error was encountered

Severity: Error

Message: Uncaught Error: Call to a member function row() on boolean in /var/www/html/application/models/Settings_model.php:28 Stack trace: #0 /var/www/html/application/controllers/Login.php(49): Settings_model->get_setting('enable_registra...') #1 /var/www/html/system/core/CodeIgniter.php(356): Login->index() #2 /var/www/html/index.php(285): require_once('/var/www/html/s...') #3 {main} thrown

Filename: models/Settings_model.php

Line Number: 28

Backtrace:

and my php vision is:

PHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.8-0ubuntu0.16.04.2, Copyright (c) 1999-2016, by Zend Technologies

Email

Can u help me . I'd like teamview with u or u can email for me.. I'm looking for u!

Installation blank screen

Hello!

I am trying to install the script but see the blank screen (not installation page). What should I do?

my modified version of sharif judge

Hello sharif, i'm developing another version of sharif judge, for using in my colledge as a contest & practice enviroment.
Is there a problem if i use it as a colledge project, non commercial i promise???? I don't understand much about GPL.
Also, there are some features i develop

  • C# judge. C# not usually used in contest, but everyone in my colledge learn C#. It's good for beginner while they do not have to learn a new language to join algorithmic community.
  • Practice mode, which no submit time limit and ranking.
  • Optimize database. As the practice mode added, submission also grown. I do some optimization to make it more stabble when store large data. It's not best optimization yet i think, but it works well if submission does not reach million :D

p/s: here is the link https://github.com/ngoaho91/sharif-judge

Runtime Error new

i used to your zip file item and upload it. then, i copy your answer to test. but result was 0 poin.. and notify runtime error

Java network security risk

I don't know if used sandboxes used in ShJ do block network connections or not.
I, myself during the usinversity semester that i took AP in Java course, did steal test cases from judge using a simple network connection. Also i granted shell access to server which JAJ(Java Assignments Judge) was running on.

Can't Compile

When I submit, status always is pending. Please help me. Send from Ubuntu 14.04, localhost XAMPP.

Adding another language

Hello!
I just wanted to add some another languages, for example, Pascal.
I think, I have to install fpc (Free Pascal Compiler) on my server? What files should I edit to add new compiler? Do you plan to add another languages in the future?

cannot make easy sandbox

Hi, Thanks a lot to you because of your perfect judge. but I got a problem during making easy sandbox:
After building runtest.sh and runalltests.sh I tried to run make runtests but it didn't run successfully :(

This is output log:

./runalltests.sh t/test01 t/test02 t/test03 t/test04 t/test05 t/test06 t/test07 t/test08 t/test09 t/test10 t/test11 t/test12 t/test13 t/test14
Executing t/test01...failed (exit code mismatch, expected 0, got 121)
Executing t/test02...1a2

Hello, world
failed (output mismatch, expected [<>
Hello, world], got [<>])
Executing t/test03...failed (exit code mismatch, expected 137, got 121)
Executing t/test04...1a2
500500
failed (output mismatch, expected [<>
500500], got [<>])
Executing t/test05...1a2
Hello, world
failed (output mismatch, expected [<>
Hello, world], got [<>])
Executing t/test06...failed (exit code mismatch, expected 137, got 121)
Executing t/test07...1a2
59
failed (output mismatch, expected [<>
59], got [<>])
Executing t/test08...failed (exit code mismatch, expected 0, got 121)
Executing t/test09...1a2
Hello, C++ world
failed (output mismatch, expected [<>
Hello, C++ world], got [<>])
Executing t/test10...1a2
Hello from the constructor!
failed (output mismatch, expected [<>
Hello from the constructor!], got [<>])
Executing t/test11...failed (exit code mismatch, expected 137, got 121)
Executing t/test12...1a2,3
Here we are in main()
Hello from the destructor!
failed (output mismatch, expected [<>
Here we are in main()
Hello from the destructor!], got [<>])
Executing t/test13...1a2
Hello from the destructor!
failed (output mismatch, expected [<>
Hello from the destructor!], got [<>])
Executing t/test14...1a2
500500
failed (output mismatch, expected [<>
500500], got [<>])
14 test(s) failed
make: *** [runtests] Error 1
[kianoosh@mylittleserver easysandbox]$ vim .
./ ../
[kianoosh@mylittleserver easysandbox]$ vim .
./ ../
[kianoosh@mylittleserver easysandbox]$ vim makefile
[kianoosh@mylittleserver easysandbox]$ vim run
runalltests.sh runtest.sh
[kianoosh@mylittleserver easysandbox]$ vim runalltests.sh
[kianoosh@mylittleserver easysandbox]$ make runtests
./runalltests.sh t/test01 t/test02 t/test03 t/test04 t/test05 t/test06 t/test07 t/test08 t/test09 t/test10 t/test11 t/test12 t/test13 t/test14
Executing t/test01...failed (exit code mismatch, expected 0, got 121)
Executing t/test02...1a2
Hello, world
failed (output mismatch, expected [<>
Hello, world], got [<>])
Executing t/test03...failed (exit code mismatch, expected 137, got 121)
Executing t/test04...1a2
500500
failed (output mismatch, expected [<>
500500], got [<>])
Executing t/test05...1a2
Hello, world
failed (output mismatch, expected [<>
Hello, world], got [<>])
Executing t/test06...failed (exit code mismatch, expected 137, got 121)
Executing t/test07...1a2
59
failed (output mismatch, expected [<>
59], got [<>])
Executing t/test08...failed (exit code mismatch, expected 0, got 121)
Executing t/test09...1a2
Hello, C++ world
failed (output mismatch, expected [<>
Hello, C++ world], got [<>])
Executing t/test10...1a2
Hello from the constructor!
failed (output mismatch, expected [<>
Hello from the constructor!], got [<>])
Executing t/test11...failed (exit code mismatch, expected 137, got 121)
Executing t/test12...1a2,3
Here we are in main()
Hello from the destructor!
failed (output mismatch, expected [<>
Here we are in main()
Hello from the destructor!], got [<>])
Executing t/test13...1a2
Hello from the destructor!
failed (output mismatch, expected [<>
Hello from the destructor!], got [<>])
Executing t/test14...1a2
500500
failed (output mismatch, expected [<>
500500], got [<>])
14 test(s) failed
make: *** [runtests] Error 1

Testcases

Hello,
I think, that there is need to make a function to add testcases directly from web gui, because I can't give to some head instructors access to my VPS.
Kindly regards c:

Error while installation

Hello,I tried installing Sharif judge on my Ubuntu 16.04 (Desktop).
I configured required files like database.php and index.php
I made application/cache/twig writable by www-data
I opened the installation page,and i entered admin username-email and password.but when Sharif-judge is trying to make database ready,it gets an error:

  1. Sharif judge connects to the MySQL database successfully(with username: root,as i don't mind about the security)
  2. Sharif judge makes table : shj_sessions
  3. Sharif judge makes table : shj_submissions
  4. It gives error while making table: shj_assignments

Here are the screenshots:
screenshot

Edit(Added screenshot of tables):

screenshot

My system information:

OS : Ubuntu16.04
PHP Version : 7.0.4-7ubuntu2.1
MySQL Version : 5.7.12-0ubuntu1

what i have already tried:

  • re-installing sharif-judge
  • reinstalling apache2 and mysql and php,replacing php7.0 with php5.6

Mailer

Hello,
is there anyone who knows, how to switch on sending emails on register?
Kindly regards

Java Exceptions Security Risk

I understand you have restricted stderr to only show valid java exceptions and preventing user to display information by printing them into error stream, but i guess ShJ is still vulnerable to this code:

public static void main(String[] args) {
throw new java.lang.Exception("Important stuff like test case inputs or result of executing shell commands");
}

Can't Understand The tester method

I can't understand this method. I have tried several times and that fails. I have set a problem that will read two integer and will print their sum.

The tester code I have written is:

The input file is: Here

The input file only contains two numbers : "5 6"

The solution is: Here

Please help me anyone. Thanks in advance :)

Blank screen.

I am not really good in setting up sharif-judge , but when i tried to load the index.php..
i got blank white page..how to solve this problem ?

Solved Problem Indicator

Hello Everyone,
I am using Sharif Judge for a few days and faced a problem. The users are not able to see which problems they have solved. There is no indicator on the problem list table.

Anyone there who can implement it? Please?

Thanks in advance.

New Function

Hello.
I'm newbie in programming, so I would like to ask about some functions like freezing scoreboard for example during the contest or make contests able to view not by everybody, but for selected users (for example change funtion of Participants in assignment edit page). And to organize sessions, so add userid or username and date, so you can see which user was last on server.
Sorry for my poor English.
Kindly Regards c:

How to enable C++11?

I have read the documents and haven't found any answer to solve the question.And I found code in tester/tester.sh:
C_OPTIONS="-fno-asm -Dasm=error -lm -O2"
and I change it to:
C_OPTIONS="-fno-asm -Dasm=error -lm -O2 -std=c++11"
But it seems that it doesn't work.I'm not quite familiar with gcc and g++,could you tell me how to enable c++11?

BASH codes in Sharif-Judge

As the author says " the main backend is written in BASH" I want to show on these codes, but could not find any of them in the project .
Could anyone show me them or point to their location .
Thanks in advance

Attaching Tests and Descriptions

Here it says "Error: Error uploading tests zip file: The filetype you are attempting to upload is not allowed.".

Everything is at WRITE mode and the archive was a .zip

File not found

When I make a submission, It shows file not found with a blue status

Some Problems & Suggestion

As I have worked a huge time with this project, I faced some problem and have some suggestions to enrich sharif judge.
First, A large amount of programming contest is held with ACM ICPC Method. But SHJ doesn't support ICPC judgement system.
Second, Students are able to view to see the problem description before the contest starts. It is harming the security of a programming contest
Third, The reveal , that you used on your project is non-responsive. We cannot see it on small devices
Fourth, There should be a clarification System. We have implemented an Instant Messaging system alternate of it. But this feature should exist in an online judge

Fifth, Users are not able to submit their codes from text-editor.

Dear @mjnaderi , Please review these problems. If you haven't enough time to fix them, please suggest me to do so.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.