Changes for community CTF.

This commit is contained in:
James Barnett 2017-11-07 15:13:46 -06:00
parent 86c5d2d71d
commit 23b71528fd
3 changed files with 56 additions and 58 deletions

View File

@ -47,54 +47,7 @@ file '/opt/docker/7_of_diamonds.zip' do
action :delete action :delete
end end
if ENV['MS3_LINUX_HARD'] # Easy mode flags
# 5 of Diamonds
include_recipe 'metasploitable::knockd'
directory '/opt/knock_knock' do
mode '0700'
end
cookbook_file '/opt/knock_knock/five_of_diamonds' do
source 'flags/five_of_diamonds'
mode '0700'
end
cookbook_file '/etc/init/five_of_diamonds_srv.conf' do
source 'flags/five_of_diamonds_srv'
mode '0777'
end
service 'five_of_diamonds_srv' do
action [:enable, :start]
end
# 2 of Spades
cookbook_file '/home/leia_organa/2_of_spades.pcapng' do
source 'flags/2_of_spades.pcapng'
owner 'leia_organa'
mode '0600'
end
# 8 of Hearts
include_recipe 'metasploitable::mysql'
bash "load 8 of hearts into DB" do
code <<-EOH
mysql -h 127.0.0.1 --user="root" --password="sploitme" --execute="CREATE DATABASE super_secret_db;"
mysql -h 127.0.0.1 --user="root" --password="sploitme" --execute="GRANT SELECT, INSERT, DELETE, CREATE, DROP, INDEX, ALTER ON drupal.* TO 'root'@'localhost' IDENTIFIED BY 'sploitme';"
mysql -h 127.0.0.1 --user="root" --password="sploitme" super_secret_db < #{File.join(Chef::Config[:file_cache_path], 'cookbooks', 'metasploitable', 'files', 'flags', 'super_secret_db.sql')}
EOH
not_if "mysql -h 127.0.0.1 --user=\"root\" --password=\"sploitme\" --execute=\"SHOW DATABASES LIKE 'super_secret_db'\" | grep -c drupal"
end
# Joker - red
cookbook_file '/etc/joker.png' do
source 'flags/joker.png'
mode '0600'
end
else
# 10 of Spades # 10 of Spades
include_recipe 'metasploitable::readme_app' include_recipe 'metasploitable::readme_app'
@ -146,7 +99,52 @@ else
execute 'build locate database' do execute 'build locate database' do
command 'updatedb' command 'updatedb'
end end
# Hard mode flags
if ENV['MS3_LINUX_HARD']
# 5 of Diamonds
include_recipe 'metasploitable::knockd'
directory '/opt/knock_knock' do
mode '0700'
end end
cookbook_file '/opt/knock_knock/five_of_diamonds' do
source 'flags/five_of_diamonds'
mode '0700'
end
cookbook_file '/etc/init/five_of_diamonds_srv.conf' do
source 'flags/five_of_diamonds_srv'
mode '0777'
end
service 'five_of_diamonds_srv' do
action [:enable, :start]
end
# 2 of Spades
cookbook_file '/home/leia_organa/2_of_spades.pcapng' do
source 'flags/2_of_spades.pcapng'
owner 'leia_organa'
mode '0600'
end
# 8 of Hearts
include_recipe 'metasploitable::mysql'
bash "load 8 of hearts into DB" do
code <<-EOH
mysql -h 127.0.0.1 --user="root" --password="sploitme" --execute="CREATE DATABASE super_secret_db;"
mysql -h 127.0.0.1 --user="root" --password="sploitme" --execute="GRANT SELECT, INSERT, DELETE, CREATE, DROP, INDEX, ALTER ON drupal.* TO 'root'@'localhost' IDENTIFIED BY 'sploitme';"
mysql -h 127.0.0.1 --user="root" --password="sploitme" super_secret_db < #{File.join(Chef::Config[:file_cache_path], 'cookbooks', 'metasploitable', 'files', 'flags', 'super_secret_db.sql')}
EOH
not_if "mysql -h 127.0.0.1 --user=\"root\" --password=\"sploitme\" --execute=\"SHOW DATABASES LIKE 'super_secret_db'\" | grep -c drupal"
end
# Joker - red
cookbook_file '/etc/joker.png' do
source 'flags/joker.png'
mode '0600'
end
end

View File

@ -51,6 +51,6 @@
"iso_url": "http://old-releases.ubuntu.com/releases/14.04.1/ubuntu-14.04.1-server-amd64.iso", "iso_url": "http://old-releases.ubuntu.com/releases/14.04.1/ubuntu-14.04.1-server-amd64.iso",
"iso_checksum_type": "md5", "iso_checksum_type": "md5",
"iso_checksum": "ca2531b8cd79ea5b778ede3a524779b9", "iso_checksum": "ca2531b8cd79ea5b778ede3a524779b9",
"box_version": "0.1.12" "box_version": "0.1.18"
} }
} }

View File

@ -125,6 +125,6 @@
"iso_url": "http://old-releases.ubuntu.com/releases/14.04.1/ubuntu-14.04.1-server-amd64.iso", "iso_url": "http://old-releases.ubuntu.com/releases/14.04.1/ubuntu-14.04.1-server-amd64.iso",
"iso_checksum_type": "md5", "iso_checksum_type": "md5",
"iso_checksum": "ca2531b8cd79ea5b778ede3a524779b9", "iso_checksum": "ca2531b8cd79ea5b778ede3a524779b9",
"box_version": "0.1.5" "box_version": "0.1.12"
} }
} }