|
1 | | -# ntstrings |
| 1 | +# ntstrings |
| 2 | + |
| 3 | +**ntstrings** is a string extraction tool for Windows. Designed as a high-performance alternative to standard tools like Sysinternals `strings`, `bstrings`, `xxstrings`, `strings2`, etc. |
| 4 | + |
| 5 | +For a more in-depth explanation of the scanning approach, see the [architecture documentation](https://github.com/NotRequiem/ntstrings/blob/master/architecture.md). |
| 6 | +# Usage |
| 7 | + |
| 8 | +```text |
| 9 | +ntstrings [options] <path> |
| 10 | +``` |
| 11 | + |
| 12 | +### Core Options |
| 13 | + |
| 14 | +| Flag | Description | |
| 15 | +| :--- | :--- | |
| 16 | +| `-h` | Show the help menu. | |
| 17 | +| `-d <dir>` | **Recursive directory scan.** Instead of a single file, provide a directory path to scan all files inside it. | |
| 18 | +| `-o <file>` | **Output file.** Write the extracted strings to the specified file instead of printing them to the console (greatly improves performance for large outputs). | |
| 19 | + |
| 20 | +### Search & Filtering |
| 21 | + |
| 22 | +| Flag | Description | |
| 23 | +| :--- | :--- | |
| 24 | +| `-f <str>` | **Find needle.** Only output strings that contain this specific substring. Highly optimized. | |
| 25 | +| `-i` | **Case insensitive.** Makes the `-f` needle search case-insensitive. | |
| 26 | +| `-n <len>` | **Minimum length.** Minimum number of characters for a string to be considered valid. (Default: `4`) | |
| 27 | +| `-x <len>` | **Maximum length.** Maximum number of characters allowed. Strings longer than this are ignored. (Default: `0` / Unlimited) | |
| 28 | +| `-a <bool>` | **Scan ASCII.** Enable or disable scanning for standard 8-bit ASCII strings. (Default: `true`) | |
| 29 | +| `-u <bool>` | **Scan Unicode.** Enable or disable scanning for 16-bit UTF-16/Unicode strings. (Default: `true`) | |
| 30 | +| `-b <s[:e]>`| **Scan byte range.** Only scan a specific chunk of the file. Format: `start` or `start:end` (in bytes). | |
| 31 | + |
| 32 | +### Regex & Bulk Filtering |
| 33 | +*(Note: If `-f` is used, Regex/List filters are ignored to prioritize the high-speed needle search).* |
| 34 | + |
| 35 | +| Flag | Description | |
| 36 | +| :--- | :--- | |
| 37 | +| `-r <rgx>` | **Regex filter.** Only output strings that match the provided Regular Expression. | |
| 38 | +| `-fs <file>` | **File Strings.** Load a text file containing a list of fixed strings (one per line). Only extracts strings containing at least one of these patterns. | |
| 39 | +| `-fr <file>` | **File Regex.** Load a text file containing a list of regex patterns (one per line). Only extracts strings matching at least one of these patterns. | |
| 40 | + |
| 41 | +### Sorting |
| 42 | + |
| 43 | +| Flag | Description | |
| 44 | +| :--- | :--- | |
| 45 | +| `-sa` | **Sort Alphabetical.** Buffers the results and sorts them alphabetically before outputting. | |
| 46 | +| `-sl` | **Sort Length.** Buffers the results and sorts them by string length before outputting. | |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## Examples |
| 51 | + |
| 52 | +**1. Basic String Extraction** |
| 53 | +Extract all ASCII and Unicode strings (minimum 4 chars) from a file: |
| 54 | +```cmd |
| 55 | +ntstrings C:\path\to\memory.dmp |
| 56 | +``` |
| 57 | + |
| 58 | +**2. Needle Search** |
| 59 | +Search a file for a specific case-insensitive string, outputting the results to a text file: |
| 60 | +```cmd |
| 61 | +ntstrings -f "password" -i -o results.txt memory.dmp |
| 62 | +``` |
| 63 | + |
| 64 | +**3. Regex Filtering** |
| 65 | +Extract only strings that look like URLs: |
| 66 | +```cmd |
| 67 | +ntstrings -r "^https?://" target.bin |
| 68 | +``` |
| 69 | + |
| 70 | +**4. Recursive Directory Scanning** |
| 71 | +Find all strings in a specific directory (and its subdirectories), ignoring Unicode strings, with a minimum length of 10 characters: |
| 72 | +```cmd |
| 73 | +ntstrings -u false -n 10 -d C:\Windows\System32 |
| 74 | +``` |
| 75 | + |
| 76 | +**5. Byte Range Scanning** |
| 77 | +Only scan the first 1 Megabyte of a file: |
| 78 | +```cmd |
| 79 | +ntstrings -b 0:1048576 target.bin |
| 80 | +``` |
| 81 | + |
| 82 | +**6. Bulk IOC Scanning** |
| 83 | +Load a list of malicious strings/indicators from a text file and check an executable for them: |
| 84 | +```cmd |
| 85 | +ntstrings -fs malicious_iocs.txt suspect.exe |
| 86 | +``` |
0 commit comments