Add logger - Fixes #1698

This commit is contained in:
Brendan Coles
2019-03-03 20:20:37 +00:00
parent 39aa3fdeea
commit 13c539effe
14 changed files with 169 additions and 86 deletions

View File

@@ -43,7 +43,7 @@ module API
File.path write_to
rescue => e
print_error "[AdminUI] Error: #{e.message}"
puts e.backtrace
print_error e.backtrace
end
def self.build_javascript_ui(beef_server)

View File

@@ -81,7 +81,7 @@ module AdminUI
end
rescue => e
print_error "Error handling HTTP request: #{e.message}"
puts e.backtrace
print_error e.backtrace
end
# Constructs a html script tag (from media/javascript directory)

View File

@@ -15,6 +15,18 @@ module Console
@short_name = @full_name = 'console'
@description = 'console environment to manage beef'
module PostLoad
BeEF::API::Registrar.instance.register(BeEF::Extension::Console::PostLoad, BeEF::API::Extensions, 'post_load')
def self.post_load
if BeEF::Core::Configuration.instance.get("beef.extension.console.enable")
print_error "The console extension is currently unsupported."
print_more "See issue #1090 - https://github.com/beefproject/beef/issues/1090"
BeEF::Core::Configuration.instance.set('beef.extension.console.enable', false)
BeEF::Core::Configuration.instance.set('beef.extension.console.loaded', false)
end
end
end
end
end
end

View File

@@ -66,7 +66,7 @@ module BeEF
bootstrap
rescue => e
print_error "[Evasion] Failed to bootstrap obfuscation technique: #{e.message}"
puts e.backtrace
print_error e.backtrace
end
def apply_chain(input)
@@ -83,7 +83,7 @@ module BeEF
output
rescue => e
print_error "[Evasion] Failed to apply obfuscation technique: #{e.message}"
puts e.backtrace
print_error e.backtrace
end
end
end

View File

@@ -30,14 +30,15 @@ module BeEF
if connected
msf_module_config = {}
path = "#{$root_dir}/#{BeEF::Core::Configuration.instance.get('beef.extension.metasploit.path')}"
if !BeEF::Core::Console::CommandLine.parse[:resetdb] && File.exists?("#{path}msf-exploits.cache")
print_debug "Attempting to use Metasploit exploits cache file"
raw = File.read("#{path}msf-exploits.cache")
path = "#{$root_dir}/#{BeEF::Core::Configuration.instance.get('beef.extension.metasploit.path')}/msf-exploits.cache"
if !BeEF::Core::Console::CommandLine.parse[:resetdb] && File.exist?(path)
print_debug 'Attempting to use Metasploit exploits cache file'
raw = File.read(path)
begin
msf_module_config = YAML.load(raw)
rescue => e
puts e
print_error "[Metasploit] #{e.message}"
print_error e.backtrace
end
count = 1
msf_module_config.each { |k, v|
@@ -102,9 +103,9 @@ module BeEF
end
}
print "\r\n"
File.open("#{path}msf-exploits.cache", "w") do |f|
File.open(path, "w") do |f|
f.write(msf_module_config.to_yaml)
print_debug "Wrote Metasploit exploits to cache file"
print_debug "Wrote Metasploit exploits to cache file: #{path}"
end
end
BeEF::Core::Configuration.instance.set('beef.module', msf_module_config)

View File

@@ -128,7 +128,7 @@ module Metasploit
super(meth, *args)
rescue => e
print_error "[Metasploit] RPC call to '#{meth}' failed: #{e}"
puts e.backtrace
print_error e.backtrace
return
end