How to do it...

  1. Let's start by launching an interactive Ruby shell with Meterpreter in our Metasploitable 3 target machine session:
meterpreter > irb[*] Starting IRB shell[*] The "client" variable holds the meterpreter client >>
  1. Now that we are in the Ruby shell, we can execute our Ruby scripts. Let's start with a basic addition of two numbers:
>> 1+1=> 2
  1. Our shell is working fine and can interpret the statements. Let's use the framework object and display information about our session:
>> framework=> #<Framework (2 sessions, 0 jobs, 0 plugins, postgresql database active)>>> framework.sessions=> {3=>#<Session:meterpreter 192.168.216.10:49469 (192.168.216.10) "NT AUTHORITY\SYSTEM @ VAGRANT-2008R2">, 4=>#<Session:meterpreter 192.168.216.10:49470 ...

Get Metasploit Penetration Testing Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.