Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pry command to Meterpreter #10687

Merged
merged 3 commits into from
Sep 22, 2018
Merged

Add pry command to Meterpreter #10687

merged 3 commits into from
Sep 22, 2018

Conversation

wvu
Copy link
Contributor

@wvu wvu commented Sep 21, 2018

It's better than irb and comes with Metasploit. Due to how Meterpreter does its command dispatchers, we won't create a new developer dispatcher here.

  • Test help and see pry listed
  • Test help pry and see pry help
  • Test pry in a new session
meterpreter > help pry
Usage: pry

Open a Pry session on the current session.

meterpreter > pry
[*] Starting Pry shell...
[*] You are in the "client" (session) object

[1] pry(#<Msf::Sessions::Meterpreter_Php_Php>)> sys.config.getuid
=> "vagrant (1000)"
[2] pry(#<Msf::Sessions::Meterpreter_Php_Php>)> sys.config.sysinfo
=> {"Computer"=>"ubuntu-xenial", "OS"=>"Linux ubuntu-xenial 4.4.0-134-generic #160-Ubuntu SMP Wed Aug 15 14:58:00 UTC 2018 x86_64", "Architecture"=>nil, "BuildTuple"=>nil, "System Language"=>nil, "Domain"=>nil, "Logged On Users"=>nil}
[3] pry(#<Msf::Sessions::Meterpreter_Php_Php>)> go south
=> nil
[4] pry(#<Msf::Sessions::Meterpreter_Php_Php>)>

#10433

@Green-m
Copy link
Contributor

Green-m commented Sep 21, 2018

Love it! That's actually what I want to do!
Thanks!

@wvu
Copy link
Contributor Author

wvu commented Sep 21, 2018

How about you merge it so I stop merging my own things! :P

@Green-m
Copy link
Contributor

Green-m commented Sep 21, 2018

@wvu-r7
Glad to do it!

@wvu
Copy link
Contributor Author

wvu commented Sep 21, 2018

@Green-m: If you haven't done it before, this doc might help: https://github.com/rapid7/metasploit-framework/wiki/Landing-Pull-Requests. It's a little verbose, though.

Make sure you don't do a fast-forward merge, make sure your commit message is correct, and make sure you sign your merge commit. So don't click the green button. :-)

I'm on IRC if you have any direct questions.

@wvu wvu force-pushed the feature/pry branch 6 times, most recently from dc68238 to 2470248 Compare September 21, 2018 21:00
@wvu
Copy link
Contributor Author

wvu commented Sep 21, 2018

All right, it's done. Please fetch or pull again before you merge, @Green-m. Thanks!

@Green-m Green-m merged commit fb03274 into rapid7:master Sep 22, 2018
Green-m added a commit that referenced this pull request Sep 22, 2018
@Green-m
Copy link
Contributor

Green-m commented Sep 22, 2018

All works well.

meterpreter > pry
[*] Starting Pry shell...
[*] You are in the "client" (session) object

[1] pry(#<Msf::Sessions::Meterpreter_x64_OSX>)> self.class
=> Msf::Sessions::Meterpreter_x64_OSX
[2] pry(#<Msf::Sessions::Meterpreter_x64_OSX>)> self.sys.config.getuid
=> "uid=501, gid=20, euid=501, egid=20"
[3] pry(#<Msf::Sessions::Meterpreter_x64_OSX>)> self.sys.config.sysinfo
=> {"Computer"=>"greens-MacBook-Pro.local",
 "OS"=>"Mac OS X High Sierra (MacOSX 10.13.6)",
 "Architecture"=>"x86",
 "BuildTuple"=>"",
 "System Language"=>nil,
 "Domain"=>nil,
 "Logged On Users"=>nil}
[4] pry(#<Msf::Sessions::Meterpreter_x64_OSX>)>

[1] pry(#<Msf::Sessions::Meterpreter_x86_Win>)>
[2] pry(#<Msf::Sessions::Meterpreter_x86_Win>)> self.class
=> Msf::Sessions::Meterpreter_x86_Win
[3] pry(#<Msf::Sessions::Meterpreter_x86_Win>)> self.sys.config.getuid
=> "greens-MacBook-\\green"
[4] pry(#<Msf::Sessions::Meterpreter_x86_Win>)> self.sys.config.sysinfo
=> {"Computer"=>"greens-MacBook-",
 "OS"=>"Windows 7 (Build 7601, Service Pack 1).",
 "Architecture"=>"x64",
 "BuildTuple"=>nil,
 "System Language"=>"en_US",
 "Domain"=>"greens-MacBook-",
 "Logged On Users"=>1}
[5] pry(#<Msf::Sessions::Meterpreter_x86_Win>)>

msf5 exploit(multi/handler) > pry
[*] Starting Pry shell...
[*] You are in exploit/multi/handler

[1] pry(#<Msf::Modules::Mod6578706c6f69742f6d756c74692f68616e646c6572::MetasploitModule>)>
[1] pry(#<Msf::Modules::Mod6578706c6f69742f6d756c74692f68616e646c6572::MetasploitModule>)> exit
msf5 exploit(multi/handler) > back
msf5 > pry
[*] Starting Pry shell...
[*] You are in the "framework" object

[1] pry(#<Msf::Framework>)> exit

@wvu-r7 Thank your for this doc and this PR, very helpful to me.

@wvu wvu deleted the feature/pry branch September 24, 2018 02:49
@wvu
Copy link
Contributor Author

wvu commented Sep 24, 2018

@Green-m: Clean merge, thank you!

@wvu
Copy link
Contributor Author

wvu commented Sep 24, 2018

Release Notes

This adds the pry command to Meterpreter, which offers an enhanced debugging interface for the payload.

msjenkins-r7 pushed a commit that referenced this pull request Sep 24, 2018
@gdavidson-r7 gdavidson-r7 added the rn-enhancement release notes enhancement label Oct 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants