Find long printable strings with strings -n 8
Pull readable text out of a binary with strings -n 8 to skip short noise, a first look for keys, URLs and debug messages in a file you did not build.
strings prints every run of printable characters it finds in a file. The default minimum length is 4, which fills the output with accidents like the bytes Aq@h, so raising it to 8 keeps mostly real text. This is the first thing to run on a suspicious binary or a firmware image, since developers leave hostnames, paths and default passwords as plain constants.
#include <stdio.h>
static const char token[] = "deploy-key: hunter2-hunter2";
int main(void)
{
puts(token);
return 0;
}gcc banner.c -o banner
strings -n 8 banner | grep deploydeploy-key: hunter2-hunter2By default the tool scans only the loaded sections of an ELF file, and -a makes it scan the whole file. UTF-16 text, which Windows binaries use, needs -e l for little-endian wide characters. Add -t x to print the file offset of each hit so you can jump to it in a hex editor. A string that does not appear is not proof of absence, because constants can be obfuscated or built at run time. See the strings manual.