<commit_before>=begin
                  Arachni
  Copyright (c) 2010-2011 Tasos "Zapotek" Laskos <<EMAIL>>

  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
#                                      <<EMAIL>>
#                                      <<EMAIL>>
# @version: 0.1.2
#
class Instance < Base

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

    #
    # 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
<commit_msg>added Framework class to handle method calls that would require longer timeouts<commit_after>=begin
                  Arachni
  Copyright (c) 2010-2011 <NAME>" Laskos <<EMAIL>>

  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
#                                      <<EMAIL>>
#                                      <<EMAIL>>
# @version: 0.1.3
#
class Instance < Base

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

    #
    # 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

    class Framework < Mapper

        def method_missing( sym, *args, &block )

            if sym == :clean_up!
                timeout = @server.timeout
                @server.timeout = 15
            end

            res = super( sym, *args, &block )

            if sym == :clean_up!
                @server.timeout = timeout
            end

            return res
        end

    end

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

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

end

end
end
end
end

{'fraction_non_alphanumeric': 0.099601593625498, 'fraction_numerical': 0.00796812749003984, 'mean_word_length': 2.038029386343993, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1338585', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1038, 'n_words': 343}