Skip to content

jph4cks/StringMorph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

StringMorph

StringMorph is a Python tool designed to find, scramble, and modify binary data. It allows you to extract ASCII strings from binary files and perform binary modifications based on a set of rules. The tool provides flexibility with several options, including testing mode, binary hashing, and targeted modifications using custom CSV files.

Features

  • ASCII String Extraction: Extracts ASCII strings from a binary file, allowing you to filter by length and keywords.
  • Binary Modification: Modify binary files based on extracted strings or an external CSV file, with options for custom character substitutions.
  • SHA256 Hashing: Generates and displays SHA256 hashes for both the original and modified binary files.
  • Flexible Options: Includes testing mode, verbose output, and options to use specific characters for string scrambling.

Installation

Clone the repository and navigate to the project directory:

git clone https://github.com/yourusername/StringMorph.git
cd StringMorph

Ensure you have Python 3 installed. You can run the program directly without any additional dependencies.

Usage

Command-Line Options

  • filename: The binary file to inspect and/or modify.
  • -l, --length: Minimum length of ASCII strings to consider (default: 7).
  • -k, --keywords: Comma-separated list of keywords to filter strings.
  • -v, --verbose: Print output to the terminal.
  • -o, --output: Specify the output CSV file name (default: output.csv).
  • --no-space: Consider strings separated by spaces as individual strings.
  • -e, --execute: Modify the binary file using extracted strings or sourcefile.
  • -t, --test: Modify the binary file in test mode (no file will be saved).
  • --single-char: Substitute strings using only this character (numbers replaced by 4).
  • -s, --sourcefile: Specify a CSV file to use for binary modifications instead of extracting strings.

Basic String Extraction

Extract ASCII strings from a binary file and save them to a CSV file:

python stringmorph.py binaryfile.bin -o output.csv

Extract Strings with Keyword Filtering

Extract strings that contain specific keywords:

python stringmorph.py binaryfile.bin -k keyword1,keyword2 -o output.csv

Binary Modification Based on Extracted Strings

Modify a binary file using the strings extracted in the previous step:

python stringmorph.py binaryfile.bin -e -o output.csv

Modify Binary File Using an External CSV File

Modify a binary file using an external CSV file (sourcefile.csv), which contains the positions and strings to be replaced:

python stringmorph.py binaryfile.bin -s sourcefile.csv -e

Test Mode

Run the binary modification in test mode (no file will be saved, and modifications will be displayed):

python stringmorph.py binaryfile.bin -t -o output.csv

Use a Single Character for String Replacement

Replace all characters in the strings with a single character, such as A, while modifying the binary:

python stringmorph.py binaryfile.bin -s sourcefile.csv -e --single-char A

Example Commands

  1. Extract strings longer than 7 characters from sample.bin:

    python stringmorph.py sample.bin -l 7 -o strings.csv
  2. Modify sample.bin using strings from source.csv with the default random string replacements:

    python stringmorph.py sample.bin -s source.csv -e
  3. Run a test modification of sample.bin with all characters replaced by X:

    python stringmorph.py sample.bin -s source.csv -t --single-char X
  4. Extract strings containing specific keywords and modify the binary file:

    python stringmorph.py sample.bin -k password,secret -e
  5. Extract strings without considering spaces as separators and save to strings.csv:

    python stringmorph.py sample.bin --no-space -o strings.csv
  6. Generate SHA256 hashes of the original and modified binary files:

    python stringmorph.py sample.bin -e -o strings.csv

Additional Information

The tool generates SHA256 hashes of the original and modified binary files to verify the integrity of the modifications. The --test flag allows you to preview modifications without saving them, which is useful for debugging or exploring potential changes.

Contributions

Contributions are welcome! Feel free to submit issues or pull requests to enhance the tool.

About

A Python tool for finding, scrambling, and modifying binary data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages