diff --git a/core/api.rb b/core/api.rb index 880e326e5..e57a5e21c 100644 --- a/core/api.rb +++ b/core/api.rb @@ -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 diff --git a/core/main/configuration.rb b/core/main/configuration.rb index c55f59175..1032d7e4d 100644 --- a/core/main/configuration.rb +++ b/core/main/configuration.rb @@ -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 diff --git a/core/main/network_stack/websocket/websocket.rb b/core/main/network_stack/websocket/websocket.rb index eff0de1b8..d0d960733 100644 --- a/core/main/network_stack/websocket/websocket.rb +++ b/core/main/network_stack/websocket/websocket.rb @@ -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 diff --git a/core/main/rest/handlers/admin.rb b/core/main/rest/handlers/admin.rb index f5ebc0efd..d5ef9560e 100644 --- a/core/main/rest/handlers/admin.rb +++ b/core/main/rest/handlers/admin.rb @@ -52,7 +52,7 @@ module BeEF "token" => "#{config.get('beef.api_token')}" }.to_json end - rescue Exception => e + rescue => e error 400 end end diff --git a/core/main/rest/handlers/modules.rb b/core/main/rest/handlers/modules.rb index 691678d0f..076b62561 100644 --- a/core/main/rest/handlers/modules.rb +++ b/core/main/rest/handlers/modules.rb @@ -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 diff --git a/core/main/rest/handlers/server.rb b/core/main/rest/handlers/server.rb index 361359acf..85317bc0f 100644 --- a/core/main/rest/handlers/server.rb +++ b/core/main/rest/handlers/server.rb @@ -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 diff --git a/extensions/console/lib/readline_compatible.rb b/extensions/console/lib/readline_compatible.rb index fa3e305c9..d106f8741 100644 --- a/extensions/console/lib/readline_compatible.rb +++ b/extensions/console/lib/readline_compatible.rb @@ -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() diff --git a/extensions/metasploit/rpcclient.rb b/extensions/metasploit/rpcclient.rb index b0f62fd6c..49dbe1a16 100644 --- a/extensions/metasploit/rpcclient.rb +++ b/extensions/metasploit/rpcclient.rb @@ -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 diff --git a/extensions/social_engineering/mass_mailer/mass_mailer.rb b/extensions/social_engineering/mass_mailer/mass_mailer.rb index 40f6083b9..d86064906 100644 --- a/extensions/social_engineering/mass_mailer/mass_mailer.rb +++ b/extensions/social_engineering/mass_mailer/mass_mailer.rb @@ -92,7 +92,7 @@ module BeEF end close = email_close(boundary) - rescue Exception => e + rescue => e print_error "Error constructing email." raise end diff --git a/extensions/social_engineering/rest/socialengineering.rb b/extensions/social_engineering/rest/socialengineering.rb index d424644f0..0a0d07d92 100644 --- a/extensions/social_engineering/rest/socialengineering.rb +++ b/extensions/social_engineering/rest/socialengineering.rb @@ -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 diff --git a/extensions/social_engineering/web_cloner/web_cloner.rb b/extensions/social_engineering/web_cloner/web_cloner.rb index 9b98e3537..056fb3743 100644 --- a/extensions/social_engineering/web_cloner/web_cloner.rb +++ b/extensions/social_engineering/web_cloner/web_cloner.rb @@ -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 diff --git a/modules/browser/spyder_eye/module.rb b/modules/browser/spyder_eye/module.rb index bc756f1eb..1541abeda 100644 --- a/modules/browser/spyder_eye/module.rb +++ b/modules/browser/spyder_eye/module.rb @@ -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