Top Level Namespace

Defined Under Namespace

Modules: BetterCap, Celluloid, OpenSSL, PacketFu, System Classes: InjectCSS, InjectHTML, InjectJS, Proxy

Constant Summary collapse

Config =
RbConfig

Instance Method Summary collapse

Instance Method Details

#bettercap_autoload(path = '') ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/bettercap.rb', line 44

def bettercap_autoload( path = '' )
  dir    = File.dirname(__FILE__) + "/bettercap/#{path}"
  deps   = []
  files  = []
  monkey = []

  Dir[dir+"**/*.rb"].each do |filename|
    filename = filename.gsub( dir, '' ).gsub('.rb', '')
    filename = "bettercap/#{path}#{filename}"
    # Proxy modules must be loaded at runtime.
    unless filename =~ /.+\/inject[a-z]+$/i
      if filename.end_with?('/base')
        deps << filename
      elsif filename.include?('monkey')
        monkey << filename
      else
        files << filename
      end
    end
  end

  ( deps + files + monkey ).each do |file|
    require file
  end
end