Rescue StandardError rather than Exception
This commit is contained in:
@@ -155,7 +155,7 @@ module BeEF
|
||||
if not result == nil
|
||||
data << {:api_id => mod[:id], :data => result}
|
||||
end
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_error "API Fire Error: #{e.message} in #{mod.to_s}.#{method.to_s}()"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ module BeEF
|
||||
# set default value if key? does not exist
|
||||
@config.default = nil
|
||||
@@config = config
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_error "Fatal Error: cannot load configuration file"
|
||||
print_debug e
|
||||
end
|
||||
@@ -44,7 +44,7 @@ module BeEF
|
||||
return nil if not File.exists?(file)
|
||||
raw = File.read(file)
|
||||
return YAML.load(raw)
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_debug "Unable to load '#{file}' #{e}"
|
||||
return nil
|
||||
end
|
||||
|
||||
@@ -94,7 +94,7 @@ module BeEF
|
||||
# execute(msg_hash)
|
||||
# end
|
||||
# }
|
||||
# rescue Exception => e
|
||||
# rescue => e
|
||||
# print_error "WebSocket-secured error: #{e}"
|
||||
# end
|
||||
# end
|
||||
@@ -150,7 +150,7 @@ module BeEF
|
||||
# execute(msg_hash)
|
||||
# end
|
||||
# }
|
||||
# rescue Exception => e
|
||||
# rescue => e
|
||||
# print_error "WebSocket error: #{e}"
|
||||
# end
|
||||
# end
|
||||
@@ -203,7 +203,7 @@ module BeEF
|
||||
execute(msg_hash)
|
||||
end
|
||||
}
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_error "WebSocket error: #{e}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -52,7 +52,7 @@ module BeEF
|
||||
"token" => "#{config.get('beef.api_token')}"
|
||||
}.to_json
|
||||
end
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
error 400
|
||||
end
|
||||
end
|
||||
|
||||
@@ -149,7 +149,7 @@ module BeEF
|
||||
data.each{|k,v| options.push({'name' => k, 'value' => v})}
|
||||
exec_results = BeEF::Module.execute(modk, params[:session], options)
|
||||
exec_results != nil ? '{"success":"true","command_id":"'+exec_results.to_s+'"}' : '{"success":"false"}'
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_error "Invalid JSON input for module '#{params[:mod_id]}'"
|
||||
error 400 # Bad Request
|
||||
end
|
||||
@@ -203,7 +203,7 @@ module BeEF
|
||||
end
|
||||
end
|
||||
results.to_json
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_error "Invalid JSON input passed to endpoint /api/modules/multi"
|
||||
error 400 # Bad Request
|
||||
end
|
||||
@@ -265,7 +265,7 @@ module BeEF
|
||||
}
|
||||
end
|
||||
results.to_json
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_error "Invalid JSON input passed to endpoint /api/modules/multi"
|
||||
error 400 # Bad Request
|
||||
end
|
||||
|
||||
@@ -31,7 +31,7 @@ module BeEF
|
||||
local_file = data['local_file']
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind(local_file, mount)
|
||||
status 200
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
error 400
|
||||
end
|
||||
end
|
||||
|
||||
@@ -72,7 +72,7 @@ module Readline
|
||||
buff = RbReadline.readline(prompt)
|
||||
rescue ::Interrupt
|
||||
raise $!
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
buff = nil
|
||||
RbReadline.rl_cleanup_after_signal()
|
||||
RbReadline.rl_deprep_terminal()
|
||||
|
||||
@@ -104,7 +104,7 @@ module Metasploit
|
||||
ret = nil
|
||||
begin
|
||||
ret = super(meth,*args)
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
return nil
|
||||
end
|
||||
ret
|
||||
@@ -190,7 +190,7 @@ module Metasploit
|
||||
get_lock()
|
||||
begin
|
||||
res = self.call('module.execute','exploit',exploit,opts)
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_error "Exploit failed for #{exploit} \n"
|
||||
release_lock()
|
||||
return false
|
||||
@@ -219,7 +219,7 @@ module Metasploit
|
||||
get_lock()
|
||||
begin
|
||||
res = self.call('module.execute','auxiliary','server/browser_autopwn',opts)
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_error "Failed to launch autopwn\n"
|
||||
release_lock()
|
||||
return false
|
||||
|
||||
@@ -92,7 +92,7 @@ module BeEF
|
||||
end
|
||||
|
||||
close = email_close(boundary)
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_error "Error constructing email."
|
||||
raise
|
||||
end
|
||||
|
||||
@@ -57,7 +57,7 @@ module BeEF
|
||||
end
|
||||
end
|
||||
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_error "Invalid JSON input passed to endpoint /api/seng/clone_page"
|
||||
error 400 # Bad Request
|
||||
end
|
||||
@@ -108,7 +108,7 @@ module BeEF
|
||||
halt 401
|
||||
end
|
||||
end
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_error "Invalid JSON input passed to endpoint /api/seng/send_emails"
|
||||
error 400
|
||||
end
|
||||
@@ -116,7 +116,7 @@ module BeEF
|
||||
begin
|
||||
mass_mailer = BeEF::Extension::SocialEngineering::MassMailer.instance
|
||||
mass_mailer.send_email(template, fromname, fromaddr, subject, link, linktext, recipients)
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_error "Invalid mailer configuration"
|
||||
error 400
|
||||
end
|
||||
|
||||
@@ -38,7 +38,7 @@ module BeEF
|
||||
begin #,"--background"
|
||||
IO.popen(["wget", "#{url}","-c", "-k", "-O", "#{@cloned_pages_dir + output}", "-U", "#{user_agent}","--no-check-certificate"], 'r+') do |wget_io| end
|
||||
success = true
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_error "Errors executing wget: #{e}"
|
||||
print_error "Looks like wget is not in your PATH. If 'which wget' returns null, it means you don't have 'wget' in your PATH."
|
||||
end
|
||||
@@ -154,7 +154,7 @@ module BeEF
|
||||
end
|
||||
end
|
||||
print_info "Page can be framed: [#{result}]"
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
result = false
|
||||
print_error "Unable to determine if page can be framed. Page can be framed: [#{result}]"
|
||||
print_debug e
|
||||
|
||||
@@ -24,7 +24,7 @@ class Spyder_eye < BeEF::Core::Command
|
||||
end
|
||||
print_info("Browser screenshot saved to '#{filename}'")
|
||||
BeEF::Core::Logger.instance.register("Zombie", "Browser screenshot saved to '#{filename}'")
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
print_error("Could not write screenshot file '#{filename}' - Exception: #{e.message}")
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user