Copyright (c) 2009-2010 Todd C. Miller Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =pod =head1 NAME sudoreplay - replay sudo session logs =head1 SYNOPSIS B [B<-d> I] [B<-f> I] [B<-m> I] [B<-s> I] ID B [B<-d> I] -l [search expression] =head1 DESCRIPTION B plays back or lists the session logs created by B. When replaying, B can play the session back in real-time, or the playback speed may be adjusted (faster or slower) based on the command line options. The I should be a six character sequence of digits and upper case letters, e.g. 0100A5, which is logged by B when a command is run with session logging enabled. In list mode, B can be used to find the ID of a session based on a number of criteria such as the user, tty or command run. In replay mode, if the standard output has not been redirected, B will act on the following keys: =over 8 =item ' ' (space) Pause output; press any key to resume. =item '<' Reduce the playback speed by one half. =item '>' Double the playback speed. =back =head1 OPTIONS B accepts the following command line options: =over 12 =item -d I Use I to for the session logs instead of the default, F. =item -f I By default, B will play back the command's standard output, standard error and tty output. The I<-f> option can be used to select which of these to output. The I argument is a comma-separated list, consisting of one or more of following: I, I, and I. =item -l Enable "list mode". In this mode, B will list available session IDs. If a I is specified, it will be used to restrict the IDs that are displayed. An expression is composed of the following predicates: =over 8 =item command I Evaluates to true if the command run matches I. On systems with POSIX regular expression support, the pattern may be an extended regular expression. On systems without POSIX regular expression support, a simple substring match is performed instead. =item cwd I Evaluates to true if the command was run with the specified current working directory. =item fromdate I Evaluates to true if the command was run on or after I. See L<"Date and time format"> for a description of supported date and time formats. =item group I Evaluates to true if the command was run with the specified I. Note that unless a I was explicitly specified when B was run this field will be empty in the log. =item runas I Evaluates to true if the command was run as the specified I. Note that B runs commands as user I by default. =item todate I Evaluates to true if the command was run on or prior to I. See L<"Date and time format"> for a description of supported date and time formats. =item tty I Evaluates to true if the command was run on the specified terminal device. The I should be specified without the F prefix, e.g. F instead of F. =item user I Evaluates to true if the ID matches a command run by I. =back Predicates may be abbreviated to the shortest unique string (currently all predicates may be shortened to a single character). Predicates may be combined using I, I and I operators as well as C<'('> and C<')'> for grouping (note that parentheses must generally be escaped from the shell). The I operator is optional, adjacent predicates have an implied I unless separated by an I. =item -m I Specify an upper bound on how long to wait between key presses or output data. By default, B will accurately reproduce the delays between key presses or program output. However, this can be tedious when the session includes long pauses. When the I<-m> option is specified, B will limit these pauses to at most I seconds. The value may be specified as a floating point number, .e.g. I<2.5>. =item -s I This option causes B to adjust the number of seconds it will wait between key presses or program output. This can be used to slow down or speed up the display. For example, a I of I<2> would make the output twice as fast whereas a I of <.5> would make the output twice as slow. =item -V The B<-V> (version) option causes B to print its version number and exit. =back =head2 Date and time format The time and date may be specified multiple ways, common formats include: =over 8 =item HH:MM:SS am MM/DD/CCYY timezone 24 hour time may be used in place of am/pm. =item HH:MM:SS am Month, Day Year timezone 24 hour time may be used in place of am/pm, and month and day names may be abbreviated. Note that month and day of the week names must be specified in English. =item CCYY-MM-DD HH:MM:SS ISO time format =item DD Month CCYY HH:MM:SS The month name may be abbreviated. =back Either time or date may be omitted, the am/pm and timezone are optional. If no date is specified, the current day is assumed; if no time is specified, the first second of the specified date is used. The less significant parts of both time and date may also be omitted, in which case zero is assumed. For example, the following are all valid: The following are all valid time and date specifications: =over 8 =item now The current time and date. =item tomorrow Exactly one day from now. =item yesterday 24 hours ago. =item 2 hours ago 2 hours ago. =item next Friday The first second of the next Friday. =item this week The current time but the first day of the coming week. =item a fortnight ago The current time but 14 days ago. =item 10:01 am 9/17/2009 10:01 am, September 17, 2009. =item 10:01 am 10:01 am on the current day. =item 10 10:00 am on the current day. =item 9/17/2009 00:00 am, September 17, 2009. =item 10:01 am Sep 17, 2009 10:01 am, September 17, 2009. =back =head1 FILES =over 24 =item F The default I/O log directory. =item F Example session log info. =item F Example session standard input log. =item F Example session standard output log. =item F Example session standard error log. =item F Example session tty input file. =item F Example session tty output file. =item F Example session timing file. =back Note that the I, I and I files will be empty unless B was used as part of a pipeline for a particular command. =head1 EXAMPLES List sessions run by user I: sudoreplay -l user millert List sessions run by user I with a command containing the string vi: sudoreplay -l user bob command vi List sessions run by user I that match a regular expression: sudoreplay -l user jeff command '/bin/[a-z]*sh' List sessions run by jeff or bob on the console: sudoreplay -l ( user jeff or user bob ) tty console =head1 SEE ALSO L, L =head1 AUTHOR Todd C. Miller =head1 BUGS If you feel you have found a bug in B, please submit a bug report at http://www.sudo.ws/sudo/bugs/ =head1 SUPPORT Limited free support is available via the sudo-users mailing list, see http://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search the archives. =head1 DISCLAIMER B is provided ``AS IS'' and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. See the LICENSE file distributed with B or http://www.sudo.ws/sudo/license.html for complete details.