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/data/cmd_exec/README.md
Views: 1904

Setup

This contains setup steps used for acceptance testing of the cmd_exec API. We will make use of the gcc docker image to build out the C binaries to then be uploaded to the host machine, so they can be used as part of the cmd_exec create process API.

This directory contains:

  • C executable show_args.c This file is used as part of the cmd_exec testing as it requires a file to take args, then loop over them and output those args back to the user.

  • Makefile to build the binaries makefile.mk This file is used to create the binaries for both Windows and Linux that the docker command below will make use of. This will output the following binaries:

    • Precompiled binary for Windows

      • show_args.exe

    • Precompiled binary for Linux and Mettle

      • show_args

Note

You will need to compile the OSX payload separately on an OSX machine, Docker is not supported. The test assume the file will be named as show_args_macos.

Compile binaries locally

We make use of gcc for this: https://hub.docker.com/_/gcc

  • Run:

docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp gcc:11.4.0 /bin/bash -c "apt update && apt install -y gcc-mingw-w64 && make all -f makefile.mk"