Skip to content
This repository was archived by the owner on Mar 3, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions database/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ CREATE TABLE `levels` (
`flag` text NOT NULL,
`hint` text NOT NULL,
`penalty` int(11) NOT NULL,
`wrong_answer_penalty` int(11) NOT NULL DEFAULT 0,
`is_short_answer` tinyint(1) NOT NULL DEFAULT 1,
`answer_choice_1` text DEFAULT NULL,
`answer_choice_2` text DEFAULT NULL,
`answer_choice_3` text DEFAULT NULL,
`answer_choice_4` text DEFAULT NULL,
`created_ts` timestamp NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
Expand Down
6 changes: 6 additions & 0 deletions database/test_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ CREATE TABLE `levels` (
`flag` text NOT NULL,
`hint` text NOT NULL,
`penalty` int(11) NOT NULL,
`wrong_answer_penalty` int(11) NOT NULL DEFAULT 0,
`is_short_answer` tinyint(1) NOT NULL DEFAULT 1,
`answer_choice_1` text DEFAULT NULL,
`answer_choice_2` text DEFAULT NULL,
`answer_choice_3` text DEFAULT NULL,
`answer_choice_4` text DEFAULT NULL,
`created_ts` timestamp NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
Expand Down
25 changes: 18 additions & 7 deletions extra/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ function ok_log() {
function dl() {
local __url=$1
local __dest=$2
sudo curl --retry 5 --retry-delay 15 -sSL "$__url" -o "$__dest"
}

if [ -n "$(which wget)" ]; then
sudo wget -q "$__url" -O "$__dest"
else
sudo curl -s "$__url" -o "$__dest"
fi
function dl_pipe() {
local __url=$1
curl --retry 5 --retry-delay 15 -sSL "$__url"
}

function package_repo_update() {
Expand All @@ -53,7 +53,7 @@ function package() {

function install_unison() {
cd /
curl -sL https://www.archlinux.org/packages/extra/x86_64/unison/download/ | sudo tar Jx
dl_pipe "https://www.archlinux.org/packages/extra/x86_64/unison/download/" | sudo tar Jx
}

function repo_osquery() {
Expand Down Expand Up @@ -280,12 +280,23 @@ function install_composer() {
local __path=$1

cd $__path
curl -sS https://getcomposer.org/installer | php
dl_pipe "https://getcomposer.org/installer" | php
hhvm composer.phar install
sudo mv composer.phar /usr/bin
sudo chmod +x /usr/bin/composer.phar
}

function install_nodejs() {
log "Removing node.js legacy version"
sudo DEBIAN_FRONTEND=noninteractive apt-get remove --purge nodejs -y

log "Downloading and setting node.js version 6.x repo information"
dl_pipe "https://deb.nodesource.com/setup_6.x" | sudo -E bash -

log "Installing node.js"
package nodejs
}

function import_empty_db() {
local __u="ctf"
local __p="ctf"
Expand Down
6 changes: 1 addition & 5 deletions extra/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ package_repo_update

package git
package curl
package wget
package rsync

# Check for available memory, should be over 1GB
Expand Down Expand Up @@ -307,11 +306,8 @@ fi
fi

package ca-certificates
package npm
log "Updating npm"
sudo npm install -g npm@lts

package nodejs-legacy
install_nodejs

log "Installing all required npm node_modules"
sudo npm install --prefix "$CTF_PATH"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"dependencies": {
"d3": "^3.5.16",
"dropkickjs": "^2.1.10",
"dropkickjs": "2.1.10",
"hoverintent-jqplugin": "^0.2.1",
"jquery": "^2.2.3",
"keycode": "^2.1.1",
Expand Down
Loading