mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-05 14:57:30 +01:00
Land #8689, Docker improvements
This commit is contained in:
commit
f573a4804c
@ -17,5 +17,9 @@ if [[ -z "$MSF_PATH" ]]; then
|
||||
MSF_PATH=$(dirname $(dirname $path))
|
||||
fi
|
||||
|
||||
if [[ -n "$MSF_BUILD" ]]; then
|
||||
docker-compose -f $MSF_PATH/docker-compose.yml build
|
||||
fi
|
||||
|
||||
cd $MSF_PATH
|
||||
docker-compose run --rm --service-ports ms ./msfvenom "$@"
|
||||
|
26
docker/bin/msfvenom-dev
Executable file
26
docker/bin/msfvenom-dev
Executable file
@ -0,0 +1,26 @@
|
||||
#! /bin/bash
|
||||
|
||||
if [[ -z "$MSF_PATH" ]]; then
|
||||
path=`dirname $0`
|
||||
|
||||
# check for ./docker/msfconsole.rc
|
||||
if [[ ! -f $path/../msfconsole.rc ]] ; then
|
||||
|
||||
# we are not inside the project
|
||||
realpath --version > /dev/null 2>&1 || { echo >&2 "I couldn't find where metasploit is. Set \$MSF_PATH or execute this from the project root"; exit 1 ;}
|
||||
|
||||
# determine script path
|
||||
pushd $(dirname $(realpath $0)) > /dev/null
|
||||
path=$(pwd)
|
||||
popd > /dev/null
|
||||
fi
|
||||
MSF_PATH=$(dirname $(dirname $path))
|
||||
fi
|
||||
|
||||
cd $MSF_PATH
|
||||
|
||||
if [[ -n "$MSF_BUILD" ]]; then
|
||||
docker-compose -f $MSF_PATH/docker-compose.yml -f $MSF_PATH/docker/docker-compose.development.override.yml build
|
||||
fi
|
||||
|
||||
docker-compose -f $MSF_PATH/docker-compose.yml -f $MSF_PATH/docker/docker-compose.development.override.yml run --rm --service-ports ms ./msfvenom "$@"
|
@ -21,3 +21,4 @@ end
|
||||
|
||||
# Executable generation and encoding
|
||||
require 'msf/util/exe'
|
||||
require 'msf/util/helper'
|
||||
|
21
lib/msf/util/helper.rb
Normal file
21
lib/msf/util/helper.rb
Normal file
@ -0,0 +1,21 @@
|
||||
# -*- coding: binary -*-
|
||||
|
||||
module Msf
|
||||
module Util
|
||||
class Helper
|
||||
# Cross-platform way of finding an executable in the $PATH.
|
||||
#
|
||||
# which('ruby') #=> /usr/bin/ruby
|
||||
def self.which(cmd)
|
||||
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
||||
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
||||
exts.each { |ext|
|
||||
exe = File.join(path, "#{cmd}#{ext}")
|
||||
return exe if File.executable?(exe) && !File.directory?(exe)
|
||||
}
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -13,6 +13,7 @@ end
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require 'metasploit/framework/version'
|
||||
require 'metasploit/framework/rails_version_constraint'
|
||||
require 'msf/util/helper'
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = 'metasploit-framework'
|
||||
@ -24,7 +25,8 @@ Gem::Specification.new do |spec|
|
||||
spec.homepage = 'https://www.metasploit.com'
|
||||
spec.license = 'BSD-3-clause'
|
||||
|
||||
if File.directory?(File.join(File.dirname(__FILE__), ".git"))
|
||||
# only do a git ls-files if the .git folder exists and we have a git binary in PATH
|
||||
if File.directory?(File.join(File.dirname(__FILE__), ".git")) && Msf::Util::Helper.which("git")
|
||||
spec.files = `git ls-files`.split($/).reject { |file|
|
||||
file =~ /^documentation|^external/
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user