Sha256: 13f93af01fd9ea0f416b47c781c9a29edb45e74c5e3e7e0c5d0f12409963bd05

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'optparse'
require 'msfrpc-client'

# Use the RPC option parser to handle standard flags
opts   = {}
parser = Msf::RPC::Client.option_parser(opts)
parser.parse!(ARGV)

# Parse additional options, environment variables, etc
opts = Msf::RPC::Client.option_handler(opts)

# Create the RPC client with our parsed options
rpc  = Msf::RPC::Client.new(opts)

$stdout.puts "[*] The RPC client is available in variable 'rpc'"
if rpc.token
  $stdout.puts "[*] Sucessfully authenticated to the server"
end

$stdout.puts "[*] Starting IRB shell..."

load('irb.rb')

IRB.setup(nil)
IRB.conf[:PROMPT_MODE]  = :SIMPLE

# Create a new IRB instance
irb = IRB::Irb.new(IRB::WorkSpace.new(binding))

# Set the primary irb context so that exit and other intrinsic
# commands will work.
IRB.conf[:MAIN_CONTEXT] = irb.context

# Trap interrupt
old_sigint = trap("SIGINT") do
  begin
    irb.signal_handle
  rescue RubyLex::TerminateLineInput
    irb.eval_input
  end
end

# Keep processing input until the cows come home...
catch(:IRB_EXIT) do
  irb.eval_input
end

trap("SIGINT", old_sigint)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
msfrpc-client-1.1.2 examples/msfrpc_irb.rb