Add error check for missing dropper

This commit is contained in:
bcoles
2013-10-11 23:14:56 +10:30
parent 69ff8c0013
commit 70cac51a5d

View File

@@ -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)}