Skip to content

Commit

Permalink
Add pry -h
Browse files Browse the repository at this point in the history
  • Loading branch information
wvu committed Sep 21, 2018
1 parent 4682f0f commit dc68238
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
18 changes: 16 additions & 2 deletions lib/msf/ui/console/command_dispatcher/developer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,28 @@ def cmd_pry_help
# Open a Pry session on the current module or Framework
#
def cmd_pry(*args)
if args.include?('-h')
cmd_pry_help
return
end

begin
require 'pry'
rescue LoadError
print_error("Failed to load Pry, try 'gem install pry'")
print_error('Failed to load Pry, try "gem install pry"')
return
end

print_status('Starting Pry shell...')

unless active_module
print_status("You are in the \"framework\" object\n")
framework.pry
return
end

active_module ? active_module.pry : framework.pry
print_status("You are in #{active_module.fullname}\n")
active_module.pry
end

def cmd_edit_help
Expand Down
16 changes: 12 additions & 4 deletions lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def commands
'exit' => 'Terminate the meterpreter session',
'help' => 'Help menu',
'irb' => 'Drop into irb scripting mode',
'pry' => 'Open a Pry session on the client object',
'pry' => 'Open a Pry session on the current session',
'use' => 'Deprecated alias for "load"',
'load' => 'Load one or more meterpreter extensions',
'machine_id' => 'Get the MSF ID of the machine attached to the session',
Expand Down Expand Up @@ -574,21 +574,29 @@ def cmd_irb(*args)
def cmd_pry_help
print_line 'Usage: pry'
print_line
print_line 'Open a Pry session on the client object.'
print_line 'Open a Pry session on the current session.'
print_line
end

#
# Open a Pry session on the client object
# Open a Pry session on the current session
#
def cmd_pry(*args)
if args.include?('-h')
cmd_pry_help
return
end

begin
require 'pry'
rescue LoadError
print_error("Failed to load Pry, try 'gem install pry'")
print_error('Failed to load Pry, try "gem install pry"')
return
end

print_status('Starting Pry shell...')
print_status("You are in the \"client\" (session) object\n")

client.pry
end

Expand Down

0 comments on commit dc68238

Please sign in to comment.