Class: Msf::Modules::External::GoBridge

Inherits:
Bridge
  • Object
show all
Defined in:
lib/msf/core/modules/external/bridge.rb

Constant Summary

Constants inherited from Bridge

Bridge::LOADERS

Instance Attribute Summary

Attributes inherited from Bridge

#buf, #cmd, #env, #exit_status, #framework, #ios, #messages, #path, #read_thread, #running, #wait_thread

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Bridge

#cleanup, #close, #exec, #harvest_process, #next_message, open, #send, #success?, #threadme, #write_message

Constructor Details

#initialize(module_path, framework: nil) ⇒ GoBridge

Returns a new instance of GoBridge.


198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/msf/core/modules/external/bridge.rb', line 198

def initialize(module_path, framework: nil)
  super
  default_go_path = ENV['GOPATH'] || ''
  shared_module_lib_path = File.dirname(module_path) + "/shared"
  go_path = File.expand_path('../go', __FILE__)

  if File.exist?(default_go_path)
    go_path = go_path + File::PATH_SEPARATOR + default_go_path
  end

  if File.exist?(shared_module_lib_path)
    go_path = go_path + File::PATH_SEPARATOR + shared_module_lib_path
  end

  self.env = self.env.merge({'GOPATH' => go_path})
  self.cmd = ['go', 'run', self.path]
end

Class Method Details

.applies?(module_name) ⇒ Boolean

Returns:

  • (Boolean)

194
195
196
# File 'lib/msf/core/modules/external/bridge.rb', line 194

def self.applies?(module_name)
  module_name.match? /\.go$/
end