Skip to main content

print the strings of printable characters in files

Project description

Installation

pip install pnu-strings

STRINGS(1)

NAME

strings - print the strings of printable characters in files

SYNOPSIS

strings [-a | --all] [-e encoding | --encoding=encoding] [-f | --print-file-name] [-h | --help | -? ] [-m number | -n number | --bytes=number | -number] [-o] [-s separator | --output-separator=separator] [-t radix | --radix=radix] [-v | -V | --version] [-w | --include-all-whitespace] [--debug] [--] [file ...]

DESCRIPTION

For each file specified, the strings utility prints contiguous sequences of printable characters that are at least n characters long and are followed by an unprintable character. The default value of n is 4. By default, the entire file is scanned. The strings utility is mainly used for determining the contents of non-text files.

If no file name is specified as an argument, standard input is read.

OPTIONS

The following options are available:

Options Use
-a|--all Scan the entire file for printable strings (which is the default anyway)
-e encoding|--encoding=encoding Select the character encoding to be used while searching for strings. Valid values for argument encoding are:
  • s for single 7-bit-byte characters (ASCII, ISO 8859).
  • S for single 8-bit-byte characters.
  • l for 16-bit little-endian.
  • b for 16-bit big-endian.
  • L for 32-bit little-endian.
  • B for 32-bit big-endian.
  • u for 1 to 4 bytes UTF-8 characters.

The default is to assume that characters are encoded using a single 7-bit byte
-f|--print-file-name Print the name of the file before each string
-h|--help|-? Print a usage summary and exit
-m number|-n number|--bytes=number|-number Print the contiguous character sequence of at least number characters long, instead of the default of 4 characters. Argument number should specify a positive decimal integer
-o Equivalent to specifying -t o
-s separator|--output-separator=separator By default, output strings are delimited by a new-line. This option allows you to supply any string separator to be used as the output record separator. Useful with --include-all-whitespace where strings may contain new-lines internally.
-t radix|--radix=radix Print the offset from the start of the file before each string using the specified radix. Valid values for argument radix are:
  • d for decimal
  • o for octal
  • x for hexadecimal
-v|-V|--version Display a version identifier and exit
-w|-include-all-whitespace By default tab and space characters are included in the strings that are displayed, but other whitespace characters, such a new-lines and carriage returns, are not. The -w option changes this so that all whitespace characters are considered to be part of a string.
--debug Enable debug mode
-- Options processing terminator

ENVIRONMENT

The STRINGS_DEBUG environment variable can be set to any value to enable debug mode.

The FLAVOUR or STRINGS_FLAVOUR environment variables can be set to one of the following values, to implement only the corresponding options and behaviours:

However, if the POSIXLY_CORRECT environment variable is set to any value, then the POSIX flavour will be selected.

EXIT STATUS

The strings utility exits 0 on success, and >0 if an error occurs.

EXAMPLES

To display strings in all sections of /bin/ln use:
$ strings -a /bin/ln

To display strings in all sections of /bin/cat prefixed with the filename and the offset within the file use:
$ strings -a -f -t x /bin/cat

SEE ALSO

ar(1), nm(1), objdump(1), ranlib(1), readelf(1), size(1)

STANDARDS

The strings utility is a standard UNIX/POSIX command.

This re-implementation tries to follow the PEP 8 style guide for Python code.

Beyond Plan 9 and Inferno, UTF-encoded characters are supported in all (but POSIX and Unix v10) flavours with the -e u | --encoding=u options.

HISTORY

The first strings utility was written by Bill Joy on April 22, 1978, and appeared in 2BSD.

This re-implementation was made for the PNU project.

LICENSE

It is available under the 3-clause BSD license.

AUTHORS

Hubert Tournier

This manual page is based on the one written for FreeBSD by S.Sam Arun Raj samarunraj@gmail.com.

CAVEATS

This re-implementation does not support any executable format (ELF, a.out, COFF, etc.). All executable files are entirely scanned, regardless of -a | --all | - | --data | -d | -t | -s | -T | --target options.

GNU strings @file option is also unsupported.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pnu_strings-1.0.0.tar.gz (13.4 kB view hashes)

Uploaded Source

Built Distribution

pnu_strings-1.0.0-py3-none-any.whl (13.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page