Annotation of src/usr.bin/strings/strings.1, Revision 1.16
1.16 ! jmc 1: .\" $OpenBSD: strings.1,v 1.15 2010/07/22 07:38:56 jmc Exp $
1.1 deraadt 2: .\" $NetBSD: strings.1,v 1.4 1994/12/10 11:54:28 jtc Exp $
3: .\"
4: .\" Copyright (c) 1980, 1990, 1993
5: .\" The Regents of the University of California. All rights reserved.
6: .\"
7: .\" Redistribution and use in source and binary forms, with or without
8: .\" modification, are permitted provided that the following conditions
9: .\" are met:
10: .\" 1. Redistributions of source code must retain the above copyright
11: .\" notice, this list of conditions and the following disclaimer.
12: .\" 2. Redistributions in binary form must reproduce the above copyright
13: .\" notice, this list of conditions and the following disclaimer in the
14: .\" documentation and/or other materials provided with the distribution.
1.8 millert 15: .\" 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 16: .\" may be used to endorse or promote products derived from this software
17: .\" without specific prior written permission.
18: .\"
19: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29: .\" SUCH DAMAGE.
30: .\"
31: .\" @(#)strings.1 8.1 (Berkeley) 6/6/93
32: .\"
1.16 ! jmc 33: .Dd $Mdocdate: July 22 2010 $
1.1 deraadt 34: .Dt STRINGS 1
35: .Os
36: .Sh NAME
37: .Nm strings
38: .Nd find printable strings in a file
39: .Sh SYNOPSIS
40: .Nm strings
41: .Op Fl afo
1.12 sobrado 42: .Op Fl m Ar number
1.1 deraadt 43: .Op Fl n Ar number
44: .Op Fl t Ar radix
1.14 sobrado 45: .Op Ar
1.1 deraadt 46: .Sh DESCRIPTION
1.4 aaron 47: .Nm
1.1 deraadt 48: displays the sequences of printable characters in each of the specified
49: files, or in the standard input, by default.
50: By default, a sequence must be at least four characters in length
51: before being displayed.
52: .Pp
53: The options are as follows:
54: .Bl -tag -width Ds
55: .It Fl a
56: By default,
1.4 aaron 57: .Nm
1.1 deraadt 58: only searches the text and data segments of object files.
59: The
60: .Fl a
61: option causes
1.4 aaron 62: .Nm
1.1 deraadt 63: to search the entire object file.
64: .It Fl f
65: Each string is preceded by the name of the file
66: in which it was found.
1.12 sobrado 67: .It Fl m Ar number
68: Specifies the maximum number of characters in a sequence to be
69: .Ar number ,
70: instead of unlimited.
1.3 aaron 71: .It Fl n Ar number
1.1 deraadt 72: Specifies the minimum number of characters in a sequence to be
73: .Ar number ,
74: instead of four.
75: .It Fl o
76: Each string is preceded by its octal offset in the file.
1.3 aaron 77: .It Fl t Ar radix
1.6 aaron 78: Each string is preceded by its offset in the file.
79: The first character of
1.1 deraadt 80: .Ar radix
1.4 aaron 81: determines the radix of the offset:
1.1 deraadt 82: .Sq o
1.4 aaron 83: for octal;
1.1 deraadt 84: .Sq d
1.4 aaron 85: for decimal; or
1.1 deraadt 86: .Sq x
87: for hexadecimal.
88: .El
89: .Pp
1.4 aaron 90: .Nm
1.1 deraadt 91: is useful for identifying random binaries, among other things.
1.16 ! jmc 92: .Sh EXIT STATUS
1.15 jmc 93: .Ex -std strings
1.1 deraadt 94: .Sh SEE ALSO
95: .Xr hexdump 1 ,
96: .Xr od 1
1.9 jmc 97: .Sh STANDARDS
1.10 jmc 98: The
99: .Nm
100: utility is compliant with the
1.13 jmc 101: .St -p1003.1-2008
1.10 jmc 102: specification.
103: .Pp
104: The flags
105: .Op Fl fmo
106: are extensions to that specification.
107: .Pp
1.1 deraadt 108: Historic implementations of
109: .Nm
110: only search the initialized data portion of the object file.
111: This was reasonable as strings were normally stored there.
1.4 aaron 112: Given new compiler technology which installs strings in the
1.1 deraadt 113: text portion of the object file, the default behavior was
114: changed.
115: .Sh HISTORY
116: The
117: .Nm
118: utility appeared in
119: .Bx 3.0 .
1.7 aaron 120: .Sh BUGS
121: The algorithm for identifying strings is extremely primitive.
122: In particular, machine code instructions on certain architectures
123: can resemble sequences of ASCII bytes, which
124: will fool the algorithm.