Add error check for missing dropper
This commit is contained in:
@@ -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)}
|
||||
|
||||
Reference in New Issue
Block a user