Class: Arachni::RPC::Client::Instance
- Defined in:
 - lib/arachni/rpc/client/instance.rb,
lib/arachni/rpc/client/instance/service.rb,
lib/arachni/rpc/client/instance/framework.rb 
Overview
RPC client for remote instances spawned by a remote dispatcher
Defined Under Namespace
Instance Attribute Summary collapse
- 
  
    
      #checks  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute checks.
 - 
  
    
      #framework  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute framework.
 - 
  
    
      #options  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute options.
 - 
  
    
      #plugins  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute plugins.
 - 
  
    
      #service  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute service.
 
Class Method Summary collapse
Instance Method Summary collapse
- #close ⇒ Object
 - 
  
    
      #initialize(options, url, token = nil)  ⇒ Instance 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Instance.
 - #token ⇒ Object
 - #url ⇒ Object
 - #when_ready(&block) ⇒ Object
 
Constructor Details
#initialize(options, url, token = nil) ⇒ Instance
Returns a new instance of Instance.
      54 55 56 57 58 59 60 61 62 63 64  | 
    
      # File 'lib/arachni/rpc/client/instance.rb', line 54 def initialize( , url, token = nil ) @token = token @client = Base.new( , url, token ) @framework = Framework.new( @client ) @service = Service.new( @client ) @options = Proxy.new( @client, 'options' ) @checks = Proxy.new( @client, 'checks' ) @plugins = Proxy.new( @client, 'plugins' ) end  | 
  
Instance Attribute Details
#checks ⇒ Object (readonly)
Returns the value of attribute checks.
      22 23 24  | 
    
      # File 'lib/arachni/rpc/client/instance.rb', line 22 def checks @checks end  | 
  
#framework ⇒ Object (readonly)
Returns the value of attribute framework.
      21 22 23  | 
    
      # File 'lib/arachni/rpc/client/instance.rb', line 21 def framework @framework end  | 
  
#options ⇒ Object (readonly)
Returns the value of attribute options.
      20 21 22  | 
    
      # File 'lib/arachni/rpc/client/instance.rb', line 20 def @options end  | 
  
#plugins ⇒ Object (readonly)
Returns the value of attribute plugins.
      23 24 25  | 
    
      # File 'lib/arachni/rpc/client/instance.rb', line 23 def plugins @plugins end  | 
  
#service ⇒ Object (readonly)
Returns the value of attribute service.
      24 25 26  | 
    
      # File 'lib/arachni/rpc/client/instance.rb', line 24 def service @service end  | 
  
Class Method Details
.when_ready(url, token, &block) ⇒ Object
      31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50  | 
    
      # File 'lib/arachni/rpc/client/instance.rb', line 31 def when_ready( url, token, &block ) = OpenStruct.new .rpc = OpenStruct.new( Arachni::Options.to_h[:rpc] ) .rpc.client_max_retries = 0 .rpc.connection_pool_size = 1 client = new( , url, token ) Reactor.global.delay( 0.1 ) do |task| client.service.alive? do |r| if r.rpc_exception? Reactor.global.delay( 0.1, &task ) next end client.close block.call end end end  | 
  
Instance Method Details
#close ⇒ Object
      74 75 76  | 
    
      # File 'lib/arachni/rpc/client/instance.rb', line 74 def close @client.close end  | 
  
#token ⇒ Object
      70 71 72  | 
    
      # File 'lib/arachni/rpc/client/instance.rb', line 70 def token @token end  | 
  
#url ⇒ Object
      78 79 80  | 
    
      # File 'lib/arachni/rpc/client/instance.rb', line 78 def url @client.url end  | 
  
#when_ready(&block) ⇒ Object
      66 67 68  | 
    
      # File 'lib/arachni/rpc/client/instance.rb', line 66 def when_ready( &block ) self.class.when_ready( url, token, &block ) end  |