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.
- 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.
Clone the repository and navigate to the project directory:
git clone https://github.com/yourusername/StringMorph.git
cd StringMorphEnsure you have Python 3 installed. You can run the program directly without any additional dependencies.
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.
Extract ASCII strings from a binary file and save them to a CSV file:
python stringmorph.py binaryfile.bin -o output.csvExtract strings that contain specific keywords:
python stringmorph.py binaryfile.bin -k keyword1,keyword2 -o output.csvModify a binary file using the strings extracted in the previous step:
python stringmorph.py binaryfile.bin -e -o output.csvModify 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 -eRun the binary modification in test mode (no file will be saved, and modifications will be displayed):
python stringmorph.py binaryfile.bin -t -o output.csvReplace 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-
Extract strings longer than 7 characters from
sample.bin:python stringmorph.py sample.bin -l 7 -o strings.csv
-
Modify
sample.binusing strings fromsource.csvwith the default random string replacements:python stringmorph.py sample.bin -s source.csv -e
-
Run a test modification of
sample.binwith all characters replaced byX:python stringmorph.py sample.bin -s source.csv -t --single-char X
-
Extract strings containing specific keywords and modify the binary file:
python stringmorph.py sample.bin -k password,secret -e
-
Extract strings without considering spaces as separators and save to
strings.csv:python stringmorph.py sample.bin --no-space -o strings.csv
-
Generate SHA256 hashes of the original and modified binary files:
python stringmorph.py sample.bin -e -o strings.csv
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 are welcome! Feel free to submit issues or pull requests to enhance the tool.