2017-04-06 20:19:21 +02:00
|
|
|
#
|
|
|
|
# Cookbook:: metasploitable
|
|
|
|
# Recipe:: unrealircd.rb
|
|
|
|
#
|
|
|
|
# Copyright:: 2017, Rapid7, All Rights Reserved.
|
|
|
|
|
|
|
|
# Downloaded from https://www.exploit-db.com/exploits/13853/
|
|
|
|
# Install steps taken from https://wiki.swiftirc.net/wiki/Installing_and_Configuring_UnrealIRCd_on_Linux
|
|
|
|
|
2017-08-22 22:55:38 +02:00
|
|
|
unreal_tar = 'Unreal3.2.8.1_backdoor.tar.gz'
|
|
|
|
|
|
|
|
remote_file "#{Chef::Config[:file_cache_path]}/#{unreal_tar}" do
|
|
|
|
source "#{node[:unrealircd][:download_url]}/752e46f2d873c1679fa99de3f52a274d-Unreal3.2.8.1_backdoor.tar_.gz"
|
|
|
|
mode '0644'
|
2017-04-06 20:19:21 +02:00
|
|
|
end
|
|
|
|
|
2017-08-22 22:55:38 +02:00
|
|
|
directory node[:unrealircd][:install_dir] do
|
|
|
|
owner 'boba_fett'
|
|
|
|
recursive true
|
|
|
|
mode '0100'
|
|
|
|
end
|
|
|
|
|
|
|
|
execute 'untar unrealircd' do
|
|
|
|
cwd node[:unrealircd][:install_dir]
|
|
|
|
command "tar xvzf #{Chef::Config[:file_cache_path]}/#{unreal_tar}"
|
|
|
|
|
|
|
|
only_if { Dir["#{node[:unrealircd][:install_dir]}/*"].empty? }
|
|
|
|
end
|
|
|
|
|
|
|
|
# bash 'download and extract UnrealIRCd' do
|
|
|
|
# code <<-EOH
|
|
|
|
# wget -c -t 3 -O /tmp/Unreal3.2.8.1_backdoor.tar.gz https://www.exploit-db.com/apps/752e46f2d873c1679fa99de3f52a274d-Unreal3.2.8.1_backdoor.tar_.gz
|
|
|
|
# mkdir /opt/unrealircd
|
|
|
|
# tar xvfz /tmp/Unreal3.2.8.1_backdoor.tar.gz -C /opt/unrealircd
|
|
|
|
# chmod 700 /opt/unrealircd/Unreal3.2
|
|
|
|
# EOH
|
|
|
|
# end
|
|
|
|
|
2017-04-06 20:19:21 +02:00
|
|
|
cookbook_file '/opt/unrealircd/Unreal3.2/unrealircd.conf' do
|
|
|
|
source 'unrealircd/unrealircd.conf'
|
2017-08-22 22:55:38 +02:00
|
|
|
owner 'boba_fett'
|
|
|
|
mode '0400'
|
2017-04-06 20:19:21 +02:00
|
|
|
end
|
|
|
|
|
2017-07-13 23:23:31 +02:00
|
|
|
cookbook_file '/opt/unrealircd/Unreal3.2/ircd.motd' do
|
|
|
|
source 'unrealircd/ircd.motd'
|
2017-08-22 22:55:38 +02:00
|
|
|
owner 'boba_fett'
|
|
|
|
mode '0400'
|
2017-07-13 23:23:31 +02:00
|
|
|
end
|
|
|
|
|
2017-04-06 20:19:21 +02:00
|
|
|
bash 'configure and compile' do
|
|
|
|
code <<-EOH
|
|
|
|
cd /opt/unrealircd/Unreal3.2
|
|
|
|
./configure --with-showlistmodes --enable-hub --enable-prefixaq --with-listen=5 --with-dpath=/opt/unrealircd/Unreal3.2 --with-spath=/opt/unrealircd/Unreal3.2/src/ircd --with-nick-history=2000 --with-sendq=3000000 --with-bufferpool=18 --with-hostname=metasploitableub --with-permissions=0600 --with-fd-setsize=1024 --enable-dynamic-linking
|
|
|
|
make
|
|
|
|
EOH
|
|
|
|
end
|
|
|
|
|
2017-08-22 22:55:38 +02:00
|
|
|
execute 'set owner and permissions' do
|
|
|
|
command "chown -R boba_fett #{node[:unrealircd][:install_dir]}"
|
|
|
|
user 'root'
|
|
|
|
action :run
|
|
|
|
end
|
|
|
|
|
2017-04-06 20:19:21 +02:00
|
|
|
cookbook_file '/etc/init.d/unrealircd' do
|
|
|
|
source 'unrealircd/unrealircd'
|
|
|
|
mode '760'
|
|
|
|
end
|
|
|
|
|
2018-10-20 09:51:32 +02:00
|
|
|
execute 'remove_carriage_returns' do
|
|
|
|
command "sed -i -e 's/\r//g' /etc/init.d/unrealircd"
|
2017-04-06 20:19:21 +02:00
|
|
|
end
|
2017-08-23 18:19:18 +02:00
|
|
|
|
|
|
|
service 'unrealircd' do
|
2018-10-20 09:51:32 +02:00
|
|
|
action [:enable, :start]
|
2017-08-23 18:19:18 +02:00
|
|
|
end
|