50 private links
- Hold down the Windows key and press R to bring up the Run dialog.
- Type
gpedit.msc
and press Enter. You will need administrator privileges to continue. - Navigate to User Configuration > Administrative Templates > Windows Components > Attachment Manager.
- In the right-side pane, double-click "Do not preserve zone information in file attachments", set it to Enabled, then press OK.
wsl.exe --shutdown
cd ~\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\
optimize-vhd -Path .\ext4.vhdx -Mode full
Installing the prerequisites
sudo apt update
sudo apt upgrade
sudo apt install build-essential python3-dev python3-pip libseccomp-dev libxml2-dev libxslt1-dev zlib1g-dev gettext curl redis-server mariadb-server libmysqlclient-dev
nvm install 18
nvm alias default 18
Creating the database
sudo service mariadb start
sudo mysql_secure_installation
sudo mysql
CREATE USER 'dmoj'@'localhost' IDENTIFIED BY 'PASSWORD';
CREATE USER 'dmoj'@'%' IDENTIFIED BY 'PASSWORD';
CREATE DATABASE dmoj DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES ON dmoj.* TO 'dmoj'@'localhost';
GRANT ALL PRIVILEGES ON dmoj.* TO 'dmoj'@'%';
exit
Cloning VNOJ
git clone --recursive https://github.com/VNOI-Admin/OJ.git
cd OJ
Installing prerequisites
We will create a virtual environment with pyenv
and install the dependencies:
pyenv install 3.11.9
pyenv virtualenv 3.11.9 vnoj
pyenv local vnoj
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
pip install -r additional_requirements.txt
pip install flake8 flake8-import-order flake8-future-import flake8-commas flake8-logging-format flake8-quotes
npm install
Configuring
Start up the Redis server, which is needed by the Celery workers:
sudo service redis-server start
Download the sample settings file:
cd dmoj
wget https://github.com/DMOJ/docs/raw/master/sample_files/local_settings.py
You will now need to configure dmoj/local_settings.py
. You need to update MySQL credentials and the secret key and uncommenting CELERY_BROKER_URL
and CELERY_RESULT_BACKEND
. By default, Redis listens on localhost
port 6379
, which is reflected in local_settings.py
. You will need to update the addresses if you changed Redis's settings.
Now, verify that everything is going according to plan:
./manage.py check
Compiling assets
Compile and optimize the stylesheets:
./make_style.sh
Collect static files into STATIC_ROOT
as specified in dmoj/local_settings.py
:
./manage.py collectstatic --no-input
Generate internationalization files:
./manage.py compilemessages
./manage.py compilejsi18n
Setting up database tables
If you have a database backup, skip this step.
Generate the schema for the database and load some initial data:
./manage.py migrate
./manage.py loaddata navbar
./manage.py loaddata language_small
./manage.py loaddata demo
Create an admin account:
./manage.py createsuperuser
Running the server
You need to start MySQL and Redis after restart:
sudo service mariadb start
sudo service redis-server start
Let's run the server, and see if it all works:
./manage.py runserver 0.0.0.0:8000
Volatility is no longer packaged with Kali since 2020.4 release but can be manually installed.
sudo apt-get install pcregrep libpcre++-dev python-dev
git clone https://github.com/gdabah/distorm.git
cd distorm3
sudo python setup.py install
sudo apt-get install yara -y
wget https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.1.tar.gz
tar -xvzf pycrypto-2.6.1.tar.gz
cd pycrypto-2.6.1
sudo python setup.py install
wget https://github.com/volatilityfoundation/volatility/archive/refs/tags/2.6.1.tar.gz
tar -xvzf 2.6.1.tar.gz
cd volatility-2.6.1
sudo python setup.py install
Some web challenges require executing /readflag
to get the flag. This executable will ask the user to compute some simple math. The timeout is very short, so the intended way to solve it is to write a script. However, there are better ways to solve it:
Solution 1: Trap the SIGALRM signal
$ trap "" 14 && /readflag
Solve the easy challenge first (((((-623343)+(913340))+(-511878))+(791102))-(956792))
input your answer: -387571
ok! here is your flag!!
Solution 2: mkfifo trick
$ mkfifo pipe
$ cat pipe | ./readflag |(read l;read l;echo "$(($l))" > pipe;cat)
input your answer:
ok! here is your flag!!
Ref: https://balsn.tw/ctf_writeup/20190427-*ctf/#solve_readflag-(not-a-challenge)
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libc6:i386 libncurses5:i386 libstdc++6:i386
sudo apt install gcc-multilib g++-multilib # for compiling
In the spirit of OpenCourseWare and the Khan Academy, OpenSecurityTraining.info is dedicated to sharing training material for computer security classes, on any topic, that are at least one day long.
An inventory of tools and resources about CyberSecurity.
Install dependencies
sudo apt install build-essential texlive-latex-base openjdk-8-jdk-headless fp-compiler \
postgresql postgresql-contrib postgresql-client python3 python3-dev python3-pip \
cppreference-doc-en-html cgroup-lite wget curl llvm make tk-dev xz-utils zip \
libbz2-dev libcap-dev libcups2-dev libffi-dev libncursesw5-dev libpq-dev \
libreadline-dev libsqlite3-dev libssl-dev libxml2-dev libxmlsec1-dev libyaml-dev liblzma-dev zlib1g-dev
Install pyenv:
curl https://pyenv.run | bash
You may need to enable memory cgroup: https://github.com/canonical/microk8s/issues/1691#issuecomment-1279774327
Download CMS
cd ~
git clone --recursive https://github.com/ioi-2023/cms.git
Preparation
In order to run CMS, there are some preparation steps to run (like installing the sandbox, compiling localization files, creating the cmsuser
group, and so on).
cd ~/cms
sudo python3 prerequisites.py install
Installing CMS and its Python dependencies
We'll install CMS in a virtual environment created by pyenv
.
pyenv install 3.8.18
pyenv virtualenv 3.8.18 cms
pyenv local cms
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
python setup.py install
We also need to fix pycryptodomex
:
2to3 -wWn --no-diffs ~/.pyenv/versions/cms/lib/python3.8/site-packages/Cryptodome
Configure the DB
We first need to start PostgreSQL:
sudo service postgresql start
The next thing to do is to create the user and the database. You need to log in as the postgres
user first:
sudo su - postgres
Then, to create the user (which does not need to be a superuser, nor be able to create databases nor roles) and the database, run the following commands:
createuser --username=postgres --pwprompt cmsuser
createdb --username=postgres --owner=cmsuser cmsdb
psql --username=postgres --dbname=cmsdb --command='ALTER SCHEMA public OWNER TO cmsuser'
psql --username=postgres --dbname=cmsdb --command='GRANT SELECT ON pg_largeobject TO cmsuser'
The last two lines are required to give the PostgreSQL user some privileges which it does not have by default, despite being the database owner.
Enter exit
to log out.
Configure CMS
Open /usr/local/etc/cms.conf
and change the connection string given in database
. This means to change username, password, and database with the ones you chose before.
Finally, you have to create the database schema for CMS:
cd ~/cms
cmsInitDB
Running CMS
Run WSLHostPatcher to make WSL2 listen for incoming connection on any interfaces (by default it only listens on localhost).
You need to create an admin user. This only needs to be done once:
cmsAddAdmin -p PASSWORD USERNAME
Start LogService:
cmsLogService
Start cmsAdminWebServer:
cmsAdminWebServer
Log in to the admin interface and create some contests. Now we can start all CMS services:
cmsResourceService -a