CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/docker/bin/msfvenom
Views: 1904
#! /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

PARAMS="$@"

if [[ $PARAMS == *"--rebuild"* ]]; then
  echo "Rebuilding image"
  docker-compose build
  exit $?
fi

# we need no database here
docker-compose run --rm --no-deps ms ./msfvenom "$PARAMS"