blob: a6d205a529793ea61b80e9bc8425f83b1529d2cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/bin/bash
if [ "`id -u`" != "0" ]; then
echo "Must be run as root"
exit 1
fi
fnam=`echo "$1" | tr -cd '[[:alnum:]]._-/'`
if [ "$fnam" != "" -a -r "$fnam" ]; then
mkdir -p /root/submissions
chown root /root/submissions
chmod 700 /root/submissions
nom=/root/submissions/`date +%s%N`.bocarun.tmp
cat "$fnam" | tr -cd '[[:alnum:]]._+-/= ' > "$nom"
echo "dateerr=`date +%s`" >> "$nom"
uniq=`date +%sN`-`sha256sum "$1"`
uniq=`echo $uniq | sha256sum - | cut -f1 -d' '`
code=`cat /root/submissions/code`
res=`echo -n "${code}${uniq}${dateerr}" | sha256sum - | cut -f1 -d' '`
echo "uniq=$uniq" >> "$nom"
echo "code=$res" >> "$nom"
mv "$nom" "/root/submissions/`basename $nom .tmp`"
fi
|