From a9b9f193f62490e512c0664dd86a7844876a9aa0 Mon Sep 17 00:00:00 2001 From: Chan9390 Date: Fri, 1 Sep 2017 18:00:14 +0530 Subject: [PATCH] Added rails app --- .../cookbooks/metasploitable/recipes/devkit.rb | 18 +++++++----------- chef/cookbooks/metasploitable/recipes/rails.rb | 6 +++--- versions/chef/Vagrantfile | 1 + 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/chef/cookbooks/metasploitable/recipes/devkit.rb b/chef/cookbooks/metasploitable/recipes/devkit.rb index bf236d8..4b1a213 100644 --- a/chef/cookbooks/metasploitable/recipes/devkit.rb +++ b/chef/cookbooks/metasploitable/recipes/devkit.rb @@ -7,31 +7,27 @@ include_recipe 'metasploitable::7zip' include_recipe 'metasploitable::ruby' -directory 'C:\Program Files\Rails_Server' do - action :create -end - -directory 'C:\Program Files\Rails_Server\devkit' do +directory 'C:\RubyDevKit' do action :create end powershell_script "Download DevKit" do - code "(New-Object System.Net.WebClient).DownloadFile('http://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe', 'C:\\Program Files\\Rails_Server\\devkit\\devkit.exe')" + code "(New-Object System.Net.WebClient).DownloadFile('http://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe', 'C:\\RubyDevKit\\devkit.exe')" end batch 'Extract DevKit' do - code '"C:\Program Files\7-Zip\7z.exe" x "C:\Program Files\Rails_Server\devkit\devkit.exe" -o"C:\Program Files\Rails_Server\devkit\"' + code '"C:\Program Files\7-Zip\7z.exe" x "C:\RubyDevKit\devkit.exe" -o"C:\RubyDevKit\"' end -cookbook_file 'C:\Program Files\Rails_Server\devkit\dk.rb' do +cookbook_file 'C:\RubyDevKit\dk.rb' do source 'rails_server/devkit/dk.rb' action :create end batch 'Install DevKit' do code <<-EOH - C:\\tools\\ruby23\\bin\\ruby.exe "C:\\Program Files\\Rails_Server\\devkit\\dk.rb" init - C:\\tools\\ruby23\\bin\\ruby.exe "C:\\Program Files\\Rails_Server\\devkit\\dk.rb" install - "C:\\Program Files\\Rails_Server\\devkit\\devkitvars.bat" + C:\\tools\\ruby23\\bin\\ruby.exe "C:\\RubyDevKit\\dk.rb" init + C:\\tools\\ruby23\\bin\\ruby.exe "C:\\RubyDevKit\\dk.rb" install + "C:\\RubyDevKit\\devkitvars.bat" EOH end diff --git a/chef/cookbooks/metasploitable/recipes/rails.rb b/chef/cookbooks/metasploitable/recipes/rails.rb index c5fb8e3..b7471e9 100644 --- a/chef/cookbooks/metasploitable/recipes/rails.rb +++ b/chef/cookbooks/metasploitable/recipes/rails.rb @@ -161,17 +161,17 @@ gem_package 'minitest' do options "--no-ri --no-rdoc" end -file 'C:\tools\ruby23\lib\ruby\gems\2.3.0\specifications\sqlite3-1.3.11-x64-mingw32.gemspec' do +cookbook_file 'C:\tools\ruby23\lib\ruby\gems\2.3.0\specifications\sqlite3-1.3.11-x64-mingw32.gemspec' do source 'rails_server/sqlite3-1.3.11-x64-mingw32.gemspec' action :create end execute 'Create Rails server' do command 'C:\tools\ruby23\bin\rails.bat _4.1.1_ new "C:\Program Files\Rails_Server"' - action :create + action :run end -file 'C:\Program Files\Rails_Server\start_rails_server.bat' do +cookbook_file 'C:\Program Files\Rails_Server\start_rails_server.bat' do source 'rails_server/start_rails_server.bat' action :create end diff --git a/versions/chef/Vagrantfile b/versions/chef/Vagrantfile index d86f20b..4032771 100644 --- a/versions/chef/Vagrantfile +++ b/versions/chef/Vagrantfile @@ -34,6 +34,7 @@ Vagrant.configure("2") do |config| chef.add_recipe "metasploitable::jmx" chef.add_recipe "metasploitable::ruby" chef.add_recipe "metasploitable::devkit" + chef.add_recipe "metasploitable::rails" chef.add_recipe "metasploitable::webdav" chef.add_recipe "metasploitable::mysql" chef.add_recipe "metasploitable::axis2"