Require dependencies conditionally in msfvenom
This avoids the long wait time while showing help for msfvenom.
This commit is contained in:
parent
44d5022380
commit
13555cb09b
36
msfvenom
36
msfvenom
|
@ -1,21 +1,6 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- coding: binary -*-
|
||||
|
||||
msfbase = __FILE__
|
||||
while File.symlink?(msfbase)
|
||||
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
|
||||
end
|
||||
|
||||
$:.unshift(File.expand_path(File.join(File.dirname(msfbase), 'lib')))
|
||||
require 'msfenv'
|
||||
|
||||
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
|
||||
|
||||
require 'rex'
|
||||
require 'msf/ui'
|
||||
require 'msf/base'
|
||||
require 'msf/core/payload_generator'
|
||||
|
||||
class MsfVenomError < StandardError; end
|
||||
class HelpError < StandardError; end
|
||||
class UsageError < MsfVenomError; end
|
||||
|
@ -24,12 +9,33 @@ class IncompatibleError < MsfVenomError; end
|
|||
|
||||
require 'optparse'
|
||||
|
||||
def require_deps
|
||||
msfbase = __FILE__
|
||||
while File.symlink?(msfbase)
|
||||
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
|
||||
end
|
||||
|
||||
$:.unshift(File.expand_path(File.join(File.dirname(msfbase), 'lib')))
|
||||
require 'msfenv'
|
||||
|
||||
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
|
||||
|
||||
require 'rex'
|
||||
require 'msf/ui'
|
||||
require 'msf/base'
|
||||
require 'msf/core/payload_generator'
|
||||
|
||||
@framework_loaded = true
|
||||
end
|
||||
|
||||
# Creates a new framework object.
|
||||
#
|
||||
# @note Ignores any previously cached value.
|
||||
# @param (see ::Msf::Simple::Framework.create)
|
||||
# @return [Msf::Framework]
|
||||
def init_framework(create_opts={})
|
||||
require_deps unless @framework_loaded
|
||||
|
||||
create_opts[:module_types] ||= [
|
||||
::Msf::MODULE_PAYLOAD, ::Msf::MODULE_ENCODER, ::Msf::MODULE_NOP
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue