How to use Strings
Command line tool that allows you to search for strings embedded in files.
YouTube
Click here for a video explanation.
Official site
https://docs.microsoft.com/en-us/sysinternals/downloads/strings
Option
Parameters | Description |
---|---|
-nobanner | Do not output banner display of String. Useful when using another Utility such as sort in a later process |
-a | ASCII code strings only |
-u | Unicode code strings only |
-s | Search directory recursively |
-n | length of string to search (default is 3) |
-o | display offset value as well (offset value = where the string starts in the file) |
-f | Search for strings at the specified offset value in the file |
-b | The searched range is the number of bytes from the beginning of the file |
Example Search for strings in an executable file
Prepare an executable file, and perform a string search on it.
The source code of the executable to be searched is as follows.
ConsoleApplication1.cpp
#include <iostream>
int main()
{
std::cout << "Hello World!" << std::endl;
}
Create an executable file (exe) and run string against this executable file.
In the example, the string “Hello World!” is extracted after searching for more than the specified number of characters.
> strings.exe -nobanner -n 12 .\ConsoleApplication1.exe | ? {$_ -eq "Hello World!"}
Hello World!
We were able to find the string Hello World!
You can also use findstr
to find the string.
> strings.exe -nobanner -n 12 .\ConsoleApplication1.exe | findstr /i "Hello World!"
Hello World!