Metadata-Version: 2.4
Name: strindex
Version: 4.0.0
Summary: A command line utility to extract and patch strings of some filetypes, with a focus on compatibility and translation.
Author-email: zWolfrost <zwolfrost@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/zWolfrost/strindex
Keywords: PE,strings,patching,translation
Classifier: Development Status :: 5 - Production/Stable
Classifier: Topic :: Utilities
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ahocorasick_rs>=1.0.0
Requires-Dist: pefile>=2024.8.26
Provides-Extra: lang
Requires-Dist: lingua-language-detector==2.*; extra == "lang"
Requires-Dist: language-tool-python==3.*; extra == "lang"
Provides-Extra: gui
Requires-Dist: pyside6==6.*; extra == "gui"
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: Nuitka==4.*; extra == "dev"
Requires-Dist: imageio==2.*; sys_platform == "win32" and extra == "dev"
Requires-Dist: pytest==9.*; extra == "dev"
Dynamic: license-file

# strindex
[![PyPI version](https://img.shields.io/pypi/v/strindex?label=PyPI%20version)](https://pypi.org/project/strindex/)
[![GitHub downloads](https://img.shields.io/github/downloads/zWolfrost/strindex/total?label=GitHub%20downloads)](https://github.com/zWolfrost/strindex/releases/latest)
[![license](https://img.shields.io/github/license/zWolfrost/strindex)](LICENSE)

A command line utility program (with GUI support) that allows you to easily extract, list and patch (replace) the strings embedded in a few filetypes.

It's useful to change the text of a program without having to recompile it; for example, to translate it into another language.

A string can be referenced not only by its pointer / offset, but also by the original string itself to ensure compatibility with different versions of the same program.

It features various built-in features to help with translation, such as spellchecking & filtering strings by length and character set.

## Supported filetypes
*Support for more filetypes is not planned.*
- PE files (".exe", ".dll"...) *(direct pointers only!)*
- Gamemaker data files ("data.win")
- Every filetype, if using force mode*...

**Force mode doesn't allow the replaced strings to be bigger in length than the original strings.*

## Installation
You can install the program with the command `pip install strindex`.

Alternatively, the [releases tab](https://github.com/zWolfrost/strindex/releases/latest) includes a precompiled version of the program, which by default opens in gui mode (unless executed with arguments). Warning: the precompiled version has a high chance of being detected as a **false positive** by antivirus software. You can compile the program yourself to avoid this.

## Usage
You can run the program with the command `strindex <action> <input file(s)> [arguments]`.

`strindex -h` will show the available arguments.

These are the available actions:
- `create`: Create a list of strings (a strindex) extracted from a file. Use `-f` to enable "force" mode, and replace strings at the same offset they were found. Use `-c` to create a strindex that uses the original strings as references, instead of pointers.
- `patch`: Patch a file with a strindex. Strindex files compressed with gzip are also supported for all actions.
- `unpatch`: Unpatch a file that was patched with a strindex, using the backup file.
- `infer`: List the most common bytes that can prefix or suffix a pointer in a file, as well as the most suitable range to use.
- `update` Update a strindex file pointers' with the updated version of a file.
- `filter`: Filter a strindex by detected language, wordlist or length. You can specify those in the strindex settings.
- `delta`: Create a delta file between two strindex files, that only contains the lines of the first strindex missing in the second one (their difference).
- `spellcheck`: Spellcheck a strindex. You can specify the target language in the strindex settings as an ISO 639-1 code.
- `gui`: Open Strindex in GUI mode.

## Usage Examples
- Open strindex in GUI mode:
  ```sh
  strindex gui
  ```
- Create a strindex from a PE file, considering only pointers prefixed by the bytes "24c7442404" or "ec04c70424".
  ```sh
  strindex create program.exe -p "24c7442404" -p "ec04c70424"
  ```
- Create a strindex from a PE file, considering only strings that are present between offsets 0x018bc5ec and 0x01a09fb1.
  ```sh
  strindex create program.exe -m 3 -r "018bc5ec:01a09fb1"
  ```
- Patch a PE file with a strindex:
  ```sh
  strindex patch program.exe strindex.txt
  ```

## Strindex Example
You can find an example of a strindex file and an explanation of its settings [here](strindex_example.txt).
