From 70cac51a5d29efc2af139865a4ecc5890297c4fb Mon Sep 17 00:00:00 2001 From: bcoles Date: Fri, 11 Oct 2013 23:14:56 +1030 Subject: [PATCH] Add error check for missing dropper --- .../firefox_extension_dropper/module.rb | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/exploits/local_host/firefox_extension_dropper/module.rb b/modules/exploits/local_host/firefox_extension_dropper/module.rb index 2408f061f..83a92af27 100644 --- a/modules/exploits/local_host/firefox_extension_dropper/module.rb +++ b/modules/exploits/local_host/firefox_extension_dropper/module.rb @@ -38,17 +38,21 @@ class Firefox_extension_dropper < BeEF::Core::Command mod_path = "#{$root_dir}/modules/exploits/local_host/firefox_extension_dropper" extension_path = mod_path + "/extension" - # retrieve the name of the dropper binary - Dir.foreach("#{mod_path}/dropper") do |item| - if item != "readme.txt" && item != "." && item != ".." - @dropper = item - puts "dropper: " + @dropper - end - end - # clean the build directory FileUtils.rm_rf("#{extension_path}/build/.", secure: true) + # retrieve the name of the dropper binary + Dir.foreach("#{mod_path}/dropper") do |item| + if item != "readme.txt" && item != "." && item != ".." + @dropper = item + print_info "Using dropper: '#{mod_path}/dropper/#{@dropper}'" + end + end + if @dropper.nil? + print_error "No dropper found in '#{mod_path}/dropper'" + return + end + # copy in the build directory necessary file, substituting placeholders File.open(extension_path + "/build/install.rdf", "w") {|file| file.puts File.read(extension_path + "/install.rdf").gsub!("__extension_name_placeholder__", @extension_name)} File.open(extension_path + "/build/bootstrap.js", "w") {|file| file.puts File.read(extension_path + "/bootstrap.js").gsub!("__payload_placeholder__", @dropper)}