Skip to main content

Generate/find patterns for use in stack smashing alla pattern_{create,offset}.rb from Metasploit

Project description

msfpatterns

📦️ PyPI 👷 Continuous Integration 🧪 Coverage

msfpatterns (Buffer Overflow Finder) is a tool for generating and analyzing cyclic patterns, similar to pattern_create and pattern_offset from Metasploit. It helps exploit developers identify exact buffer overflow offsets across multiple architectures, including 16-bit, 32-bit, and 64-bit platforms.

Features

  • Generate unique cyclic patterns for buffer overflow analysis
  • Find offsets of overwritten return addresses in memory dumps
  • Supports 2-byte, 4-byte, and 8-byte searches (suitable for MSP430, x86, x86-64, etc.)
  • Returns all matching offsets (useful for 16-bit systems where repeats may occur)
  • Simple CLI interface

Installation

Using uv (recommended)

uv tool install msfpatterns

Using pip

pip install msfpatterns

CLI Usage

Generating a Pattern

pattern 128 # Generates a pattern of length 128

Finding an Offset

pattern -q 0x41306241 128 # Find offset of 0x41306241 in a 128-byte pattern

Library Usage

You can also use msfpatterns as a Python library:

from msfpatterns import generate_pattern, find_offset

pattern = generate_pattern(128)
print(pattern)
offset = find_offset("0x41306241", 128)
print(f"Offset: {offset}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

msfpatterns-4.1.0.tar.gz (36.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

msfpatterns-4.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file msfpatterns-4.1.0.tar.gz.

File metadata

  • Download URL: msfpatterns-4.1.0.tar.gz
  • Upload date:
  • Size: 36.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.7

File hashes

Hashes for msfpatterns-4.1.0.tar.gz
Algorithm Hash digest
SHA256 b6b1c43dd04a8f93d0578560db9f722eb7a687f76660c7be959854d51b745330
MD5 3ea3232f15e6e2b8b34b3fbfc2bf1f8d
BLAKE2b-256 da24c816db4299c65f19503bf392b1c074aba1a30dc63b2eceea9348e81b1e72

See more details on using hashes here.

File details

Details for the file msfpatterns-4.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for msfpatterns-4.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39f3a182af94dd8d0263630bd5b42daeae4564d6a098722c5a92a0a0cd467e10
MD5 65010a315e993e380bda616f5ae48ed1
BLAKE2b-256 e569a859da7c78b7f4ea0041fe7d263f66a145e24f18eebfbc9e30f9165a8e67

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page