Mettle

这是一个原生代码的 Meterpreter 的实现,旨在实现可移植性、嵌入性和低资源利用率。「This is an implementation of a native-code Meterpreter, designed for portability, embeddability, and low resource utilization.」

  • 所有者: rapid7/mettle
  • 平台: Android, iOS, Linux, Mac, Windows
  • 许可证:
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Mettle

This is an implementation of a native-code Meterpreter, designed for
portability, embeddability, and low resource utilization. It can run on the
smallest embedded Linux targets to big iron, and targets Android, iOS, macOS,
Linux, and Windows, but can be ported to almost any POSIX-compliant
environment.

Building on Linux

Debain, Ubuntu, and derivatives are most supported for builds. To build, you need at least 5GB of free disk space, and the following packages available:

# Dependencies
apt install curl build-essential git autoconf automake libtool bison flex gcc ruby rake bundler git mingw-w64

The Dockerfile under docker/Dockerfile contains a pre-configured build
environment as well.

Building on macOS

On macOS you will need to install the xcode command line tools as follows:

xcode-select --install

Make Targets

For general development, there are a few make targets defined:

Running make will build for the local environment. E.g. if you're on macOS,
it will build for macOS using your native compiler and tools.

make TARGET=triple will build for a specific host triple. See below for some
common ones.

make clean will clean the 'mettle' directory for the current build target

make distclean will clean the entire build target`

make all-parallel will build for every known target, useful with '-j' to build multiple targets at once.

make clean-parallel and make distclean-parallel do similar for all targets.

Packaging

To build the gem for distribution (currently requires Linux or macOS):

rake build

To check the resulting binaries:

rake check

To completely reset your dev environment and delete all binary artifacts:

rake mettle:ultraclean

Gem API

To generate a payload with Mettle:

mettle = MetasploitPayloads::Mettle.new(platform_triple, config={})

The available platform triples for Linux targets are:

  • aarch64-linux-musl
  • armv5l-linux-musleabi
  • armv5b-linux-musleabi
  • i486-linux-musl
  • x86_64-linux-musl
  • powerpc-linux-muslsf
  • powerpc64le-linux-musl
  • mips-linux-muslsf
  • mipsel-linux-muslsf
  • mips64-linux-muslsf
  • s390x-linux-musl

For Mingw32-64 Windows targets, the following triples are added. On up-to-date
Debian / Ubuntu systems, the mingw-w64 package will install both toolchains.

  • x86_64-w64-mingw32
  • i686-w64-mingw32

For macOS/iOS builds, the following triples are added. To target older macOS/OSX
versions, see https://github.com/phracker/MacOSX-SDKs to get the appropriate
SDK folder.

  • arm-iphone-darwin
  • aarch64-iphone-darwin
  • i386-apple-darwin
  • x86_64-apple-darwin

Available config options are:

  • :background - fork to background as a daemon
  • :debug - to turn on debug messages
  • :log_file - the file to send debug messages to instead of stderr
  • :uri - the uri to connect back to
  • :uuid - the UUID to identify the payload

Config options can also be set with:

mettle.config[:key] = val

To get a binary with installed options call:

mettle.to_binary(format=:process_image)

The formats are:

  • :exec - a standalone executable that can take command-line arguments (see mettle -h) or use pre-set ones
  • :process_image - a process image that must be started with a custom stack (see doc/stack_requirements.md)

Using with Metasploit

To pull your local changes of mettle into your Metasploit install:

  1. Add -dev to the version in lib/metasploit_payloads/mettle/version.rb
  2. Build the gem as above
  3. Copy pkg/metasploit-payloads-mettle-X.X.X.pre.dev.gem to the box you are using for Metasploit if it is different
  4. Change the version in your metasploit-framework.gemspec to match the one you just built
  5. gem install <path to new gem> (for example: 'metasploit_payloads-mettle', '0.4.1.pre.dev')
  6. Run bundle install in your Framework directory, and ensure you see something like Using metasploit_payloads-mettle 0.4.1.pre.dev (was 0.4.1) in the output
  7. Congrats, you are now done!

Pushing out a New Gem

Build CI will automatically publish new gems when commits land to master and pass build.

  1. Test Locally
  2. Land the changes to upstream master
  3. Monitor for the new gem on rubygems.org
  4. Once the gem appears, make a PR for bumping the version in framework

主要指标

概览
名称与所有者rapid7/mettle
主编程语言C
编程语言Makefile (语言数: 7)
平台Android, iOS, Linux, Mac, Windows
许可证
所有者活动
创建于2015-03-02 14:14:41
推送于2025-05-16 16:22:32
最后一次提交2025-05-16 16:22:31
发布数64
最新版本名称v1.0.42 (发布于 2025-05-16 16:22:31)
第一版名称v0.5.1 (发布于 )
用户参与
星数445
关注者数80
派生数124
提交数1.1k
已启用问题?
问题数57
打开的问题数24
拉请求数200
打开的拉请求数1
关闭的拉请求数21
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?