Reduce impact of bruteforce attack on solutions
This commit is contained in:
parent
bb51b8140e
commit
8601678b13
1
TODO
1
TODO
|
@ -18,7 +18,6 @@ select id_team, COUNT(*) AS t from exercice_tries group by id_team ORDER BY t;
|
|||
*** TODO upload/MAJ de fichiers depuis l'interface d'admin?
|
||||
*** TODO lors de l'import, vérifier que les ID existent => afficher les erreurs MySQL
|
||||
* Perl/shell
|
||||
** TODO Résoudre le problème potentiel de famine de l'ordonnanceur en cas de brute-force d'une équipe
|
||||
** TODO Gerer les espaces dans les fichiers (gen_hash_file plante)
|
||||
** TODO Couleur l'output de check.pl
|
||||
** TODO Pouvoir regénérer une série d'exercices pour toutes les teams
|
||||
|
|
2
check.pl
2
check.pl
|
@ -209,7 +209,7 @@ for my $f (readdir $dh)
|
|||
}
|
||||
}
|
||||
else {
|
||||
say "resetresetreset:TEAM$team,$theme:SYNCSYN";
|
||||
say "Creset:T$team,$theme:SYNC";
|
||||
|
||||
say STDERR localtime().": Team $team didn't give the correct answer for exercice $exercice.";
|
||||
}
|
||||
|
|
34
gen_site.pl
34
gen_site.pl
|
@ -175,12 +175,12 @@ sub manage
|
|||
say "Generate team: $1";
|
||||
genTeam($1, $m);
|
||||
}
|
||||
elsif (/^TEAM([0-9]+),([0-9]+)$/)
|
||||
elsif (/^T(?:E(?:A(?:M)?)?)?([0-9]+),([0-9]+)$/)
|
||||
{
|
||||
say "Generate team theme: $1/$2";
|
||||
genTeamTheme($1, $2, $m);
|
||||
}
|
||||
elsif (/^(reset)*r(e(s(e(t)?)?)?)?/)
|
||||
elsif (/^(C)?(reset)*r(e(s(e(t)?)?)?)?/)
|
||||
{
|
||||
say "Performing RESET ...";
|
||||
remove_tree($main::tmpdir);
|
||||
|
@ -325,6 +325,14 @@ sub parse($$;$)
|
|||
|
||||
for my $cmd ($cmds =~ /([^:]+)/g)
|
||||
{
|
||||
if ($cmd =~ "^Creset")
|
||||
{
|
||||
if ($queue->pending() > 5) {
|
||||
say $chan_output "Skip item $cmd, due to huge queue length: ".$queue->pending();
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
my $i;
|
||||
if ($cmd =~ "^(un)?freeze")
|
||||
{
|
||||
|
@ -357,12 +365,22 @@ sub parse($$;$)
|
|||
# Search the right position
|
||||
for ($i = 0; $i < $queue->pending(); $i++)
|
||||
{
|
||||
last if ($len > length($queue->peek($i)));
|
||||
my $itm = $queue->peek($i);
|
||||
last if ($cmd eq $itm);
|
||||
last if ($len > length($itm));
|
||||
}
|
||||
}
|
||||
say $chan_output "Inserting $cmd at position $i/".$queue->pending();
|
||||
$queue->insert($i, $cmd);
|
||||
$change_current = 1 if $i == 0 && $queue->pending() != 1;
|
||||
|
||||
if ($i < $queue->pending() && $queue->peek($i) eq $cmd)
|
||||
{
|
||||
say $chan_output "Skip item $cmd, already at position $i/".$queue->pending();
|
||||
}
|
||||
else
|
||||
{
|
||||
say $chan_output "Inserting $cmd at position $i/".$queue->pending();
|
||||
$queue->insert($i, $cmd);
|
||||
$change_current = 1 if $i == 0 && $queue->pending() != 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($change_current)
|
||||
|
@ -948,6 +966,10 @@ Generate pages for the C<11> theme for the team C<00>.
|
|||
|
||||
Clean the temporary directory.
|
||||
|
||||
=item B<Creset>
|
||||
|
||||
Clean the temporary directory, only if the queue has less than 5 items.
|
||||
|
||||
=item B<DSYNC>
|
||||
|
||||
Made a full synchronization of the output directory (remove existing output dir
|
||||
|
|
Loading…
Reference in New Issue
Block a user