From d24e2943ca7189517f02319612336257d221e3d0 Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Mon, 10 Jul 2017 16:38:10 +0200 Subject: [PATCH] update docker stuff --- docker/bin/msfvenom | 4 ++++ docker/bin/msfvenom-dev | 26 ++++++++++++++++++++++++++ metasploit-framework.gemspec | 4 +++- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100755 docker/bin/msfvenom-dev diff --git a/docker/bin/msfvenom b/docker/bin/msfvenom index 2b12210b4f..3efc05168d 100755 --- a/docker/bin/msfvenom +++ b/docker/bin/msfvenom @@ -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 "$@" diff --git a/docker/bin/msfvenom-dev b/docker/bin/msfvenom-dev new file mode 100755 index 0000000000..32b1049748 --- /dev/null +++ b/docker/bin/msfvenom-dev @@ -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 "$@" diff --git a/metasploit-framework.gemspec b/metasploit-framework.gemspec index dd46fa433e..cb1e8596af 100644 --- a/metasploit-framework.gemspec +++ b/metasploit-framework.gemspec @@ -24,7 +24,9 @@ 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")) && + ENV['PATH'].split(':').collect {|d| Dir.entries d if Dir.exists? d}.flatten.include?("git") spec.files = `git ls-files`.split($/).reject { |file| file =~ /^documentation|^external/ }