Module: Ronin::Metasploit

Defined in:
lib/ronin/metasploit/ref.rb,
lib/ronin/metasploit/user.rb,
lib/ronin/metasploit/host.rb,
lib/ronin/metasploit/vuln.rb,
lib/ronin/metasploit/loot.rb,
lib/ronin/metasploit/note.rb,
lib/ronin/metasploit/task.rb,
lib/ronin/metasploit/event.rb,
lib/ronin/metasploit/report.rb,
lib/ronin/metasploit/client.rb,
lib/ronin/metasploit/config.rb,
lib/ronin/metasploit/sandbox.rb,
lib/ronin/metasploit/service.rb,
lib/ronin/metasploit/version.rb,
lib/ronin/metasploit/vuln_ref.rb,
lib/ronin/metasploit/database.rb,
lib/ronin/metasploit/workspace.rb,
lib/ronin/metasploit/metasploit.rb,
lib/ronin/metasploit/credential.rb,
lib/ronin/metasploit/wmap_target.rb,
lib/ronin/metasploit/model/model.rb,
lib/ronin/metasploit/wmap_request.rb,
lib/ronin/metasploit/exploited_host.rb,
lib/ronin/metasploit/project_member.rb,
lib/ronin/metasploit/schema_migration.rb,
lib/ronin/metasploit/model/types/serialized_ruby.rb

Defined Under Namespace

Modules: Config, Database, Model Classes: Client, Credential, Event, ExploitedHost, Host, Loot, ProjectMember, Ref, Report, Sandbox, SchemaMigration, Service, User, Vuln, VulnRef, WMapRequest, WMapTarget, Workspace

Constant Summary

VERSION =

ronin-metasploit version

'0.1.0'

Class Method Summary collapse

Class Method Details

.activate!Boolean

Adds the Metasploit directory to the $LOAD_PATH constant.

Returns:

  • (Boolean)


32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ronin/metasploit/metasploit.rb', line 32

def Metasploit.activate!
  path = Config.root

  if path
    path = File.join(path,LIB_DIR)

    $LOAD_PATH << path unless $LOAD_PATH.include?(path)
    return true
  else
    return false
  end
end

.deactive!true

Removes all Metasploit directories from the $LOAD_PATH constant.

Returns:

  • (true)


50
51
52
53
54
55
56
57
58
59
60
# File 'lib/ronin/metasploit/metasploit.rb', line 50

def Metasploit.deactive!
  path = Config.root

  if path
    $LOAD_PATH.reject! do |lib_dir|
      lib_dir[0..path.length] == path
    end
  end

  return true
end

.update!Boolean

Updates the Metasploit installation, if it was checked out from SubVersion.

Returns:

  • (Boolean)

    Specifies whether the update was successful.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/ronin/metasploit/metasploit.rb', line 69

def Metasploit.update!
  return false unless Config.root

  begin
    repo = Pullr::LocalRepository.new(:path => Config.root)

    # temporarily remove Metasploit from the $LOAD_PATH
    Metasploit.deactive!

    # update the Metasploit installation
    repo.update

    # add Metasploit back to the $LOAD_PATH
    Metasploit.activate!
  rescue Pullr::AmbigiousRepository
    return false
  end

  return true
end