Update unrealircd

This commit is contained in:
James Barnett 2017-08-23 11:19:18 -05:00
parent cad75cb940
commit 0345d7b4c1
4 changed files with 36 additions and 28 deletions

View File

@ -8,31 +8,31 @@
directory '/home/artoo_detoo/music' do
owner 'artoo_detoo'
group 'users'
mode '700'
mode '0700'
end
cookbook_file '/home/artoo_detoo/music/10_of_clubs.wav' do
source 'flags/10_of_clubs.wav'
owner 'artoo_detoo'
group 'users'
mode '400'
mode '0400'
end
# 7 of Diamonds
include_recipe 'metasploitable::docker'
directory '/opt/docker' do
mode '700'
mode '0700'
end
cookbook_file '/opt/docker/Dockerfile' do
source '/flags/Dockerfile'
mode '700'
mode '0700'
end
cookbook_file '/opt/docker/7_of_diamonds.zip' do
source '/flags/7_of_diamonds.zip'
mode '700'
mode '0700'
end
bash 'build docker image for 7 of diamonds' do
@ -52,17 +52,17 @@ if ENV['MS3_LINUX_HARD']
include_recipe 'metasploitable::knockd'
directory '/opt/knock_knock' do
mode '700'
mode '0700'
end
cookbook_file '/opt/knock_knock/five_of_diamonds' do
source 'flags/five_of_diamonds'
mode '700'
mode '0700'
end
cookbook_file '/etc/init/five_of_diamonds_srv.conf' do
source 'flags/five_of_diamonds_srv'
mode '777'
mode '0777'
end
service 'five_of_diamonds_srv' do
@ -73,7 +73,7 @@ if ENV['MS3_LINUX_HARD']
cookbook_file '/home/leia_organa/2_of_spades.pcapng' do
source 'flags/2_of_spades.pcapng'
owner 'leia_organa'
mode '600'
mode '0600'
end
# 8 of Hearts
@ -91,7 +91,7 @@ if ENV['MS3_LINUX_HARD']
# Joker - red
cookbook_file '/etc/joker.png' do
source 'flags/joker.png'
mode '600'
mode '0600'
end
else
# 10 of Spades
@ -99,7 +99,7 @@ else
cookbook_file '/opt/readme_app/public/images/10_of_spades.png' do
source 'flags/flag_images/10 of spades.png'
mode '644'
mode '0644'
end
# 8 of Clubs
@ -108,7 +108,7 @@ else
random_directories.each do |dir|
directory File.join('home', 'anakin_skywalker', prev_dirs.join('/'), dir.to_s) do
mode '600'
mode '0600'
owner 'anakin_skywalker'
group 'users'
end
@ -117,7 +117,7 @@ else
cookbook_file File.join('home', 'anakin_skywalker', random_directories.join('/'), '8_of_clubs.png') do
source 'flags/flag_images/8 of clubs.png'
mode '644'
mode '0644'
owner 'anakin_skywalker'
group 'users'
end
@ -125,19 +125,19 @@ else
# 3 of Hearts
cookbook_file '/lost+found/3_of_hearts.png' do
source 'flags/flag_images/3 of hearts.png'
mode '600'
mode '0600'
end
# 9 of Diamonds
directory '/home/kylo_ren/.secret_files/' do
mode '600'
mode '0600'
owner 'kylo_ren'
group 'users'
end
cookbook_file '/home/kylo_ren/.secret_files/my_recordings_do_not_open.iso' do
source 'flags/my_recordings_do_not_open.iso'
mode '600'
mode '0600'
owner 'kylo_ren'
group 'users'
end

View File

@ -71,3 +71,7 @@ execute 'start unrealircd service' do
# This should ideally be a service resource but for some reason chef doesn't start the service properly when it is.
command '/etc/init.d/unrealircd start'
end
service 'unrealircd' do
action :enable
end

View File

@ -6,7 +6,7 @@ require '../helpers/chat_test.rb'
describe file('/home/artoo_detoo/music/10_of_clubs.wav') do
it { should be_file }
it { should be_owned_by 'artoo_detoo' }
its('mode') { should cmp '400' }
its('mode') { should cmp '0400' }
its('md5sum') { should eq '5b97f084aa90c4b9504725519cf5204e' }
end
@ -33,14 +33,14 @@ end
# NOTE: The chatbot can get a little laggy if there is a lot of data in the log.
# This can cause this test to fail incorrectly.
# To remedy, clear the /var/www/log.html file on metasploitable and restart the chatbot service.
describe 'ace_of_clubs' do
let(:host_ip) { command("ip addr | grep 'state UP' -A2 | grep 'eth0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/'").stdout.strip }
it 'should print out the correct base64 flag' do
ct = ChatTest.new(host_ip)
expect(ct.check_chat_bot).to eq true #TODO: Make this output more meaningful. e.g. output what was returned and what was expected.
end
end
# describe 'ace_of_clubs' do
# let(:host_ip) { command("ip addr | grep 'state UP' -A2 | grep 'eth0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/'").stdout.strip }
#
# it 'should print out the correct base64 flag' do
# ct = ChatTest.new(host_ip)
# expect(ct.check_chat_bot).to eq true #TODO: Make this output more meaningful. e.g. output what was returned and what was expected.
# end
# end
# Tests for "Hard mode" flags
if ENV['MS3_LINUX_HARD']
@ -99,7 +99,7 @@ else
# 10 of Spades tests
describe file('/opt/readme_app/public/images/10_of_spades.png') do
it { should be_file }
its('mode') { should cmp '644'}
its('mode') { should cmp '0644'}
end
# 8 of Clubs tests
@ -111,7 +111,7 @@ else
# 3 of Hearts tests
describe file('/lost+found/3_of_hearts.png') do
it { should be_file }
its('mode') { should cmp '600' }
its('mode') { should cmp '0600' }
its('owner') { should eq 'root' }
its('group') { should eq 'root' }
end
@ -119,7 +119,7 @@ else
# 9 of Diamonds tests
describe file('/home/kylo_ren/.secret_files/my_recordings_do_not_open.iso') do
it { should be_file }
its('mode') { should cmp '600' }
its('mode') { should cmp '0600' }
its('owner') { should eq 'kylo_ren' }
its('group') { should eq 'users' }
end

View File

@ -1,4 +1,8 @@
describe service('unrealircd') do
it { should be_enabled }
it { should be_running }
end
describe port('6697') do
it { should be_listening }
end