Skip to content

Commit 34795d8

Browse files
committed
Added version 1.2.4
1 parent 096dd85 commit 34795d8

34 files changed

+518
-124
lines changed

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ xstrtol.h version-etc.c version-etc.h \
66
system.h sys2.h pathmax.h xalloc.h argmatch.c argmatch.h xstrtoul.c \
77
full-write.c xstrtoumax.c copy.c copy.h dcfldd.h hash.h hash.c verify.c verify.h \
88
translate.c translate.h sizeprobe.c sizeprobe.h pattern.c pattern.h util.c util.h \
9-
log.c log.h full-write.h output.c output.h split.c split.h
9+
log.c log.h full-write.h output.c output.h split.c split.h hashformat.c hashformat.h
1010

1111
man_MANS = dcfldd.1
1212

Makefile.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ am_dcfldd_OBJECTS = dcfldd.$(OBJEXT) md5.$(OBJEXT) sha1.$(OBJEXT) \
6363
xstrtoumax.$(OBJEXT) copy.$(OBJEXT) hash.$(OBJEXT) \
6464
verify.$(OBJEXT) translate.$(OBJEXT) sizeprobe.$(OBJEXT) \
6565
pattern.$(OBJEXT) util.$(OBJEXT) log.$(OBJEXT) \
66-
output.$(OBJEXT) split.$(OBJEXT)
66+
output.$(OBJEXT) split.$(OBJEXT) hashformat.$(OBJEXT)
6767
dcfldd_OBJECTS = $(am_dcfldd_OBJECTS)
6868
dcfldd_LDADD = $(LDADD)
6969
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
@@ -179,7 +179,7 @@ xstrtol.h version-etc.c version-etc.h \
179179
system.h sys2.h pathmax.h xalloc.h argmatch.c argmatch.h xstrtoul.c \
180180
full-write.c xstrtoumax.c copy.c copy.h dcfldd.h hash.h hash.c verify.c verify.h \
181181
translate.c translate.h sizeprobe.c sizeprobe.h pattern.c pattern.h util.c util.h \
182-
log.c log.h full-write.h output.c output.h split.c split.h
182+
log.c log.h full-write.h output.c output.h split.c split.h hashformat.c hashformat.h
183183

184184
man_MANS = dcfldd.1
185185
EXTRA_DIST = $(man_MANS)
@@ -276,6 +276,7 @@ distclean-compile:
276276
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dcfldd.Po@am__quote@
277277
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/full-write.Po@am__quote@
278278
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@
279+
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hashformat.Po@am__quote@
279280
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/human.Po@am__quote@
280281
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@
281282
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/long-options.Po@am__quote@

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,7 @@ fi
16631663
16641664
# Define the identity of the package.
16651665
PACKAGE=dcfldd
1666-
VERSION=1.2.3-2
1666+
VERSION=1.2.4
16671667
16681668
16691669
cat >>confdefs.h <<_ACEOF

configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ AC_INIT(dcfldd.c)
33
AM_CONFIG_HEADER(config.h)
44
AC_CANONICAL_HOST
55

6-
AM_INIT_AUTOMAKE([dcfldd], [1.2.3-2])
6+
AM_INIT_AUTOMAKE([dcfldd], [1.2.4])
77

88
AC_PROG_CC
99
AC_PROG_CPP

copy.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id$
1+
/* $Id: copy.c,v 1.3 2005/05/13 18:52:06 harbourn Exp $
22
* dcfldd - The Enhanced Forensic DD
33
* By Nicholas Harbour
44
*/
@@ -369,7 +369,6 @@ int dd_copy(void)
369369
if (do_hash) {
370370
hash_remainder(ihashlist, WINDOW_CTX);
371371
display_totalhash(ihashlist, TOTAL_CTX);
372-
display_hashalgorithm(ihashlist);
373372
}
374373

375374
return exit_status;

copy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id$
1+
/* $Id: copy.h,v 1.3 2005/05/13 18:52:06 harbourn Exp $
22
* dcfldd - The Enhanced Forensic DD
33
* By Nicholas Harbour
44
*/

dcfldd.1

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35.
2-
.TH DCFLDD "1" "May 2005" "dcfldd (dcfldd) 1.2.3" "User Commands"
2+
.TH DCFLDD "1" "May 2005" "dcfldd (dcfldd) 1.2.4" "User Commands"
33
.SH NAME
4-
dcfldd \- manual page for dcfldd (dcfldd) 1.2.3
4+
dcfldd \- manual page for dcfldd (dcfldd) 1.2.4
55
.SH SYNOPSIS
66
.B dcfldd
77
[\fIOPTION\fR]...
@@ -66,11 +66,21 @@ can send each to a seperate file using the
6666
convention ALGORITHMlog=FILE, for example
6767
md5log=FILE1, sha1log=FILE2, etc.
6868
.TP
69-
status=[on|off]
70-
display a continual status message on stderr
69+
hashformat=FORMAT
70+
display each hashwindow according to FORMAT
71+
.IP
72+
the hash format mini\-language is described below
73+
.IP
74+
totalhashformat=FORMAT display the total hash value according to FORMAT
75+
status=[on|off] display a continual status message on stderr
7176
.IP
7277
default state is "on"
7378
.TP
79+
statusinterval=N
80+
update the status message every N blocks
81+
.IP
82+
default value is 256
83+
.TP
7484
sizeprobe=[if|of]
7585
determine the size of the input or output file
7686
.IP
@@ -99,7 +109,6 @@ for different output files within the same
99109
command line. you may use as many digits in
100110
any combination you would like.
101111
(e.g. "anaannnaana" would be valid, but
102-
.IP
103112
quite insane)
104113
.TP
105114
vf=FILE
@@ -114,6 +123,50 @@ display this help and exit
114123
\fB\-\-version\fR
115124
output version information and exit
116125
.PP
126+
The structure of of FORMAT may contain any valid text and special variables.
127+
The built\-in variables are used the following format: #variable_name#
128+
To pass FORMAT strings to the program from a command line, it may be
129+
necessary to surround your FORMAT strings with "quotes."
130+
The built\-in variables are listed below:
131+
.TP
132+
window_start
133+
The beginning byte offset of the hashwindow
134+
.TP
135+
window_end
136+
The ending byte offset of the hashwindow
137+
.TP
138+
block_start
139+
The beginning block (by input blocksize) of the window
140+
.TP
141+
block_end
142+
The ending block (by input blocksize) of the hash window
143+
.TP
144+
hash
145+
The hash value
146+
.TP
147+
algorithm
148+
The name of the hash algorithm
149+
.SS "For example, the default FORMAT for hashformat and totalhashformat are:"
150+
.IP
151+
hashformat="#window_start# \- #window_end#: #hash#"
152+
totalhashformat="Total (#algorithm#): #hash#"
153+
.SS "The FORMAT structure accepts the following escape codes:"
154+
.TP
155+
\en
156+
Newline
157+
.TP
158+
\et
159+
Tab
160+
.TP
161+
\er
162+
Carriage return
163+
.TP
164+
\e\e
165+
Insert the '\e' character
166+
.TP
167+
##
168+
Insert the '#' character as text, not a variable
169+
.PP
117170
BLOCKS and BYTES may be followed by the following multiplicative suffixes:
118171
xM M, c 1, w 2, b 512, kD 1000, k 1024, MD 1,000,000, M 1,048,576,
119172
GD 1,000,000,000, G 1,073,741,824, and so on for T, P, E, Z, Y.

dcfldd.c

Lines changed: 107 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id$
1+
/* $Id: dcfldd.c,v 1.3 2005/05/13 18:52:06 harbourn Exp $
22
* dcfldd - The Enhanced Forensic DD
33
* By Nicholas Harbour
44
*/
@@ -59,6 +59,8 @@
5959
#include "pattern.h"
6060
#include "output.h"
6161
#include "split.h"
62+
#include "hashformat.h"
63+
#include "util.h"
6264

6365
/* The name this program was run with. */
6466
char *program_name;
@@ -124,11 +126,20 @@ int do_split = 0;
124126
#define DEFAULT_SPLIT_FORMAT "nnn"
125127
#endif /* DEFAULT_SPLIT_FORMAT */
126128

129+
#ifndef DEFAULT_HASHWINDOW_FORMAT
130+
#define DEFAULT_HASHWINDOW_FORMAT "#window_start# - #window_end#: #hash#"
131+
#endif /* DEFAULT_HASHWINDOW_FORMAT */
132+
133+
#ifndef DEFAULT_TOTALHASH_FORMAT
134+
#define DEFAULT_TOTALHASH_FORMAT "Total (#algorithm#): #hash#"
135+
#endif /* DEFAULT_TOTALHASH_FORMAT */
136+
127137
static char *splitformat = DEFAULT_SPLIT_FORMAT;
128138
static off_t splitsize;
129139

130140
/* How many blocks in between screen writes for status output. */
131-
const ssize_t update_thresh = 256;
141+
ssize_t update_thresh = 256;
142+
132143
time_t start_time;
133144

134145
static struct conversion conversions[] =
@@ -157,57 +168,86 @@ void usage(int status)
157168
printf("\
158169
Copy a file, converting and formatting according to the options.\n\
159170
\n\
160-
bs=BYTES force ibs=BYTES and obs=BYTES\n\
161-
cbs=BYTES convert BYTES bytes at a time\n\
162-
conv=KEYWORDS convert the file as per the comma separated keyword list\n\
163-
count=BLOCKS copy only BLOCKS input blocks\n\
164-
ibs=BYTES read BYTES bytes at a time\n\
165-
if=FILE read from FILE instead of stdin\n\
166-
obs=BYTES write BYTES bytes at a time\n\
167-
of=FILE write to FILE instead of stdout\n\
168-
NOTE: of=FILE may be used several times to write\n\
169-
output to multiple files simultaneously\n\
170-
seek=BLOCKS skip BLOCKS obs-sized blocks at start of output\n\
171-
skip=BLOCKS skip BLOCKS ibs-sized blocks at start of input\n\
172-
pattern=HEX use the specified binary pattern as input\n\
173-
textpattern=TEXT use repeating TEXT as input\n\
174-
hashwindow=BYTES perform a hash on every BYTES amount of data\n\
175-
hash=NAME either md5, sha1, sha256, sha384 or sha512\n\
176-
default algorithm is md5. To select multiple\n\
177-
algorithms to run simultaneously enter the names\n\
178-
in a comma separated list\n\
179-
hashlog=FILE send MD5 hash output to FILE instead of stderr\n\
180-
if you are using multiple hash algorithms you\n\
181-
can send each to a seperate file using the\n\
182-
convention ALGORITHMlog=FILE, for example\n\
183-
md5log=FILE1, sha1log=FILE2, etc.\n\
184-
status=[on|off] display a continual status message on stderr\n\
185-
default state is \"on\"\n\
186-
sizeprobe=[if|of] determine the size of the input or output file\n\
187-
for use with status messages. (this option\n\
188-
gives you a percentage indicator)\n\
189-
WARNING: do not use this option against a\n\
190-
tape device.\n\
191-
split=BYTES write every BYTES amount of data to a new file\n\
192-
This operation applies to any of=FILE that follows\n\
193-
splitformat=TEXT the file extension format for split operation.\n\
194-
you may use any number of 'a' or 'n' in any combo\n\
195-
the default format is \"nnn\"\n\
196-
NOTE: The split and splitformat options take effect\n\
197-
only for output files specified AFTER these\n\
198-
options appear in the command line. Likewise,\n\
199-
you may specify these several times for\n\
200-
for different output files within the same\n\
201-
command line. you may use as many digits in\n\
202-
any combination you would like.\n\
203-
(e.g. \"anaannnaana\" would be valid, but\n\
204-
quite insane)\n\
205-
vf=FILE verify that FILE matches the specified input\n\
206-
verifylog=FILE send verify results to FILE instead of stderr\n\
171+
bs=BYTES force ibs=BYTES and obs=BYTES\n\
172+
cbs=BYTES convert BYTES bytes at a time\n\
173+
conv=KEYWORDS convert the file as per the comma separated keyword list\n\
174+
count=BLOCKS copy only BLOCKS input blocks\n\
175+
ibs=BYTES read BYTES bytes at a time\n\
176+
if=FILE read from FILE instead of stdin\n\
177+
obs=BYTES write BYTES bytes at a time\n\
178+
of=FILE write to FILE instead of stdout\n\
179+
NOTE: of=FILE may be used several times to write\n\
180+
output to multiple files simultaneously\n\
181+
seek=BLOCKS skip BLOCKS obs-sized blocks at start of output\n\
182+
skip=BLOCKS skip BLOCKS ibs-sized blocks at start of input\n\
183+
pattern=HEX use the specified binary pattern as input\n\
184+
textpattern=TEXT use repeating TEXT as input\n\
185+
hashwindow=BYTES perform a hash on every BYTES amount of data\n\
186+
hash=NAME either md5, sha1, sha256, sha384 or sha512\n\
187+
default algorithm is md5. To select multiple\n\
188+
algorithms to run simultaneously enter the names\n\
189+
in a comma separated list\n\
190+
hashlog=FILE send MD5 hash output to FILE instead of stderr\n\
191+
if you are using multiple hash algorithms you\n\
192+
can send each to a seperate file using the\n\
193+
convention ALGORITHMlog=FILE, for example\n\
194+
md5log=FILE1, sha1log=FILE2, etc.\n\
195+
hashformat=FORMAT display each hashwindow according to FORMAT\n\
196+
the hash format mini-language is described below\n\
197+
totalhashformat=FORMAT display the total hash value according to FORMAT\n\
198+
status=[on|off] display a continual status message on stderr\n\
199+
default state is \"on\"\n\
200+
statusinterval=N update the status message every N blocks\n\
201+
default value is 256\n\
202+
sizeprobe=[if|of] determine the size of the input or output file\n\
203+
for use with status messages. (this option\n\
204+
gives you a percentage indicator)\n\
205+
WARNING: do not use this option against a\n\
206+
tape device.\n\
207+
split=BYTES write every BYTES amount of data to a new file\n\
208+
This operation applies to any of=FILE that follows\n\
209+
splitformat=TEXT the file extension format for split operation.\n\
210+
you may use any number of 'a' or 'n' in any combo\n\
211+
the default format is \"nnn\"\n\
212+
NOTE: The split and splitformat options take effect\n\
213+
only for output files specified AFTER these\n\
214+
options appear in the command line. Likewise,\n\
215+
you may specify these several times for\n\
216+
for different output files within the same\n\
217+
command line. you may use as many digits in\n\
218+
any combination you would like.\n\
219+
(e.g. \"anaannnaana\" would be valid, but\n\
220+
quite insane)\n\
221+
vf=FILE verify that FILE matches the specified input\n\
222+
verifylog=FILE send verify results to FILE instead of stderr\n\
207223
\n\
208224
--help display this help and exit\n\
209225
--version output version information and exit\n\
210226
\n\
227+
The structure of of FORMAT may contain any valid text and special variables.\n\
228+
The built-in variables are used the following format: #variable_name#\n\
229+
To pass FORMAT strings to the program from a command line, it may be\n\
230+
necessary to surround your FORMAT strings with \"quotes.\"\n\
231+
The built-in variables are listed below:\n\
232+
\n\
233+
window_start The beginning byte offset of the hashwindow\n\
234+
window_end The ending byte offset of the hashwindow\n\
235+
block_start The beginning block (by input blocksize) of the window\n\
236+
block_end The ending block (by input blocksize) of the hash window\n\
237+
hash The hash value\n\
238+
algorithm The name of the hash algorithm\n\
239+
\n\
240+
For example, the default FORMAT for hashformat and totalhashformat are:\n\
241+
hashformat=\"#window_start# - #window_end#: #hash#\"\n\
242+
totalhashformat=\"Total (#algorithm#): #hash#\"\n\
243+
\n\
244+
The FORMAT structure accepts the following escape codes:\n\
245+
\\n Newline\n\
246+
\\t Tab\n\
247+
\\r Carriage return\n\
248+
\\\\ Insert the '\\' character\n\
249+
## Insert the '#' character as text, not a variable\n\
250+
\n\
211251
BLOCKS and BYTES may be followed by the following multiplicative suffixes:\n\
212252
xM M, c 1, w 2, b 512, kD 1000, k 1024, MD 1,000,000, M 1,048,576,\n\
213253
GD 1,000,000,000, G 1,073,741,824, and so on for T, P, E, Z, Y.\n\
@@ -529,7 +569,11 @@ static void scanargs(int argc, char **argv)
529569
if (hash_log == NULL)
530570
syscall_error(val);
531571
do_hash++;
532-
} else if (STREQ(name, "md5log")) {
572+
} else if (STREQ(name, "hashformat"))
573+
hashformat = parse_hashformat(val);
574+
else if (STREQ(name, "totalhashformat"))
575+
totalhashformat = parse_hashformat(val);
576+
else if (STREQ(name, "md5log")) {
533577
hashops[MD5].log = fopen(val, "w");
534578
if (hashops[MD5].log == NULL)
535579
syscall_error(val);
@@ -609,6 +653,8 @@ static void scanargs(int argc, char **argv)
609653
} else if (STREQ(name, "hashwindow")) {
610654
hash_windowlen = n;
611655
do_hash++;
656+
} else if (STREQ(name, "statusinterval")) {
657+
update_thresh = n;
612658
} else {
613659
fprintf(stderr, "%s: unrecognized option %s=%s",
614660
program_name, name, val);
@@ -655,6 +701,13 @@ int main(int argc, char **argv)
655701
{
656702
int i;
657703
int exit_status;
704+
char *def_hashwin_fmt;
705+
char *def_totalhash_fmt;
706+
707+
def_hashwin_fmt = strndup(DEFAULT_HASHWINDOW_FORMAT,
708+
strlen(DEFAULT_HASHWINDOW_FORMAT));
709+
def_totalhash_fmt = strndup(DEFAULT_TOTALHASH_FORMAT,
710+
strlen(DEFAULT_TOTALHASH_FORMAT));
658711

659712
/* disable buffering on stderr */
660713
setbuf(stderr, NULL);
@@ -663,6 +716,9 @@ int main(int argc, char **argv)
663716
verify_log = stderr;
664717

665718
program_name = argv[0];
719+
720+
hashformat = parse_hashformat(def_hashwin_fmt);
721+
totalhashformat = parse_hashformat(def_totalhash_fmt);
666722

667723
/* Arrange to close stdout if parse_long_options exits. */
668724
//atexit (close_stdout_wrapper);
@@ -708,7 +764,7 @@ int main(int argc, char **argv)
708764
else if (probe == PROBE_OUTPUT)
709765
sizeprobe(STDOUT_FILENO);
710766
start_time = time(NULL);
711-
767+
712768
if (do_verify)
713769
exit_status = dd_verify();
714770
else

0 commit comments

Comments
 (0)