Sha256: ecfdabb93187d28935ba24a642a3ee635bd1fc708cbe50e20bb19da5f2d74cb9

Contents?: true

Size: 1.96 KB

Versions: 3

Compression:

Stored size: 1.96 KB

Contents

=begin
                  Arachni
  Copyright (c) 2010-2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>

  This is free software; you can copy and distribute and modify
  this program under the term of the GPL v2.0 License
  (See LICENSE file for details)

=end

require 'xmlrpc/client'
require 'openssl'

module Arachni

require Arachni::Options.instance.dir['lib'] + 'rpc/xml/client/base'

module RPC
module XML
module Client

#
# XMLRPC client for remote instances spawned by a remote dispatcher
#
# @author: Tasos "Zapotek" Laskos
#                                      <tasos.laskos@gmail.com>
#                                      <zapotek@segfault.gr>
# @version: 0.1.2
#
class Instance < Base

    attr_reader :opts
    attr_reader :framework
    attr_reader :modules
    attr_reader :plugins
    attr_reader :service

    #
    # Maps the methods of remote objects to local ones
    #
    class Mapper

        def initialize( server, remote )
            @server = server
            @remote = remote
        end

        private
        #
        # Used to provide the illusion of locality for remote methods
        #
        def method_missing( sym, *args, &block )
            call = "#{@remote}.#{sym.to_s}"
            @server.call( call, *args )
        end

    end

    #
    # Used to make remote option attributes look like setter methods
    #
    class OptsMapper < Mapper

        def method_missing( sym, *args, &block )
            return super( sym, *args, &block ) if sym == :set

            call = "#{@remote}.#{sym.to_s}="
            @server.call( call, *args )
        end

    end

    def initialize( opts, url, token = nil )
        super( opts, url, token )

        @opts      = OptsMapper.new( @server, 'opts' )
        @framework = Mapper.new( @server, 'framework' )
        @modules   = Mapper.new( @server, 'modules' )
        @plugins   = Mapper.new( @server, 'plugins' )
        @service   = Mapper.new( @server, 'service' )
    end

end

end
end
end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arachni-0.3 lib/rpc/xml/client/instance.rb
arachni-0.2.4 lib/rpc/xml/client/instance.rb
arachni-0.2.3 lib/rpc/xml/client/instance.rb