The operations here include:
- Find initial MySQL database user name and password;
- The csrf to a fixed value;
- User submitted adjacent to cancel the same time interval of 10 seconds limit.
It reads as follows:
- System: ubuntu18.04.2
- hustoj Download: https://github.com/zhblue/hustoj
Use the following command to download and install the hustoj to local:
wget https://github.com/zhblue/hustoj/raw/master/trunk/install/install-ubuntu18.04.sh
sudo bash install-ubuntu18.04.sh
It takes a while.
After installing the first user name admin
password admin123
registered user.
And then view the /home/judge/etc/judge.conf
files can be found that there are some data:
...
OJ_USER_NAME=debian-sys-maint
OJ_PASSWORD=zRqrwJIMreGPLD4N
OJ_DB_NAME=jol
...
Where OJ_USER_NAME
, OJ_PASSWORD
, OJ_DB_NAME
corresponding to your MySQL database user name, password, and database.
For each issue, such as the number 1000
of problems, his data is stored in /home/judge/data/1000/
the directory of.
Modify csrf.php
`` The original file looks like this:
<?php
require_once("include/db_info.inc.php");
require_once("include/my_func.inc.php");
$token = getToken();
if(!isset($_SESSION[$OJ_NAME.'_'.'csrf_keys'])){
$_SESSION[$OJ_NAME.'_'.'csrf_keys']=array();
}
array_push($_SESSION[$OJ_NAME.'_'.'csrf_keys'],$token);
while(count($_SESSION[$OJ_NAME.'_'.'csrf_keys'])>10)
array_shift($_SESSION[$OJ_NAME.'_'.'csrf_keys']);
?><input type="hidden" name="csrf" value="<?php echo $token?>" class="<?php echo in_array($token,$_SESSION[$OJ_NAME.'_'.'csrf_keys'])?>">
Direct modified to:
<?php
?><input type="hidden" name="csrf" value="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" class="<?php echo in_array($token,$_SESSION[$OJ_NAME.'_'.'csrf_keys'])?>">
Then every time we lose csrf values are 32 a
on it: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
.
The default boot does not start nginx, so to enter the following command to start the nginx server at the command line:
sudo nginx
If the default submit Taiwan frequently, it will complain: "You should not submit more than twice in 10 seconds"
So we have to remove this restriction, the solution is to modify the src/web/submit.php
file, which will be snippet:
if (count($res)==1){
$view_errors="You should not submit more than twice in 10 seconds.....<br>";
require("template/".$OJ_TEMPLATE."/error.php");
exit(0);
}
Comment out, that becomes:
// if (count($res)==1){
// $view_errors="You should not submit more than twice in 10 seconds.....<br>";
// require("template/".$OJ_TEMPLATE."/error.php");
// exit(0);
// }