Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8364497
adds logs, versions & exceptions
agalway-r7 May 11, 2020
bd3d23e
PR Changes and cleanup
agalway-r7 May 14, 2020
379c83d
PR Changes & Cleanup
agalway-r7 May 15, 2020
7491490
Bug Fix & Rubocop run
agalway-r7 May 15, 2020
33c56b4
PR Changes
agalway-r7 May 21, 2020
63515ad
pass all elog messages to log sink and fix tests
agalway-r7 May 21, 2020
53f28c3
PR CHanges & bug fixes
agalway-r7 May 22, 2020
abb0b82
PR requests and removes any logging changes
agalway-r7 Jun 17, 2020
f86abe7
create standard elog method
agalway-r7 Jun 11, 2020
77b9ffa
elog api changes
agalway-r7 Jun 12, 2020
ee16d14
api cleanup, removes unnecessary error messages
agalway-r7 Jun 15, 2020
b0e9250
replaces level in elog api
agalway-r7 Jun 16, 2020
0e4ebc6
PR changes
agalway-r7 Jun 16, 2020
e76a922
elog rewrite to match rollbar api
agalway-r7 Jun 16, 2020
db87811
removes helper methods and elog(error: e) usages
agalway-r7 Jun 17, 2020
3d6cc1a
sanity test fixes
agalway-r7 Jun 18, 2020
311e60c
PR Changes
agalway-r7 Jun 18, 2020
76e15c1
pass all elog messages to log sink and fix tests
agalway-r7 May 21, 2020
f8838cf
PR requests and removes any logging changes
agalway-r7 Jun 17, 2020
4812135
updates to work with standard elog & PR requests
agalway-r7 Jun 19, 2020
5bc5f41
adds Arch pacman install check
agalway-r7 Jun 22, 2020
ae74d0d
add arch pacman install rspec test
agalway-r7 Jun 23, 2020
164e95e
adds optional args and implements them with debug
agalway-r7 Jun 23, 2020
c2927df
update usage and remove binding.pry
agalway-r7 Jun 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/msf/ui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module Ui
require 'rex/ui'
require 'msf/ui/banner'
require 'msf/ui/tip'
require 'msf/ui/debug'
require 'msf/ui/driver'
require 'msf/ui/common'
require 'msf/ui/console'
57 changes: 57 additions & 0 deletions lib/msf/ui/console/command_dispatcher/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ class Core
@@tip_opts = Rex::Parser::Arguments.new(
"-h" => [ false, "Help banner." ])

@@debug_opts = Rex::Parser::Arguments.new(
"-h" => [ false, "Help banner." ],
"-d" => [ false, "Display the Datastore Information." ],
"-H" => [ false, "Display command history.", true ],
"-e" => [ false, "Display the most recent Error and Stack Trace.", true ],
"-l" => [ false, "Display the most recent logs.", true ],
"-v" => [ false, "Display versions and install info." ])

@@connect_opts = Rex::Parser::Arguments.new(
"-h" => [ false, "Help banner." ],
"-p" => [ true, "List of proxies to use." ],
Expand Down Expand Up @@ -103,6 +111,7 @@ def commands
"cd" => "Change the current working directory",
"connect" => "Communicate with a host",
"color" => "Toggle color",
"debug" => "Display information useful for debugging",
"exit" => "Exit the console",
"get" => "Gets the value of a context-specific variable",
"getg" => "Gets the value of a global variable",
Expand Down Expand Up @@ -291,6 +300,54 @@ def cmd_tips(*args)

alias cmd_tip cmd_tips


def cmd_debug_help
print_line "Usage: debug [options]"
print_line
print_line("Print a set of information in a Markdown format to be included when opening an Issue on Github. " +
"This information helps us fix problems you encounter and should be included when you open a new issue: " +
Debug.issue_link)
print @@debug_opts.usage
end

#
# Display information useful for debugging errors.
#
def cmd_debug(*args)
if args.empty?
print_line Debug.all(framework, driver)
return
end

if args.include?("-h")
cmd_debug_help
else
output = ""
@@debug_opts.parse(args) do |opt, idx, param|
case opt
when '-d'
output << Debug.datastore(framework, driver)
when '-H'
output << (param.nil? ? Debug.history : Debug.history(param.to_i))
when '-e'
output << (param.nil? ? Debug.errors : Debug.errors(param.to_i))
when '-l'
output << (param.nil? ? Debug.logs : Debug.logs(param.to_i))
when '-v'
output << Debug.versions(framework)
end
end

if output.empty?
print_line("Valid argument was not given.")
cmd_debug_help
else
output = Debug.preamble + output
print_line output
end
end
end

def cmd_connect_help
print_line "Usage: connect [options] <host> <port>"
print_line
Expand Down
22 changes: 18 additions & 4 deletions lib/msf/ui/console/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@ def load_config(path=nil)
end

#
# Saves configuration for the console.
# Generate configuration for the console.
#
def save_config
def get_config
# Build out the console config group
group = {}

Expand All @@ -301,9 +301,23 @@ def save_config
end
end

# Save it
group
end

def get_config_core
ConfigCore
end

def get_config_group
ConfigGroup
end

#
# Saves configuration for the console.
#
def save_config
begin
Msf::Config.save(ConfigGroup => group)
Msf::Config.save(ConfigGroup => get_config)
rescue ::Exception
print_error("Failed to save console config: #{$!}")
end
Expand Down
Loading