-
Notifications
You must be signed in to change notification settings - Fork 2
/
start.sh
executable file
·59 lines (47 loc) · 1.19 KB
/
start.sh
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
if [ $NOASLR ]
then
echo -n "
kernel.randomize_va_space=0
" >> /etc/sysctl.conf
fi
echo "Remounting /proc for preventing users from seeing each other's processes..."
sudo mount -o remount,hidepid=2 /proc
echo "Disabling read of others users' data on /tmp..."
chmod 1732 /tmp /var/tmp /dev/shm
echo "Protect your files"
chown root:root /pwnpeii
chmod 700 /pwnpeii
echo "Copying over resources"
cp /pwnpeii/mount/* /home/problemuser
echo "Changing ownership of problemuser..."
chown -R root:problemusers /home/problemuser
echo "Setting permissions..."
chmod 750 /home/problemuser
chmod 550 -R /home/problemuser/*
chmod 440 /home/problemuser/flag.txt
# For cgroups
sudo cgconfigparser -l /etc/cgconfig.conf
echo "Writing the xinetd conf file..."
echo "
service ctf
{
disable = no
socket_type = stream
protocol = tcp
wait = no
user = root
bind = 0.0.0.0
per_source = 3
cps = 100 5
server = /pwnpeii/scripts/runner.sh
port = 9998
}" | tee /etc/xinetd.d/ctf
echo "Adding new service to /etc/services"
echo "
ctf 9998/tcp
" >> /etc/services
# Run xinetd
/etc/init.d/xinetd start
# This runs forever
/pwnpeii/scripts/cleanup.sh