2012-06-29 05:18:28 +00:00
|
|
|
# -*- coding: binary -*-
|
2005-07-09 21:18:49 +00:00
|
|
|
require 'msf/core'
|
|
|
|
require 'msf/base'
|
|
|
|
require 'msf/ui'
|
2005-07-16 08:12:58 +00:00
|
|
|
require 'msf/ui/console/framework_event_manager'
|
2005-07-09 21:18:49 +00:00
|
|
|
require 'msf/ui/console/command_dispatcher'
|
|
|
|
require 'msf/ui/console/table'
|
2005-07-12 05:39:44 +00:00
|
|
|
require 'find'
|
2011-10-20 06:41:07 +00:00
|
|
|
require 'erb'
|
2011-11-09 21:32:48 +00:00
|
|
|
require 'rexml/document'
|
|
|
|
require 'fileutils'
|
2011-11-10 03:40:02 +00:00
|
|
|
require 'digest/md5'
|
2005-07-07 06:14:58 +00:00
|
|
|
|
2005-05-22 19:39:21 +00:00
|
|
|
module Msf
|
|
|
|
module Ui
|
|
|
|
module Console
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# This class implements a user interface driver on a console interface.
|
|
|
|
#
|
|
|
|
###
|
2011-11-10 04:45:49 +00:00
|
|
|
|
2005-05-22 19:39:21 +00:00
|
|
|
class Driver < Msf::Ui::Driver
|
|
|
|
|
2005-10-02 03:21:26 +00:00
|
|
|
ConfigCore = "framework/core"
|
2005-07-15 22:30:04 +00:00
|
|
|
ConfigGroup = "framework/ui/console"
|
|
|
|
|
2010-04-07 23:42:04 +00:00
|
|
|
DefaultPrompt = "%undmsf%clr"
|
|
|
|
DefaultPromptChar = "%clr>"
|
2005-11-28 16:36:06 +00:00
|
|
|
|
2005-07-16 08:12:58 +00:00
|
|
|
#
|
|
|
|
# The console driver processes various framework notified events.
|
|
|
|
#
|
|
|
|
include FrameworkEventManager
|
|
|
|
|
|
|
|
#
|
|
|
|
# The console driver is a command shell.
|
|
|
|
#
|
2005-07-18 05:13:21 +00:00
|
|
|
include Rex::Ui::Text::DispatcherShell
|
2005-05-22 19:39:21 +00:00
|
|
|
|
2005-11-15 15:11:43 +00:00
|
|
|
#
|
|
|
|
# Initializes a console driver instance with the supplied prompt string and
|
2005-11-28 16:36:06 +00:00
|
|
|
# prompt character. The optional hash can take extra values that will
|
|
|
|
# serve to initialize the console driver.
|
2005-11-15 15:11:43 +00:00
|
|
|
#
|
2005-12-07 03:06:31 +00:00
|
|
|
# The optional hash values can include:
|
|
|
|
#
|
|
|
|
# AllowCommandPassthru
|
|
|
|
#
|
|
|
|
# Whether or not unknown commands should be passed through and executed by
|
|
|
|
# the local system.
|
|
|
|
#
|
2009-10-02 14:17:03 +00:00
|
|
|
# RealReadline
|
|
|
|
#
|
|
|
|
# Whether or to use the system Readline or the RBReadline (default)
|
2009-11-26 02:18:02 +00:00
|
|
|
#
|
|
|
|
# HistFile
|
2010-03-22 14:26:02 +00:00
|
|
|
#
|
2009-11-26 02:18:02 +00:00
|
|
|
# Name of a file to store command history
|
2010-03-22 14:26:02 +00:00
|
|
|
#
|
2005-11-28 16:36:06 +00:00
|
|
|
def initialize(prompt = DefaultPrompt, prompt_char = DefaultPromptChar, opts = {})
|
2009-10-02 14:17:03 +00:00
|
|
|
|
|
|
|
# Choose a readline library before calling the parent
|
|
|
|
rl = false
|
2009-12-29 21:54:03 +00:00
|
|
|
rl_err = nil
|
2009-10-02 14:17:03 +00:00
|
|
|
begin
|
|
|
|
if(opts['RealReadline'])
|
|
|
|
require 'readline'
|
|
|
|
rl = true
|
|
|
|
end
|
|
|
|
rescue ::LoadError
|
2009-12-29 21:54:03 +00:00
|
|
|
rl_err = $!
|
2006-06-08 20:53:15 +00:00
|
|
|
end
|
2010-03-22 14:26:02 +00:00
|
|
|
|
|
|
|
# Default to the RbReadline wrapper
|
2009-10-02 14:17:03 +00:00
|
|
|
require 'readline_compatible' if(not rl)
|
|
|
|
|
2009-11-26 02:18:02 +00:00
|
|
|
histfile = opts['HistFile'] || Msf::Config.history_file
|
2006-06-08 20:53:15 +00:00
|
|
|
|
2011-07-21 06:14:25 +00:00
|
|
|
# Initialize attributes
|
|
|
|
self.framework = opts['Framework'] || Msf::Simple::Framework.create(opts)
|
|
|
|
|
|
|
|
if self.framework.datastore['Prompt']
|
|
|
|
prompt = self.framework.datastore['Prompt']
|
2011-07-21 14:35:02 +00:00
|
|
|
prompt_char = self.framework.datastore['PromptChar'] || DefaultPromptChar
|
2011-07-21 06:14:25 +00:00
|
|
|
end
|
2011-07-21 15:44:54 +00:00
|
|
|
|
2005-07-18 05:13:21 +00:00
|
|
|
# Call the parent
|
2011-07-21 06:14:25 +00:00
|
|
|
super(prompt, prompt_char, histfile, framework)
|
2005-07-18 05:13:21 +00:00
|
|
|
|
2005-10-30 23:40:27 +00:00
|
|
|
# Temporarily disable output
|
|
|
|
self.disable_output = true
|
|
|
|
|
|
|
|
# Load pre-configuration
|
|
|
|
load_preconfig
|
2010-03-22 14:26:02 +00:00
|
|
|
|
2005-11-28 16:36:06 +00:00
|
|
|
# Initialize the user interface to use a different input and output
|
|
|
|
# handle if one is supplied
|
2010-12-29 02:15:18 +00:00
|
|
|
input = opts['LocalInput']
|
|
|
|
input ||= Rex::Ui::Text::Input::Stdio.new
|
2010-12-28 20:24:17 +00:00
|
|
|
|
|
|
|
if (opts['LocalOutput'])
|
2010-12-29 00:35:27 +00:00
|
|
|
if (opts['LocalOutput'].kind_of?(String))
|
|
|
|
output = Rex::Ui::Text::Output::File.new(opts['LocalOutput'])
|
2010-12-29 02:15:18 +00:00
|
|
|
else
|
2010-12-29 00:35:27 +00:00
|
|
|
output = opts['LocalOutput']
|
|
|
|
end
|
2010-04-20 03:59:27 +00:00
|
|
|
else
|
2010-12-28 20:24:17 +00:00
|
|
|
output = Rex::Ui::Text::Output::Stdio.new
|
2005-11-28 16:36:06 +00:00
|
|
|
end
|
2010-12-29 02:15:18 +00:00
|
|
|
|
2010-12-28 20:24:17 +00:00
|
|
|
init_ui(input, output)
|
2010-05-20 23:47:49 +00:00
|
|
|
init_tab_complete
|
2005-05-22 19:39:21 +00:00
|
|
|
|
|
|
|
# Add the core command dispatcher as the root of the dispatcher
|
|
|
|
# stack
|
|
|
|
enstack_dispatcher(CommandDispatcher::Core)
|
2010-03-22 14:26:02 +00:00
|
|
|
|
2009-12-29 21:54:03 +00:00
|
|
|
# Report readline error if there was one..
|
|
|
|
if not rl_err.nil?
|
|
|
|
print_error("***")
|
|
|
|
print_error("* WARNING: Unable to load readline: #{rl_err}")
|
|
|
|
print_error("* Falling back to RbReadLine")
|
|
|
|
print_error("***")
|
|
|
|
end
|
|
|
|
|
2011-11-04 22:25:09 +00:00
|
|
|
|
2009-03-28 21:42:30 +00:00
|
|
|
# Add the database dispatcher if it is usable
|
2010-08-05 02:24:40 +00:00
|
|
|
if (framework.db.usable)
|
2009-03-28 21:42:30 +00:00
|
|
|
require 'msf/ui/console/command_dispatcher/db'
|
|
|
|
enstack_dispatcher(CommandDispatcher::Db)
|
2009-06-03 16:28:28 +00:00
|
|
|
else
|
|
|
|
print_error("***")
|
2011-01-25 22:58:21 +00:00
|
|
|
if framework.db.error == "disabled"
|
|
|
|
print_error("* WARNING: Database support has been disabled")
|
|
|
|
else
|
|
|
|
print_error("* WARNING: No database support: #{framework.db.error.class} #{framework.db.error}")
|
|
|
|
end
|
2009-06-03 16:28:28 +00:00
|
|
|
print_error("***")
|
2009-03-28 21:42:30 +00:00
|
|
|
end
|
2005-05-22 19:39:21 +00:00
|
|
|
|
2009-07-23 13:28:47 +00:00
|
|
|
begin
|
|
|
|
require 'openssl'
|
|
|
|
rescue ::LoadError
|
|
|
|
print_error("***")
|
|
|
|
print_error("* WARNING: No OpenSSL support. This is required by meterpreter payloads and many exploits")
|
2010-03-22 14:26:02 +00:00
|
|
|
print_error("* Please install the ruby-openssl package (apt-get install libopenssl-ruby on Debian/Ubuntu")
|
|
|
|
print_error("***")
|
2009-07-23 13:28:47 +00:00
|
|
|
end
|
|
|
|
|
2005-07-16 08:12:58 +00:00
|
|
|
# Register event handlers
|
|
|
|
register_event_handlers
|
2005-10-01 21:51:45 +00:00
|
|
|
|
2005-10-02 03:21:26 +00:00
|
|
|
# Re-enable output
|
|
|
|
self.disable_output = false
|
|
|
|
|
2005-12-07 03:06:31 +00:00
|
|
|
# Whether or not command passthru should be allowed
|
|
|
|
self.command_passthru = (opts['AllowCommandPassthru'] == false) ? false : true
|
2007-01-30 04:48:35 +00:00
|
|
|
|
|
|
|
# Disables "dangerous" functionality of the console
|
|
|
|
@defanged = opts['Defanged'] == true
|
|
|
|
|
|
|
|
# If we're defanged, then command passthru should be disabled
|
|
|
|
if @defanged
|
|
|
|
self.command_passthru = false
|
|
|
|
end
|
2010-12-29 02:15:18 +00:00
|
|
|
|
2010-10-19 07:51:58 +00:00
|
|
|
# Parse any specified database.yml file
|
2012-06-29 15:46:15 +00:00
|
|
|
if framework.db.usable and not opts['SkipDatabaseInit']
|
2012-03-31 17:03:21 +00:00
|
|
|
|
|
|
|
# Append any migration paths necessary to bring the database online
|
|
|
|
if opts['DatabaseMigrationPaths']
|
Cutting over rails3 to master.
This switches the Metasploit Framework to a Rails 3 backend. If you run
into new problems (especially around Active Record or your postgresql
gem) you should try first updating your Ruby installation to 1.9.3 and
use a more recent 'pg' gem.
If that fails, we'd love to see your bug report (just drop all the
detail you can into an issue on GitHub). In the meantime, you can
checkout the rails2 branch, which was branched from master immediately
before this cutover.
Squashed commit of the following:
commit 5802ec851580341c6717dfea529027c12678d35f
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 23:30:12 2012 -0500
Enable MSF_BUNDLE_GEMS mode by default (set to N/F/0 to disable)
commit 8102f98dce9eb0c73c4374e40dce09af7b51d060
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 23:30:03 2012 -0500
Add a method to expand win32 file paths
commit bda6479d154cf75572dd5de8b66bfde661a55de9
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 18:53:44 2012 -0500
Fix 1.8.x compatibility
commit 101ce4eb17bfdf755ef8c0a5198174668b6cd6fd
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 18:40:59 2012 -0500
Use verbose instead of stringio
commit 5db467ffb593488285576d183b1662093e454b3e
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 18:30:06 2012 -0500
Hide the iconv warning, were stuck with it due to EBCDIC support
commit 63b9cb20eb6a61daf4effb4c8d2761c16ff0c4e0
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 18:29:58 2012 -0500
Dont use GEM_HOME by default
commit ca49271c22c314a4465fff934334df18c704cbc0
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 18:23:34 2012 -0500
Move Gemfile to root (there be dragons, lets find them) and catch failed bundler loads
commit 34af04076a068e9f60c5526045ddbba5fca359fd
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 18:18:29 2012 -0500
Fallback to bundler when not running inside of a installer env
commit ed1066a4f3f12fae7d4afc03eb1ab70ffe2f9cf3
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 16:26:55 2012 -0500
Remove a mess of gems that were not actually required
commit 21290a73926809e9049a59359449168f740d13d2
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 15:59:10 2012 -0500
Hack around a gem() call that is well-intentioned but an obstacle in this case
commit 8e414a8bfab9641c81088d22f73033be5b37a700
Author: Tod Beardsley <todb@metasploit.com>
Date: Sun Apr 15 15:06:08 2012 -0500
Ruby, come on. Ducktype this. Please.
Use interpolated strings to get the to_s behavior you don't get with
just plussing.
commit 0fa92c58750f8f84edbecfaab72cd2da5062743f
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 15:05:42 2012 -0500
Add new eventmachine/thin gems
commit 819d5e7d45e0a16741d3852df3ed110b4d7abc44
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 15:01:18 2012 -0500
Purge (reimport in a second)
commit ea6f3f6c434537ca15b6c6674e31081e27ce7f86
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 14:54:42 2012 -0500
Cleanup uncessary .so files (ext vs lib)
commit d219330a3cc563e9da9f01fade016c9ed8cda21c
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 14:53:02 2012 -0500
PG gems built against the older installation environment
commit d6e590cfa331ae7b25313ff1471c6148a6b36f3b
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 14:06:35 2012 -0500
Rename to include the version
commit a893de222b97ce1222a55324f1811b0262aae2d0
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 13:56:47 2012 -0500
Detect older installation environments and load the arch-lib directories into the search path
commit 6444bba0a421921e2ebe2df2323277a586f9736f
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 13:49:25 2012 -0500
Merge in windows gems
commit 95efbcfde220917bc7ee08e6083d7b383240d185
Author: Tod Beardsley <todb@metasploit.com>
Date: Sun Apr 15 13:49:33 2012 -0500
Report_vuln shouldn't use :include in finder
find_or_create_by doesn't take :include as a param.
commit c5f99eb87f0874ef7d32fa42828841c9a714b787
Author: David Maloney <DMaloney@rapid7.com>
Date: Sun Apr 15 12:44:09 2012 -0500
One more msised Mdm namespace issue
commit 2184e2bbc3dd9b0993e8f21d2811a65a0c694d68
Author: David Maloney <DMaloney@rapid7.com>
Date: Sun Apr 15 12:33:41 2012 -0500
Fixes some mroe Mdm namespace confusion
Fixes #6626
commit 10cee17f391f398bb2be3409137ff7348c7a66ee
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 03:40:44 2012 -0500
Add robots gem (required by webscan)
commit 327e674c83850101364c9cca8f8d16da1de3dfb5
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 03:39:05 2012 -0500
Fix missing error checks
commit a5a24641866e47e611d7636a3f19ba3b3ed10ac5
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 01:15:37 2012 -0500
Reorder requires and add a method for injecting a new migration path
commit 250a5fa5ae8cb05807af022aa4168907772c15f8
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 00:56:09 2012 -0500
Remove missing constant (use string) and add gemcache cleaner
commit 37ad6063fce0a41dddedb857fa49aa2c4834a508
Merge: d47ee82 4be0361
Author: Tod Beardsley <todb@metasploit.com>
Date: Sun Apr 15 00:40:16 2012 -0500
Merge branch 'master-clone' into rails3-clone
commit d47ee82ad7e66de53dd3d3a65649cc37299a2479
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 00:30:03 2012 -0500
cleanup leftovers from gems
commit 6d883b5aa8a3a7ddbcde5bfd4521d57c5b30d3c2
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 00:25:47 2012 -0500
MDM update with purged DBSave module
commit 71e4f2d81f6da221b76150562a16c730888f5925
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 23:19:37 2012 -0500
Add new mdm
commit 651cd5adac8211d65e0c8079371d8264e549533a
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 23:19:13 2012 -0500
Update mdm
commit 0191a8bd0acec30ddb2a9e9c291111a12378537f
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 22:30:40 2012 -0500
This fixes numerous cases of missed Mdm:: prefixes on db objects
commit a2a9bb3f2148622c135663dead80b3367b6f7695
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 18:30:18 2012 -0500
Add eventmachine
commit 301ddeb12b906ed3c508613ca894347bedc3b499
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 18:18:12 2012 -0500
A nicer error for folks who need to upgrade pg
commit fa6bde1e67b12e2d3d9978f59bbc98e0c1a1a707
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 17:54:55 2012 -0500
Remove bundler requirements
commit 2e3ab9ed211303f1116e602b9a450141b71e56a4
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 17:35:38 2012 -0500
Pull in eventmachine with actual .so's this time
commit 901fb33ff6b754ce2c2cfd51e3b0b669f6ec600b
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 17:19:12 2012 -0500
Update deps, still need to add eventmachine
commit 6b0e17068e8caa0601f3ef81e8dbdb672758fcbe
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 13:07:06 2012 -0500
Handle older installer environments and only allow binary gems when the
environment specifically asks for it
commit b98eb7873a6342834840424699caa414a5cb172a
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 04:05:13 2012 -0500
Bump version to -testing
commit 6ac508c4ba3fdc278aaf8cfe2c58d01de3395431
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 02:25:09 2012 -0500
Remove msf3 subdir
commit a27dac5067635a95b4cbb773df1985f2a2dc2c5a
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 02:24:39 2012 -0500
Remove the old busted external
commit 5fb5a0fc642b6c301934c319db854cc3145427a1
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 02:03:10 2012 -0500
Add the gemcache loader
commit 09e2d89dfd09b9ac0c123fcc4e19816c86725627
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 02:02:23 2012 -0500
Purge gemfile/bundler configure in exchange for new gemcache setup
commit 3cc0264e1cfb027b515d7f24b95a74b023bd905c
Author: Tod Beardsley <todb@metasploit.com>
Date: Thu Apr 12 14:11:45 2012 -0500
Mode change on modicon_ladder.apx
commit c18b3d56efd639e461137acdc76b4b283fe978d4
Author: HD Moore <hd_moore@rapid7.com>
Date: Thu Apr 12 01:38:56 2012 -0500
The go faster button
commit ca2a67d51d6d4c7c3ca2e745f8b018279aef668a
Merge: 674ee09 b8129f9
Author: Tod Beardsley <todb@metasploit.com>
Date: Mon Apr 9 15:50:33 2012 -0500
Merge branch 'master-clone' into rails3-clone
Picking up Packetfu upstream changes, all pretty minor
commit 674ee097ab8a6bc9608bf377479ccd0b87e7302b
Merge: e9513e5 a26e844
Author: Tod Beardsley <todb@metasploit.com>
Date: Mon Apr 9 13:57:26 2012 -0500
Merge branch 'master-clone' into rails3-clone
Conflicts:
lib/msf/core/handler/reverse_http.rb
lib/msf/core/handler/reverse_https.rb
modules/auxiliary/scanner/discovery/udp_probe.rb
modules/auxiliary/scanner/discovery/udp_sweep.rb
Resolved conflicts with the reverse_http handlers and the udp probe /
scanners byt favoring the more recent changes (which happened to be the
intent anyway). The reverse_http and reverse_https changes were mine so
I know what the intent was, and @dmaloney-r7 changed udp_probe and
udp_sweep to use pcAnywhere_stat instead of merely pcAnywhere, so the
intent is clear there as well.
commit e9513e54f984fdb100c13b44a1724246779ccb76
Author: David Maloney <dmaloney@melodie.gateway.2wire.net>
Date: Fri Apr 6 18:21:46 2012 -0500
Some fixes to how services get reported to prevent issues with the web interface
commit adeb44e9aaf1a329a0e587d2b26e678398730422
Author: David Maloney <David_Maloney@rapid7.com>
Date: Mon Apr 2 15:39:46 2012 -0500
Some corrections to pcAnywhere discovery modules to distinguish between the two services
commit b13900176484fea8f5217a2ef925ae2ad9b7af47
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Mar 31 12:03:21 2012 -0500
Enable additional migration-path parameters, use a temporary directory to bring the database online
commit 526b4c56883f461417f71269404faef38639917c
Author: David Maloney <David_Maloney@rapid7.com>
Date: Wed Mar 28 23:24:56 2012 -0500
A bunch of Mdsm fixes for .kind_of? calls, to make sure we ponit to the right place
commit 2cf3143370af808637d164ce59400605300f922c
Author: HD Moore <hd_moore@rapid7.com>
Date: Mon Mar 26 16:22:09 2012 -0500
Check for ruby 2.0 as well as 1.9 for encoding override
commit 4d0f51b76d89f00f7acbce6b1f00dc6e4c4545ee
Author: HD Moore <hd_moore@rapid7.com>
Date: Mon Mar 26 15:36:04 2012 -0500
Remove debug statement
commit f5d2335e7745aa1a354f4d6c8fc9d0b3876c472a
Author: HD Moore <hd_moore@rapid7.com>
Date: Mon Mar 26 15:01:55 2012 -0500
Be explicit about the Mdm namespace
commit bc8be225606d6ea38dd2a85ab4310c1c181a94ee
Author: hdm <hdm@hypo.(none)>
Date: Mon Mar 26 11:49:51 2012 -0500
Precalculate some uri strings in case the 1000-round generation fails
commit 4254f419723349ffb93e4aebdaeabbd7d66bf8c0
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Sat Mar 24 14:03:44 2012 -0500
Removed some non-namespaced calls to Host
commit c8190e1bb8ad365fb0d7a1c4a9173e6c739be85c
Author: HD Moore <hd_moore@rapid7.com>
Date: Tue Mar 20 00:37:00 2012 -0500
Purge the rvmrc, this is causing major headaches
commit 76df18588917b7150a3bedf2569710a80bab51f8
Author: HD Moore <hd_moore@rapid7.com>
Date: Tue Mar 20 00:31:52 2012 -0500
Switch .rvmrc to the shipping 1.9.3 version
commit 7124971d0032b268f4ddf89aca125f15e284f345
Author: David Maloney <David_Maloney@rapid7.com>
Date: Mon Mar 12 16:56:40 2012 -0500
Adds mixin for looking up Mime Types by extension
commit b7ca8353164c43db6bacb2f3f16afa1269f66e43
Merge: a0b0c75 6b9a219
Author: Matt Buck <techpeace@gmail.com>
Date: Tue Mar 6 19:38:53 2012 -0600
Merge from develop.
commit a0b0c7528d2b8fabb76b2246a15004bc89239cf0
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Tue Mar 6 11:08:59 2012 -0600
Somehow migration file is new?
commit 84d2b3cb1ad6290413c3ea3222ddf9932270b105
Author: David Maloney <David_Maloney@rapid7.com>
Date: Wed Feb 29 16:38:55 2012 -0600
Added ability to specify headers to redirects in http server
commit e50d27cda83872c616722adb03dc1a6a5e685405
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Feb 4 04:44:50 2012 -0600
Tweak the event dispatcher to enable customer events without a category
and trigger http request events from the main exploit mixin.
Experimental
commit 0e4fd2040df49df2e6cb0e8d2c6240a03d108033
Author: Matt Buck <Matthew_Buck@rapid7.com>
Date: Thu Feb 2 22:09:05 2012 -0600
Change Msm -> Mdm in migrations. This is what was preventing migrations from finishing on first boot.
commit c94a2961d04eee84adfd42bb01ed7a3e3846b83a
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Wed Feb 1 12:48:48 2012 -0600
Changed Gemfile to use new gem name
commit 245c2063f06b4fddbfc607d243796669ef236136
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Wed Feb 1 12:47:42 2012 -0600
Did find/replace for final namespace of Mdm
commit 6ed9bf8430b555dcbe62daeddb2f33bd400ab5bc
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Tue Jan 24 10:47:44 2012 -0600
Fix a bunch of namespace issues
commit 2fe08d9e4226c27e78d07a00178c58f528cbc72e
Author: Matt Buck <Matthew_Buck@rapid7.com>
Date: Fri Jan 20 14:37:37 2012 -0600
Update Msm contstants in migrations for initial DB builds.
commit 4cc6b8fb0440c6258bf70de77a9153468fea4ea5
Author: Matt Buck <Matthew_Buck@rapid7.com>
Date: Fri Jan 20 14:37:25 2012 -0600
Update Gemfile.lock.
commit 1cc655b678f0a054a9a783da119237fe3f67faa4
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Thu Jan 19 11:48:29 2012 -0600
Errant Workspaces needed namespace
commit 607a78285582c530a68985add33ccf4d899c467a
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Tue Jan 17 15:44:02 2012 -0600
Refactored all models to use the new namespace
* Every model using DBManager::* namespace is now Msm namespace
* Almost all of this in msf/base/core
* Some in modules
commit a690cd959b3560fa2284975ca7ecca10c228fb05
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Tue Jan 17 13:41:44 2012 -0600
Move bundler setup
commit dae115cc8f7619ca7a827123079cb67fb4d9354b
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Mon Jan 9 15:51:07 2012 -0600
Moved ActiveSupport dep to gem
commit d32f8edb6e7f82079b775ffbc2b9a405d1f32b3b
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Mon Jan 9 14:40:05 2012 -0600
Removed model require file
commit d0c74cff8c44771e566ec63b03eda10d03b25c42
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Tue Jan 3 16:06:10 2012 -0600
Update some more finds
commit 4eb79ea6b58b74c309ab1f1bb0bd35fe9041de46
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Tue Jan 3 14:21:15 2012 -0600
Yet another dumb commit
commit a75febcb593d52fdfe930306b4275829759d81d1
Author: Trevor Rosen <trevor@catapult-creative.com>
Date: Thu Dec 29 19:20:51 2011 -0600
Fixing deletion
commit dc139ff2fdfc4e7cdee3901dfb863e70913d6b92
Author: Trevor Rosen <trevor@catapult-creative.com>
Date: Wed Dec 7 17:06:45 2011 -0600
Fixed erroneous commit
commit 531c1e611cf4d23aeb9c48350dabf7630d662d25
Author: Trevor Rosen <trevor@catapult-creative.com>
Date: Mon Nov 21 16:11:35 2011 -0600
Remove AR patch stuff; attempting to debug non-connection between MSF and Pro
commit 458611224189c7aa27e500aabd373d85dc2dc5c0
Author: Trevor Rosen <trevor@catapult-creative.com>
Date: Fri Nov 18 16:17:27 2011 -0600
Drop ActiveRecord/ActiveSupport in preparation for upgrade
2012-04-16 04:35:38 +00:00
|
|
|
opts['DatabaseMigrationPaths'].each {|m| framework.db.add_migration_path(m) }
|
2012-03-31 17:03:21 +00:00
|
|
|
end
|
|
|
|
|
2010-12-14 09:59:49 +00:00
|
|
|
# Look for our database configuration in the following places, in order:
|
|
|
|
# command line arguments
|
|
|
|
# environment variable
|
|
|
|
# configuration directory (usually ~/.msf3)
|
|
|
|
dbfile = opts['DatabaseYAML']
|
|
|
|
dbfile ||= ENV["MSF_DATABASE_CONFIG"]
|
|
|
|
dbfile ||= File.join(Msf::Config.get_config_root, "database.yml")
|
2011-10-17 21:41:22 +00:00
|
|
|
if (dbfile and File.exists? dbfile)
|
|
|
|
if File.readable?(dbfile)
|
|
|
|
dbinfo = YAML.load(File.read(dbfile))
|
|
|
|
dbenv = opts['DatabaseEnv'] || "production"
|
|
|
|
db = dbinfo[dbenv]
|
|
|
|
else
|
|
|
|
print_error("Warning, #{dbfile} is not readable. Try running as root or chmod.")
|
|
|
|
end
|
2010-10-23 22:51:28 +00:00
|
|
|
if not db
|
|
|
|
print_error("No database definition for environment #{dbenv}")
|
|
|
|
else
|
|
|
|
if not framework.db.connect(db)
|
Cutting over rails3 to master.
This switches the Metasploit Framework to a Rails 3 backend. If you run
into new problems (especially around Active Record or your postgresql
gem) you should try first updating your Ruby installation to 1.9.3 and
use a more recent 'pg' gem.
If that fails, we'd love to see your bug report (just drop all the
detail you can into an issue on GitHub). In the meantime, you can
checkout the rails2 branch, which was branched from master immediately
before this cutover.
Squashed commit of the following:
commit 5802ec851580341c6717dfea529027c12678d35f
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 23:30:12 2012 -0500
Enable MSF_BUNDLE_GEMS mode by default (set to N/F/0 to disable)
commit 8102f98dce9eb0c73c4374e40dce09af7b51d060
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 23:30:03 2012 -0500
Add a method to expand win32 file paths
commit bda6479d154cf75572dd5de8b66bfde661a55de9
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 18:53:44 2012 -0500
Fix 1.8.x compatibility
commit 101ce4eb17bfdf755ef8c0a5198174668b6cd6fd
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 18:40:59 2012 -0500
Use verbose instead of stringio
commit 5db467ffb593488285576d183b1662093e454b3e
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 18:30:06 2012 -0500
Hide the iconv warning, were stuck with it due to EBCDIC support
commit 63b9cb20eb6a61daf4effb4c8d2761c16ff0c4e0
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 18:29:58 2012 -0500
Dont use GEM_HOME by default
commit ca49271c22c314a4465fff934334df18c704cbc0
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 18:23:34 2012 -0500
Move Gemfile to root (there be dragons, lets find them) and catch failed bundler loads
commit 34af04076a068e9f60c5526045ddbba5fca359fd
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 18:18:29 2012 -0500
Fallback to bundler when not running inside of a installer env
commit ed1066a4f3f12fae7d4afc03eb1ab70ffe2f9cf3
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 16:26:55 2012 -0500
Remove a mess of gems that were not actually required
commit 21290a73926809e9049a59359449168f740d13d2
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 15:59:10 2012 -0500
Hack around a gem() call that is well-intentioned but an obstacle in this case
commit 8e414a8bfab9641c81088d22f73033be5b37a700
Author: Tod Beardsley <todb@metasploit.com>
Date: Sun Apr 15 15:06:08 2012 -0500
Ruby, come on. Ducktype this. Please.
Use interpolated strings to get the to_s behavior you don't get with
just plussing.
commit 0fa92c58750f8f84edbecfaab72cd2da5062743f
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 15:05:42 2012 -0500
Add new eventmachine/thin gems
commit 819d5e7d45e0a16741d3852df3ed110b4d7abc44
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 15:01:18 2012 -0500
Purge (reimport in a second)
commit ea6f3f6c434537ca15b6c6674e31081e27ce7f86
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 14:54:42 2012 -0500
Cleanup uncessary .so files (ext vs lib)
commit d219330a3cc563e9da9f01fade016c9ed8cda21c
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 14:53:02 2012 -0500
PG gems built against the older installation environment
commit d6e590cfa331ae7b25313ff1471c6148a6b36f3b
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 14:06:35 2012 -0500
Rename to include the version
commit a893de222b97ce1222a55324f1811b0262aae2d0
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 13:56:47 2012 -0500
Detect older installation environments and load the arch-lib directories into the search path
commit 6444bba0a421921e2ebe2df2323277a586f9736f
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 13:49:25 2012 -0500
Merge in windows gems
commit 95efbcfde220917bc7ee08e6083d7b383240d185
Author: Tod Beardsley <todb@metasploit.com>
Date: Sun Apr 15 13:49:33 2012 -0500
Report_vuln shouldn't use :include in finder
find_or_create_by doesn't take :include as a param.
commit c5f99eb87f0874ef7d32fa42828841c9a714b787
Author: David Maloney <DMaloney@rapid7.com>
Date: Sun Apr 15 12:44:09 2012 -0500
One more msised Mdm namespace issue
commit 2184e2bbc3dd9b0993e8f21d2811a65a0c694d68
Author: David Maloney <DMaloney@rapid7.com>
Date: Sun Apr 15 12:33:41 2012 -0500
Fixes some mroe Mdm namespace confusion
Fixes #6626
commit 10cee17f391f398bb2be3409137ff7348c7a66ee
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 03:40:44 2012 -0500
Add robots gem (required by webscan)
commit 327e674c83850101364c9cca8f8d16da1de3dfb5
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 03:39:05 2012 -0500
Fix missing error checks
commit a5a24641866e47e611d7636a3f19ba3b3ed10ac5
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 01:15:37 2012 -0500
Reorder requires and add a method for injecting a new migration path
commit 250a5fa5ae8cb05807af022aa4168907772c15f8
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 00:56:09 2012 -0500
Remove missing constant (use string) and add gemcache cleaner
commit 37ad6063fce0a41dddedb857fa49aa2c4834a508
Merge: d47ee82 4be0361
Author: Tod Beardsley <todb@metasploit.com>
Date: Sun Apr 15 00:40:16 2012 -0500
Merge branch 'master-clone' into rails3-clone
commit d47ee82ad7e66de53dd3d3a65649cc37299a2479
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 00:30:03 2012 -0500
cleanup leftovers from gems
commit 6d883b5aa8a3a7ddbcde5bfd4521d57c5b30d3c2
Author: HD Moore <hd_moore@rapid7.com>
Date: Sun Apr 15 00:25:47 2012 -0500
MDM update with purged DBSave module
commit 71e4f2d81f6da221b76150562a16c730888f5925
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 23:19:37 2012 -0500
Add new mdm
commit 651cd5adac8211d65e0c8079371d8264e549533a
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 23:19:13 2012 -0500
Update mdm
commit 0191a8bd0acec30ddb2a9e9c291111a12378537f
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 22:30:40 2012 -0500
This fixes numerous cases of missed Mdm:: prefixes on db objects
commit a2a9bb3f2148622c135663dead80b3367b6f7695
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 18:30:18 2012 -0500
Add eventmachine
commit 301ddeb12b906ed3c508613ca894347bedc3b499
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 18:18:12 2012 -0500
A nicer error for folks who need to upgrade pg
commit fa6bde1e67b12e2d3d9978f59bbc98e0c1a1a707
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 17:54:55 2012 -0500
Remove bundler requirements
commit 2e3ab9ed211303f1116e602b9a450141b71e56a4
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 17:35:38 2012 -0500
Pull in eventmachine with actual .so's this time
commit 901fb33ff6b754ce2c2cfd51e3b0b669f6ec600b
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 17:19:12 2012 -0500
Update deps, still need to add eventmachine
commit 6b0e17068e8caa0601f3ef81e8dbdb672758fcbe
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 13:07:06 2012 -0500
Handle older installer environments and only allow binary gems when the
environment specifically asks for it
commit b98eb7873a6342834840424699caa414a5cb172a
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 04:05:13 2012 -0500
Bump version to -testing
commit 6ac508c4ba3fdc278aaf8cfe2c58d01de3395431
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 02:25:09 2012 -0500
Remove msf3 subdir
commit a27dac5067635a95b4cbb773df1985f2a2dc2c5a
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 02:24:39 2012 -0500
Remove the old busted external
commit 5fb5a0fc642b6c301934c319db854cc3145427a1
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 02:03:10 2012 -0500
Add the gemcache loader
commit 09e2d89dfd09b9ac0c123fcc4e19816c86725627
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Apr 14 02:02:23 2012 -0500
Purge gemfile/bundler configure in exchange for new gemcache setup
commit 3cc0264e1cfb027b515d7f24b95a74b023bd905c
Author: Tod Beardsley <todb@metasploit.com>
Date: Thu Apr 12 14:11:45 2012 -0500
Mode change on modicon_ladder.apx
commit c18b3d56efd639e461137acdc76b4b283fe978d4
Author: HD Moore <hd_moore@rapid7.com>
Date: Thu Apr 12 01:38:56 2012 -0500
The go faster button
commit ca2a67d51d6d4c7c3ca2e745f8b018279aef668a
Merge: 674ee09 b8129f9
Author: Tod Beardsley <todb@metasploit.com>
Date: Mon Apr 9 15:50:33 2012 -0500
Merge branch 'master-clone' into rails3-clone
Picking up Packetfu upstream changes, all pretty minor
commit 674ee097ab8a6bc9608bf377479ccd0b87e7302b
Merge: e9513e5 a26e844
Author: Tod Beardsley <todb@metasploit.com>
Date: Mon Apr 9 13:57:26 2012 -0500
Merge branch 'master-clone' into rails3-clone
Conflicts:
lib/msf/core/handler/reverse_http.rb
lib/msf/core/handler/reverse_https.rb
modules/auxiliary/scanner/discovery/udp_probe.rb
modules/auxiliary/scanner/discovery/udp_sweep.rb
Resolved conflicts with the reverse_http handlers and the udp probe /
scanners byt favoring the more recent changes (which happened to be the
intent anyway). The reverse_http and reverse_https changes were mine so
I know what the intent was, and @dmaloney-r7 changed udp_probe and
udp_sweep to use pcAnywhere_stat instead of merely pcAnywhere, so the
intent is clear there as well.
commit e9513e54f984fdb100c13b44a1724246779ccb76
Author: David Maloney <dmaloney@melodie.gateway.2wire.net>
Date: Fri Apr 6 18:21:46 2012 -0500
Some fixes to how services get reported to prevent issues with the web interface
commit adeb44e9aaf1a329a0e587d2b26e678398730422
Author: David Maloney <David_Maloney@rapid7.com>
Date: Mon Apr 2 15:39:46 2012 -0500
Some corrections to pcAnywhere discovery modules to distinguish between the two services
commit b13900176484fea8f5217a2ef925ae2ad9b7af47
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Mar 31 12:03:21 2012 -0500
Enable additional migration-path parameters, use a temporary directory to bring the database online
commit 526b4c56883f461417f71269404faef38639917c
Author: David Maloney <David_Maloney@rapid7.com>
Date: Wed Mar 28 23:24:56 2012 -0500
A bunch of Mdsm fixes for .kind_of? calls, to make sure we ponit to the right place
commit 2cf3143370af808637d164ce59400605300f922c
Author: HD Moore <hd_moore@rapid7.com>
Date: Mon Mar 26 16:22:09 2012 -0500
Check for ruby 2.0 as well as 1.9 for encoding override
commit 4d0f51b76d89f00f7acbce6b1f00dc6e4c4545ee
Author: HD Moore <hd_moore@rapid7.com>
Date: Mon Mar 26 15:36:04 2012 -0500
Remove debug statement
commit f5d2335e7745aa1a354f4d6c8fc9d0b3876c472a
Author: HD Moore <hd_moore@rapid7.com>
Date: Mon Mar 26 15:01:55 2012 -0500
Be explicit about the Mdm namespace
commit bc8be225606d6ea38dd2a85ab4310c1c181a94ee
Author: hdm <hdm@hypo.(none)>
Date: Mon Mar 26 11:49:51 2012 -0500
Precalculate some uri strings in case the 1000-round generation fails
commit 4254f419723349ffb93e4aebdaeabbd7d66bf8c0
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Sat Mar 24 14:03:44 2012 -0500
Removed some non-namespaced calls to Host
commit c8190e1bb8ad365fb0d7a1c4a9173e6c739be85c
Author: HD Moore <hd_moore@rapid7.com>
Date: Tue Mar 20 00:37:00 2012 -0500
Purge the rvmrc, this is causing major headaches
commit 76df18588917b7150a3bedf2569710a80bab51f8
Author: HD Moore <hd_moore@rapid7.com>
Date: Tue Mar 20 00:31:52 2012 -0500
Switch .rvmrc to the shipping 1.9.3 version
commit 7124971d0032b268f4ddf89aca125f15e284f345
Author: David Maloney <David_Maloney@rapid7.com>
Date: Mon Mar 12 16:56:40 2012 -0500
Adds mixin for looking up Mime Types by extension
commit b7ca8353164c43db6bacb2f3f16afa1269f66e43
Merge: a0b0c75 6b9a219
Author: Matt Buck <techpeace@gmail.com>
Date: Tue Mar 6 19:38:53 2012 -0600
Merge from develop.
commit a0b0c7528d2b8fabb76b2246a15004bc89239cf0
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Tue Mar 6 11:08:59 2012 -0600
Somehow migration file is new?
commit 84d2b3cb1ad6290413c3ea3222ddf9932270b105
Author: David Maloney <David_Maloney@rapid7.com>
Date: Wed Feb 29 16:38:55 2012 -0600
Added ability to specify headers to redirects in http server
commit e50d27cda83872c616722adb03dc1a6a5e685405
Author: HD Moore <hd_moore@rapid7.com>
Date: Sat Feb 4 04:44:50 2012 -0600
Tweak the event dispatcher to enable customer events without a category
and trigger http request events from the main exploit mixin.
Experimental
commit 0e4fd2040df49df2e6cb0e8d2c6240a03d108033
Author: Matt Buck <Matthew_Buck@rapid7.com>
Date: Thu Feb 2 22:09:05 2012 -0600
Change Msm -> Mdm in migrations. This is what was preventing migrations from finishing on first boot.
commit c94a2961d04eee84adfd42bb01ed7a3e3846b83a
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Wed Feb 1 12:48:48 2012 -0600
Changed Gemfile to use new gem name
commit 245c2063f06b4fddbfc607d243796669ef236136
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Wed Feb 1 12:47:42 2012 -0600
Did find/replace for final namespace of Mdm
commit 6ed9bf8430b555dcbe62daeddb2f33bd400ab5bc
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Tue Jan 24 10:47:44 2012 -0600
Fix a bunch of namespace issues
commit 2fe08d9e4226c27e78d07a00178c58f528cbc72e
Author: Matt Buck <Matthew_Buck@rapid7.com>
Date: Fri Jan 20 14:37:37 2012 -0600
Update Msm contstants in migrations for initial DB builds.
commit 4cc6b8fb0440c6258bf70de77a9153468fea4ea5
Author: Matt Buck <Matthew_Buck@rapid7.com>
Date: Fri Jan 20 14:37:25 2012 -0600
Update Gemfile.lock.
commit 1cc655b678f0a054a9a783da119237fe3f67faa4
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Thu Jan 19 11:48:29 2012 -0600
Errant Workspaces needed namespace
commit 607a78285582c530a68985add33ccf4d899c467a
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Tue Jan 17 15:44:02 2012 -0600
Refactored all models to use the new namespace
* Every model using DBManager::* namespace is now Msm namespace
* Almost all of this in msf/base/core
* Some in modules
commit a690cd959b3560fa2284975ca7ecca10c228fb05
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Tue Jan 17 13:41:44 2012 -0600
Move bundler setup
commit dae115cc8f7619ca7a827123079cb67fb4d9354b
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Mon Jan 9 15:51:07 2012 -0600
Moved ActiveSupport dep to gem
commit d32f8edb6e7f82079b775ffbc2b9a405d1f32b3b
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Mon Jan 9 14:40:05 2012 -0600
Removed model require file
commit d0c74cff8c44771e566ec63b03eda10d03b25c42
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Tue Jan 3 16:06:10 2012 -0600
Update some more finds
commit 4eb79ea6b58b74c309ab1f1bb0bd35fe9041de46
Author: Trevor Rosen <Trevor_Rosen@rapid7.com>
Date: Tue Jan 3 14:21:15 2012 -0600
Yet another dumb commit
commit a75febcb593d52fdfe930306b4275829759d81d1
Author: Trevor Rosen <trevor@catapult-creative.com>
Date: Thu Dec 29 19:20:51 2011 -0600
Fixing deletion
commit dc139ff2fdfc4e7cdee3901dfb863e70913d6b92
Author: Trevor Rosen <trevor@catapult-creative.com>
Date: Wed Dec 7 17:06:45 2011 -0600
Fixed erroneous commit
commit 531c1e611cf4d23aeb9c48350dabf7630d662d25
Author: Trevor Rosen <trevor@catapult-creative.com>
Date: Mon Nov 21 16:11:35 2011 -0600
Remove AR patch stuff; attempting to debug non-connection between MSF and Pro
commit 458611224189c7aa27e500aabd373d85dc2dc5c0
Author: Trevor Rosen <trevor@catapult-creative.com>
Date: Fri Nov 18 16:17:27 2011 -0600
Drop ActiveRecord/ActiveSupport in preparation for upgrade
2012-04-16 04:35:38 +00:00
|
|
|
if framework.db.error.to_s =~ /RubyGem version.*pg.*0\.11/i
|
|
|
|
print_error("***")
|
|
|
|
print_error("*")
|
|
|
|
print_error("* Metasploit now requires version 0.11 or higher of the 'pg' gem for database support")
|
|
|
|
print_error("* There a three ways to accomplish this upgrade:")
|
|
|
|
print_error("* 1. If you run Metasploit with your system ruby, simply upgrade the gem:")
|
|
|
|
print_error("* $ rvmsudo gem install pg ")
|
|
|
|
print_error("* 2. Use the Community Edition web interface to apply a Software Update")
|
|
|
|
print_error("* 3. Uninstall, download the latest version, and reinstall Metasploit")
|
|
|
|
print_error("*")
|
|
|
|
print_error("***")
|
|
|
|
print_error("")
|
|
|
|
print_error("")
|
|
|
|
end
|
|
|
|
|
2010-10-23 22:51:28 +00:00
|
|
|
print_error("Failed to connect to the database: #{framework.db.error} #{db.inspect} #{framework.db.error.backtrace}")
|
2012-06-16 20:41:37 +00:00
|
|
|
else
|
|
|
|
self.framework.modules.refresh_cache
|
|
|
|
if self.framework.modules.cache.keys.length == 0
|
|
|
|
print_status("The initial module cache will be built in the background, this can take 2-5 minutes...")
|
|
|
|
end
|
2010-10-23 22:51:28 +00:00
|
|
|
end
|
2010-10-19 07:51:58 +00:00
|
|
|
end
|
2010-12-29 02:15:18 +00:00
|
|
|
end
|
2010-10-19 07:51:58 +00:00
|
|
|
end
|
2010-12-29 02:15:18 +00:00
|
|
|
|
2012-06-29 06:03:13 +00:00
|
|
|
# Initialize the module paths only if we didn't get passed a Framework instance
|
|
|
|
unless opts['Framework']
|
|
|
|
# Configure the framework module paths
|
|
|
|
self.framework.init_module_paths
|
|
|
|
self.framework.modules.add_module_path(opts['ModulePath']) if opts['ModulePath']
|
|
|
|
|
|
|
|
# Rebuild the module cache in a background thread
|
|
|
|
self.framework.threads.spawn("ModuleCacheRebuild", true) do
|
|
|
|
self.framework.cache_thread = Thread.current
|
|
|
|
self.framework.modules.rebuild_cache
|
|
|
|
self.framework.cache_initialized = true
|
|
|
|
self.framework.cache_thread = nil
|
|
|
|
end
|
2012-06-16 20:41:37 +00:00
|
|
|
end
|
|
|
|
|
2012-06-25 06:16:35 +00:00
|
|
|
# Load console-specific configuration (after module paths are added)
|
|
|
|
load_config(opts['Config'])
|
|
|
|
|
2009-11-10 03:27:48 +00:00
|
|
|
# Process things before we actually display the prompt and get rocking
|
2011-01-25 22:58:21 +00:00
|
|
|
on_startup(opts)
|
2009-11-10 03:27:48 +00:00
|
|
|
|
|
|
|
# Process the resource script
|
2010-02-02 23:13:42 +00:00
|
|
|
if opts['Resource'] and opts['Resource'].kind_of? Array
|
|
|
|
opts['Resource'].each { |r|
|
|
|
|
load_resource(r)
|
|
|
|
}
|
|
|
|
else
|
|
|
|
# If the opt is nil here, we load ~/.msf3/msfconsole.rc
|
|
|
|
load_resource(opts['Resource'])
|
|
|
|
end
|
2005-07-15 22:30:04 +00:00
|
|
|
end
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2011-11-09 21:32:48 +00:00
|
|
|
#
|
|
|
|
# Configure a default output path for jUnit XML output
|
|
|
|
#
|
|
|
|
def junit_setup(output_path)
|
|
|
|
output_path = ::File.expand_path(output_path)
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2011-11-09 21:32:48 +00:00
|
|
|
::FileUtils.mkdir_p(output_path)
|
|
|
|
@junit_output_path = output_path
|
|
|
|
@junit_error_count = 0
|
|
|
|
print_status("Test Output: #{output_path}")
|
2011-12-14 03:13:31 +00:00
|
|
|
|
|
|
|
# We need at least one test success in order to pass
|
|
|
|
junit_pass("framework_loaded")
|
2011-11-09 21:32:48 +00:00
|
|
|
end
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2011-11-09 21:32:48 +00:00
|
|
|
#
|
|
|
|
# Emit a new jUnit XML output file representing an error
|
|
|
|
#
|
2011-11-10 03:40:02 +00:00
|
|
|
def junit_error(tname, ftype, data = nil)
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2011-11-09 21:32:48 +00:00
|
|
|
if not @junit_output_path
|
|
|
|
raise RuntimeError, "No output path, call junit_setup() first"
|
|
|
|
end
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2011-11-10 03:40:02 +00:00
|
|
|
data ||= framework.inspect.to_s
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2011-11-09 21:32:48 +00:00
|
|
|
e = REXML::Element.new("testsuite")
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2011-11-09 21:32:48 +00:00
|
|
|
c = REXML::Element.new("testcase")
|
2011-11-09 22:21:39 +00:00
|
|
|
c.attributes["classname"] = "msfrc"
|
2011-11-09 21:32:48 +00:00
|
|
|
c.attributes["name"] = tname
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2011-11-09 21:32:48 +00:00
|
|
|
f = REXML::Element.new("failure")
|
|
|
|
f.attributes["type"] = ftype
|
2011-11-20 01:32:06 +00:00
|
|
|
|
|
|
|
f.text = data
|
2011-11-09 21:32:48 +00:00
|
|
|
c << f
|
|
|
|
e << c
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2011-12-14 03:13:31 +00:00
|
|
|
bname = ("msfrpc_#{tname}").gsub(/[^A-Za-z0-9\.\_]/, '')
|
|
|
|
bname << "_" + Digest::MD5.hexdigest(tname)
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2011-11-10 03:40:02 +00:00
|
|
|
fname = ::File.join(@junit_output_path, "#{bname}.xml")
|
|
|
|
cnt = 0
|
|
|
|
while ::File.exists?( fname )
|
|
|
|
cnt += 1
|
|
|
|
fname = ::File.join(@junit_output_path, "#{bname}_#{cnt}.xml")
|
2011-11-20 01:32:06 +00:00
|
|
|
end
|
|
|
|
|
2011-11-09 21:32:48 +00:00
|
|
|
::File.open(fname, "w") do |fd|
|
|
|
|
fd.write(e.to_s)
|
|
|
|
end
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2011-11-09 21:32:48 +00:00
|
|
|
print_error("Test Error: #{tname} - #{ftype} - #{data}")
|
|
|
|
end
|
2011-12-14 03:13:31 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Emit a new jUnit XML output file representing a success
|
|
|
|
#
|
|
|
|
def junit_pass(tname)
|
|
|
|
|
|
|
|
if not @junit_output_path
|
|
|
|
raise RuntimeError, "No output path, call junit_setup() first"
|
|
|
|
end
|
|
|
|
|
|
|
|
# Generate the structure of a test case run
|
|
|
|
e = REXML::Element.new("testsuite")
|
|
|
|
c = REXML::Element.new("testcase")
|
|
|
|
c.attributes["classname"] = "msfrc"
|
|
|
|
c.attributes["name"] = tname
|
|
|
|
e << c
|
|
|
|
|
|
|
|
# Generate a unique name
|
|
|
|
bname = ("msfrpc_#{tname}").gsub(/[^A-Za-z0-9\.\_]/, '')
|
|
|
|
bname << "_" + Digest::MD5.hexdigest(tname)
|
|
|
|
|
|
|
|
# Generate the output path, allow multiple test with the same name
|
|
|
|
fname = ::File.join(@junit_output_path, "#{bname}.xml")
|
|
|
|
cnt = 0
|
|
|
|
while ::File.exists?( fname )
|
|
|
|
cnt += 1
|
|
|
|
fname = ::File.join(@junit_output_path, "#{bname}_#{cnt}.xml")
|
|
|
|
end
|
|
|
|
|
|
|
|
# Write to our test output location, as specified with junit_setup
|
|
|
|
::File.open(fname, "w") do |fd|
|
|
|
|
fd.write(e.to_s)
|
|
|
|
end
|
|
|
|
|
|
|
|
print_good("Test Pass: #{tname}")
|
|
|
|
end
|
|
|
|
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2011-11-09 21:32:48 +00:00
|
|
|
#
|
|
|
|
# Emit a jUnit XML output file and throw a fatal exception
|
|
|
|
#
|
|
|
|
def junit_fatal_error(tname, ftype, data)
|
|
|
|
junit_error(tname, ftype, data)
|
|
|
|
print_error("Exiting")
|
|
|
|
run_single("exit -y")
|
|
|
|
end
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2005-10-30 23:40:27 +00:00
|
|
|
#
|
|
|
|
# Loads configuration that needs to be analyzed before the framework
|
|
|
|
# instance is created.
|
|
|
|
#
|
|
|
|
def load_preconfig
|
|
|
|
begin
|
|
|
|
conf = Msf::Config.load
|
|
|
|
rescue
|
|
|
|
wlog("Failed to load configuration: #{$!}")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if (conf.group?(ConfigCore))
|
|
|
|
conf[ConfigCore].each_pair { |k, v|
|
|
|
|
on_variable_set(true, k, v)
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2005-07-15 22:30:04 +00:00
|
|
|
#
|
2005-11-15 15:11:43 +00:00
|
|
|
# Loads configuration for the console.
|
2005-07-15 22:30:04 +00:00
|
|
|
#
|
2006-04-02 16:28:02 +00:00
|
|
|
def load_config(path=nil)
|
2005-07-15 22:30:04 +00:00
|
|
|
begin
|
2006-04-02 16:28:02 +00:00
|
|
|
conf = Msf::Config.load(path)
|
2005-07-15 22:30:04 +00:00
|
|
|
rescue
|
|
|
|
wlog("Failed to load configuration: #{$!}")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
# If we have configuration, process it
|
|
|
|
if (conf.group?(ConfigGroup))
|
|
|
|
conf[ConfigGroup].each_pair { |k, v|
|
2005-10-02 03:21:26 +00:00
|
|
|
case k.downcase
|
|
|
|
when "activemodule"
|
2005-07-15 22:30:04 +00:00
|
|
|
run_single("use #{v}")
|
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
2005-11-15 15:11:43 +00:00
|
|
|
# Saves configuration for the console.
|
2005-07-15 22:30:04 +00:00
|
|
|
#
|
|
|
|
def save_config
|
|
|
|
# Build out the console config group
|
|
|
|
group = {}
|
|
|
|
|
|
|
|
if (active_module)
|
|
|
|
group['ActiveModule'] = active_module.fullname
|
|
|
|
end
|
|
|
|
|
|
|
|
# Save it
|
2010-03-22 14:26:02 +00:00
|
|
|
begin
|
2009-03-08 07:41:28 +00:00
|
|
|
Msf::Config.save(ConfigGroup => group)
|
|
|
|
rescue ::Exception
|
|
|
|
print_error("Failed to save console config: #{$!}")
|
2005-07-15 22:30:04 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
2005-11-15 15:11:43 +00:00
|
|
|
# Processes the resource script file for the console.
|
2005-07-15 22:30:04 +00:00
|
|
|
#
|
2006-04-02 16:28:02 +00:00
|
|
|
def load_resource(path=nil)
|
|
|
|
path ||= File.join(Msf::Config.config_directory, 'msfconsole.rc')
|
2010-03-22 15:50:42 +00:00
|
|
|
return if not ::File.readable?(path)
|
2011-10-20 06:41:07 +00:00
|
|
|
resource_file = ::File.read(path)
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2011-11-10 03:40:02 +00:00
|
|
|
self.active_resource = resource_file
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2011-10-20 06:41:07 +00:00
|
|
|
# Process ERB directives first
|
2011-11-20 01:32:06 +00:00
|
|
|
print_status "Processing #{path} for ERB directives."
|
2011-10-20 06:41:07 +00:00
|
|
|
erb = ERB.new(resource_file)
|
|
|
|
processed_resource = erb.result(binding)
|
|
|
|
|
|
|
|
lines = processed_resource.each_line.to_a
|
2011-10-31 17:48:03 +00:00
|
|
|
bindings = {}
|
2010-03-22 14:26:02 +00:00
|
|
|
while lines.length > 0
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2010-03-22 14:26:02 +00:00
|
|
|
line = lines.shift
|
|
|
|
break if not line
|
2008-04-26 18:28:41 +00:00
|
|
|
line.strip!
|
|
|
|
next if line.length == 0
|
|
|
|
next if line =~ /^#/
|
2011-10-31 17:48:03 +00:00
|
|
|
|
|
|
|
# Pretty soon, this is going to need an XML parser :)
|
|
|
|
# TODO: case matters for the tag and for binding names
|
|
|
|
if line =~ /<ruby/
|
|
|
|
if line =~ /\s+binding=(?:'(\w+)'|"(\w+)")(>|\s+)/
|
|
|
|
bin = ($~[1] || $~[2])
|
|
|
|
bindings[bin] = binding unless bindings.has_key? bin
|
|
|
|
bin = bindings[bin]
|
|
|
|
else
|
|
|
|
bin = binding
|
|
|
|
end
|
2010-03-22 14:26:02 +00:00
|
|
|
buff = ''
|
|
|
|
while lines.length > 0
|
|
|
|
line = lines.shift
|
|
|
|
break if not line
|
2011-01-31 07:11:33 +00:00
|
|
|
break if line =~ /<\/ruby>/
|
2010-03-22 14:26:02 +00:00
|
|
|
buff << line
|
|
|
|
end
|
|
|
|
if ! buff.empty?
|
|
|
|
print_status("resource (#{path})> Ruby Code (#{buff.length} bytes)")
|
|
|
|
begin
|
2011-10-31 17:48:03 +00:00
|
|
|
eval(buff, bin)
|
2010-03-22 14:26:02 +00:00
|
|
|
rescue ::Interrupt
|
|
|
|
raise $!
|
|
|
|
rescue ::Exception => e
|
|
|
|
print_error("resource (#{path})> Ruby Error: #{e.class} #{e} #{e.backtrace}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
print_line("resource (#{path})> #{line}")
|
|
|
|
run_single(line)
|
|
|
|
end
|
2006-04-02 16:28:02 +00:00
|
|
|
end
|
2011-11-20 01:32:06 +00:00
|
|
|
|
|
|
|
self.active_resource = nil
|
2005-07-14 07:13:01 +00:00
|
|
|
end
|
|
|
|
|
2010-08-23 21:19:01 +00:00
|
|
|
#
|
|
|
|
# Saves the recent history to the specified file
|
|
|
|
#
|
|
|
|
def save_recent_history(path)
|
|
|
|
num = Readline::HISTORY.length - hist_last_saved - 1
|
|
|
|
|
|
|
|
tmprc = ""
|
|
|
|
num.times { |x|
|
|
|
|
tmprc << Readline::HISTORY[hist_last_saved + x] + "\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
if tmprc.length > 0
|
|
|
|
print_status("Saving last #{num} commands to #{path} ...")
|
|
|
|
save_resource(tmprc, path)
|
|
|
|
else
|
|
|
|
print_error("No commands to save!")
|
|
|
|
end
|
|
|
|
|
|
|
|
# Always update this, even if we didn't save anything. We do this
|
|
|
|
# so that we don't end up saving the "makerc" command itself.
|
|
|
|
self.hist_last_saved = Readline::HISTORY.length
|
|
|
|
end
|
|
|
|
|
2006-04-02 16:28:02 +00:00
|
|
|
#
|
|
|
|
# Creates the resource script file for the console.
|
|
|
|
#
|
|
|
|
def save_resource(data, path=nil)
|
|
|
|
path ||= File.join(Msf::Config.config_directory, 'msfconsole.rc')
|
2010-03-22 14:26:02 +00:00
|
|
|
|
2006-04-02 16:28:02 +00:00
|
|
|
begin
|
|
|
|
rcfd = File.open(path, 'w')
|
|
|
|
rcfd.write(data)
|
|
|
|
rcfd.close
|
2008-11-11 06:00:54 +00:00
|
|
|
rescue ::Exception
|
2006-04-02 16:28:02 +00:00
|
|
|
end
|
|
|
|
end
|
2010-03-22 14:26:02 +00:00
|
|
|
|
2005-07-14 07:13:01 +00:00
|
|
|
#
|
|
|
|
# Called before things actually get rolling such that banners can be
|
|
|
|
# displayed, scripts can be processed, and other fun can be had.
|
|
|
|
#
|
2011-01-25 22:58:21 +00:00
|
|
|
def on_startup(opts = {})
|
2006-09-16 06:27:14 +00:00
|
|
|
# Check for modules that failed to load
|
|
|
|
if (framework.modules.failed.length > 0)
|
2010-05-24 23:07:52 +00:00
|
|
|
print_error("WARNING! The following modules could not be loaded!")
|
2006-09-16 06:27:14 +00:00
|
|
|
framework.modules.failed.each_pair do |file, err|
|
2010-05-24 23:07:52 +00:00
|
|
|
print_error("\t#{file}: #{err}")
|
2006-09-16 06:27:14 +00:00
|
|
|
end
|
|
|
|
end
|
2009-12-22 18:52:48 +00:00
|
|
|
framework.events.on_ui_start(Msf::Framework::Revision)
|
2010-03-22 14:26:02 +00:00
|
|
|
|
2011-01-25 22:58:21 +00:00
|
|
|
run_single("banner") unless opts['DisableBanner']
|
|
|
|
|
2011-02-13 22:19:43 +00:00
|
|
|
opts["Plugins"].each do |plug|
|
2011-07-15 23:46:37 +00:00
|
|
|
run_single("load '#{plug}'")
|
2011-02-13 22:19:43 +00:00
|
|
|
end if opts["Plugins"]
|
|
|
|
|
2010-01-06 05:06:12 +00:00
|
|
|
self.on_command_proc = Proc.new { |command| framework.events.on_ui_command(command) }
|
2005-05-22 19:39:21 +00:00
|
|
|
end
|
|
|
|
|
2005-10-01 21:51:45 +00:00
|
|
|
#
|
|
|
|
# Called when a variable is set to a specific value. This allows the
|
|
|
|
# console to do extra processing, such as enabling logging or doing
|
|
|
|
# some other kind of task. If this routine returns false it will indicate
|
|
|
|
# that the variable is not being set to a valid value.
|
|
|
|
#
|
2005-10-02 03:21:26 +00:00
|
|
|
def on_variable_set(glob, var, val)
|
2005-10-01 21:51:45 +00:00
|
|
|
case var.downcase
|
|
|
|
when "payload"
|
2010-03-22 14:26:02 +00:00
|
|
|
|
2005-11-24 03:53:45 +00:00
|
|
|
if (framework and framework.modules.valid?(val) == false)
|
2005-10-01 21:51:45 +00:00
|
|
|
return false
|
2006-01-16 21:34:36 +00:00
|
|
|
elsif (active_module)
|
2005-12-31 20:26:17 +00:00
|
|
|
active_module.datastore.clear_non_user_defined
|
2006-01-16 21:36:17 +00:00
|
|
|
elsif (framework)
|
2006-01-16 21:34:36 +00:00
|
|
|
framework.datastore.clear_non_user_defined
|
2005-10-01 21:51:45 +00:00
|
|
|
end
|
2005-10-02 03:21:26 +00:00
|
|
|
when "sessionlogging"
|
|
|
|
handle_session_logging(val) if (glob)
|
2005-10-02 04:05:17 +00:00
|
|
|
when "consolelogging"
|
|
|
|
handle_console_logging(val) if (glob)
|
2005-10-30 23:40:27 +00:00
|
|
|
when "loglevel"
|
|
|
|
handle_loglevel(val) if (glob)
|
2011-07-21 06:14:25 +00:00
|
|
|
when "prompt"
|
2011-11-20 01:32:06 +00:00
|
|
|
update_prompt(val, framework.datastore['PromptChar'] || DefaultPromptChar, true)
|
2011-07-21 14:35:02 +00:00
|
|
|
when "promptchar"
|
2011-07-21 06:17:44 +00:00
|
|
|
update_prompt(framework.datastore['Prompt'], val, true)
|
2005-10-01 21:51:45 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Called when a variable is unset. If this routine returns false it is an
|
|
|
|
# indication that the variable should not be allowed to be unset.
|
|
|
|
#
|
2005-10-02 03:21:26 +00:00
|
|
|
def on_variable_unset(glob, var)
|
|
|
|
case var.downcase
|
|
|
|
when "sessionlogging"
|
|
|
|
handle_session_logging('0') if (glob)
|
2005-10-02 04:05:17 +00:00
|
|
|
when "consolelogging"
|
|
|
|
handle_console_logging('0') if (glob)
|
2005-10-30 23:40:27 +00:00
|
|
|
when "loglevel"
|
|
|
|
handle_loglevel(nil) if (glob)
|
2005-10-02 03:21:26 +00:00
|
|
|
end
|
2005-10-01 21:51:45 +00:00
|
|
|
end
|
|
|
|
|
2005-11-15 15:11:43 +00:00
|
|
|
#
|
|
|
|
# The framework instance associated with this driver.
|
|
|
|
#
|
2005-07-18 05:13:21 +00:00
|
|
|
attr_reader :framework
|
2005-11-15 15:11:43 +00:00
|
|
|
#
|
2005-12-07 03:06:31 +00:00
|
|
|
# Whether or not commands can be passed through.
|
|
|
|
#
|
|
|
|
attr_reader :command_passthru
|
|
|
|
#
|
2005-11-15 15:11:43 +00:00
|
|
|
# The active module associated with the driver.
|
|
|
|
#
|
2005-07-14 06:34:58 +00:00
|
|
|
attr_accessor :active_module
|
2007-02-18 22:35:07 +00:00
|
|
|
#
|
|
|
|
# The active session associated with the driver.
|
|
|
|
#
|
|
|
|
attr_accessor :active_session
|
2011-11-10 03:40:02 +00:00
|
|
|
#
|
|
|
|
# The active resource file being processed by the driver
|
|
|
|
#
|
|
|
|
attr_accessor :active_resource
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2007-01-30 04:48:35 +00:00
|
|
|
#
|
|
|
|
# If defanged is true, dangerous functionality, such as exploitation, irb,
|
2010-03-22 14:26:02 +00:00
|
|
|
# and command shell passthru is disabled. In this case, an exception is
|
2007-01-30 04:48:35 +00:00
|
|
|
# raised.
|
|
|
|
#
|
|
|
|
def defanged?
|
|
|
|
if @defanged
|
|
|
|
raise DefangedException
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-12-22 18:52:48 +00:00
|
|
|
def stop
|
|
|
|
framework.events.on_ui_stop()
|
|
|
|
super
|
|
|
|
end
|
|
|
|
|
2005-05-22 19:39:21 +00:00
|
|
|
protected
|
|
|
|
|
2005-11-15 15:11:43 +00:00
|
|
|
attr_writer :framework # :nodoc:
|
2005-12-07 03:06:31 +00:00
|
|
|
attr_writer :command_passthru # :nodoc:
|
|
|
|
|
|
|
|
#
|
|
|
|
# If an unknown command was passed, try to see if it's a valid local
|
|
|
|
# executable. This is only allowed if command passthru has been permitted
|
|
|
|
#
|
|
|
|
def unknown_command(method, line)
|
2007-12-31 02:03:13 +00:00
|
|
|
|
|
|
|
[method, method+".exe"].each do |cmd|
|
|
|
|
if (command_passthru == true and Rex::FileUtils.find_full_path(cmd))
|
|
|
|
|
|
|
|
print_status("exec: #{line}")
|
|
|
|
print_line('')
|
|
|
|
|
2008-01-21 02:10:27 +00:00
|
|
|
self.busy = true
|
2009-12-03 08:17:14 +00:00
|
|
|
begin
|
|
|
|
io = ::IO.popen(line, "r")
|
|
|
|
io.each_line do |data|
|
|
|
|
print(data)
|
|
|
|
end
|
|
|
|
io.close
|
|
|
|
rescue ::Errno::EACCES, ::Errno::ENOENT
|
|
|
|
print_error("Permission denied exec: #{line}")
|
2007-12-31 02:03:13 +00:00
|
|
|
end
|
2008-01-21 02:10:27 +00:00
|
|
|
self.busy = false
|
2007-12-31 02:03:13 +00:00
|
|
|
return
|
2007-01-22 06:57:07 +00:00
|
|
|
end
|
2005-12-07 03:06:31 +00:00
|
|
|
end
|
2010-03-22 14:26:02 +00:00
|
|
|
|
2007-12-31 02:03:13 +00:00
|
|
|
super
|
2005-12-07 03:06:31 +00:00
|
|
|
end
|
2010-03-22 14:26:02 +00:00
|
|
|
|
2005-10-02 03:21:26 +00:00
|
|
|
##
|
|
|
|
#
|
|
|
|
# Handlers for various global configuration values
|
|
|
|
#
|
|
|
|
##
|
2005-05-22 19:39:21 +00:00
|
|
|
|
2005-10-02 03:21:26 +00:00
|
|
|
#
|
2005-11-15 15:11:43 +00:00
|
|
|
# SessionLogging.
|
2005-10-02 03:21:26 +00:00
|
|
|
#
|
|
|
|
def handle_session_logging(val)
|
2009-01-07 02:50:10 +00:00
|
|
|
if (val =~ /^(y|t|1)/i)
|
2005-10-02 03:21:26 +00:00
|
|
|
Msf::Logging.enable_session_logging(true)
|
|
|
|
print_line("Session logging will be enabled for future sessions.")
|
|
|
|
else
|
|
|
|
Msf::Logging.enable_session_logging(false)
|
|
|
|
print_line("Session logging will be disabled for future sessions.")
|
|
|
|
end
|
|
|
|
end
|
2010-03-22 14:26:02 +00:00
|
|
|
|
2005-10-02 04:05:17 +00:00
|
|
|
#
|
2005-11-15 15:11:43 +00:00
|
|
|
# ConsoleLogging.
|
2005-10-02 04:05:17 +00:00
|
|
|
#
|
|
|
|
def handle_console_logging(val)
|
2009-01-07 02:50:10 +00:00
|
|
|
if (val =~ /^(y|t|1)/i)
|
2005-10-02 04:05:17 +00:00
|
|
|
Msf::Logging.enable_log_source('console')
|
|
|
|
print_line("Console logging is now enabled.")
|
|
|
|
|
|
|
|
set_log_source('console')
|
2010-03-22 14:26:02 +00:00
|
|
|
|
2005-10-02 04:05:17 +00:00
|
|
|
rlog("\n[*] Console logging started: #{Time.now}\n\n", 'console')
|
|
|
|
else
|
|
|
|
rlog("\n[*] Console logging stopped: #{Time.now}\n\n", 'console')
|
|
|
|
|
|
|
|
unset_log_source
|
|
|
|
|
|
|
|
Msf::Logging.disable_log_source('console')
|
|
|
|
print_line("Console logging is now disabled.")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2005-10-30 23:40:27 +00:00
|
|
|
#
|
|
|
|
# This method handles adjusting the global log level threshold.
|
|
|
|
#
|
|
|
|
def handle_loglevel(val)
|
|
|
|
set_log_level(Rex::LogSource, val)
|
|
|
|
set_log_level(Msf::LogSource, val)
|
|
|
|
end
|
|
|
|
|
2005-05-22 19:39:21 +00:00
|
|
|
end
|
|
|
|
|
2007-01-30 04:48:35 +00:00
|
|
|
#
|
|
|
|
# This exception is used to indicate that functionality is disabled due to
|
|
|
|
# defanged being true
|
|
|
|
#
|
|
|
|
class DefangedException < ::Exception
|
|
|
|
def to_s
|
|
|
|
"This functionality is currently disabled (defanged mode)"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2005-05-22 19:39:21 +00:00
|
|
|
end
|
|
|
|
end
|
2008-11-11 06:00:54 +00:00
|
|
|
end
|
2010-03-22 14:26:02 +00:00
|
|
|
|