Skip to content

Commit fd9da4f

Browse files
committed
Improved manpage and help page
1 parent 315bc40 commit fd9da4f

File tree

6 files changed

+321
-185
lines changed

6 files changed

+321
-185
lines changed

ChangeLog

+6-3
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,22 @@ Version 1.5
1010
- Moved some build lines from Makefile.am to src/Makefile.am.
1111
- Removed all autogenerated files.
1212
* Added a bash completion script (from Debian).
13-
* Added all new features from David Loveall to manpage.
1413
* Created CONTRIBUTING.md file.
1514
* Fixed some building warnings.
1615
* Fixed the message when using hashes (add a newline to generate a space
1716
between the summary message and hashes.
17+
* Manpage and help page:
18+
- Added all new features from David Loveall to manpage and help page.
19+
- Full reviewed and improved the manpage and help page. Added examples
20+
in manpage.
21+
- Using txt2man to produce an updated manpage.
1822
* Moved all source code to src/.
1923
* Reorganized AUTHORS and ChangeLog files.
2024
* Rewritten README file, now called README.md.
2125
* Set -fgnu89-inline in CFLAGS to avoid warning (fix: 'warning: inline
22-
function quit declared but never defined').
26+
function 'quit' declared but never defined').
2327
* Updated all headers and rights.
2428
* Updated GPL-2 text in all headers and in COPYING files.
25-
* Using txt2man to produce an updated manpage.
2629

2730
[ Bernhard Übelacker ]
2831

NEWS

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
Version 1.5
22
-----------
33

4-
New options: limit, using bytes in sizeprobe and MAC/WIN in split format.
4+
New options:
5+
- limit
6+
- using bytes in sizeprobe
7+
- MAC/WIN in split format
8+
9+
Added several examples in manpage.
10+
511
See the manpage.

man/create-man.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# This script can be used under BSD-3-Clause license.
77

8-
T2M_DATE="30 Oct 2019"
8+
T2M_DATE="01 Nov 2019"
99
T2M_NAME=dcfldd
1010
T2M_VERSION=1.5
1111
T2M_LEVEL=1

man/dcfldd.1

+166-45
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\" Text automatically generated by txt2man
2-
.TH dcfldd 1 "30 Oct 2019" "dcfldd-1.5" "enhanced version of dd for forensics and security"
2+
.TH dcfldd 1 "01 Nov 2019" "dcfldd-1.5" "enhanced version of dd for forensics and security"
33
.SH NAME
44
\fBdcfldd \fP- enhanced version of dd for forensics and security
55
\fB
@@ -39,6 +39,10 @@ natively.
3939
.IP \(bu 3
4040
When dd uses a default block size (bs, ibs, obs) of 512 bytes, \fBdcfldd\fP uses 32768 bytes (32 KiB)
4141
which is HUGELY more efficient.
42+
.IP \(bu 3
43+
The following options are present in \fBdcfldd\fP but not in dd: ALGORITHMlog:, errlog, hash, hashconv,
44+
hashformat, hashlog, hashlog:, hashwindow, limit, of:, pattern, sizeprobe, split, splitformat,
45+
statusinterval, textpattern, totalhashformat, verifylog, verifylog:, vf.
4246
.PP
4347
\fBdcfldd\fP supports the following letters to specify amount of data: k for kilo, M for Mega, G for Giga,
4448
T for Tera, P for Peta, E for Exa, Z for Zetta and Y for Yotta. E.g. 10M is equal to 10 MiB. See
@@ -47,8 +51,9 @@ the BLOCKS AND BYTES section to get other possibilities.
4751
.TP
4852
.B
4953
bs=BYTES
50-
Force ibs=BYTES and obs=BYTES. Default value is 32768 (32KiB). (see BLOCKS AND BYTES
51-
section)
54+
Force ibs=BYTES and obs=BYTES. Default value is 32768 (32KiB). See BLOCKS AND BYTES
55+
section. Warning: the block size will be created in RAM. Make sure you have sufficient
56+
amount of free memory.
5257
.TP
5358
.B
5459
cbs=BYTES
@@ -97,30 +102,32 @@ Skip BLOCKS ibs-sized blocks at start of input. (see BLOCKS AND BYTES section)
97102
.TP
98103
.B
99104
pattern=HEX
100-
Use the specified binary pattern as input.
105+
Use the specified binary pattern as input. You can use a byte only.
101106
.TP
102107
.B
103108
textpattern=TEXT
104-
Use repeating TEXT as input.
109+
Use repeating TEXT as input. You can use a character only.
105110
.TP
106111
.B
107112
errlog=FILE
108113
Send error messages to FILE as well as stderr.
109114
.TP
110115
.B
111-
hashwindow=BYTES
112-
Perform a hash on every BYTES amount of data.
113-
.TP
114-
.B
115116
hash=NAME
116-
Either md5, sha1, sha256, sha384 or sha512. Default algorithm is md5. To select multiple
117-
algorithms to run simultaneously enter the names in a comma separated list.
117+
Do hash calculation in parallel with the disk reading. Either md5, sha1, sha256, sha384
118+
or sha512 can be used. Default algorithm is md5. To select multiple algorithms to run
119+
simultaneously enter the names in a comma separated list.
118120
.TP
119121
.B
120122
hashlog=FILE
121-
Send MD5 hash output to FILE instead of stderr. If you are using multiple hash algorithms
122-
you can send each to a separate file using the convention ALGORITHMlog=FILE, for example
123-
md5log=FILE1, sha1log=FILE2, etc.
123+
Send hash output to FILE instead of stderr. If you are using multiple hash
124+
algorithms you can send each to a separate file using the convention ALGORITHMlog=FILE,
125+
for example md5log=FILE1, sha1log=FILE2, etc.
126+
.TP
127+
.B
128+
hashwindow=BYTES
129+
Perform a hash on every BYTES amount of data. The partial results will be shown in
130+
screen. The default hash is md5 but you can use hash= option to choose other.
124131
.TP
125132
.B
126133
hashlog:=COMMAND
@@ -154,35 +161,38 @@ Update the status message every N blocks. Default value is 256.
154161
.TP
155162
.B
156163
sizeprobe=[if|of|BYTES]
157-
Determine the size of the input or output file or an amount of BYTES for use with
158-
status messages. This option gives you a percentage indicator around the sizeprobe
159-
value. WARNING: do not use this option against a tape device. (see BLOCKS AND
160-
BYTES section)
164+
Determine the size of the input or output file or an amount of BYTES for use
165+
with status messages. This option gives you a percentage indicator around the
166+
sizeprobe value. WARNING: do not use this option against a tape device. (see
167+
BLOCKS AND BYTES section)
161168
.TP
162169
.B
163170
split=BYTES
164171
Write every BYTES amount of data to a new file. This operation applies to any
165-
of=FILE that follows. (see BLOCKS AND BYTES section)
172+
of=FILE that follows (split= must be put before of=). (see BLOCKS AND BYTES
173+
section)
166174
.TP
167175
.B
168176
splitformat=[TEXT|MAC|WIN]
169-
The file extension format for split operation. You may use "a" for letters and "n"
170-
for numbers. If you use annn, an extension started as a000 will be appended; the
171-
last possible extension for this format will be z999. splitformat=an will provide
172-
a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, b0, b1, b2\.\.\. If nothing is specified the
173-
default format is "nnn". NOTE: the split and splitformat options take effect only
174-
for output files (option of=) specified AFTER these options appear in the command
175-
line (e.g. split=50M splitformat=annn of=/tmp/test.iso). Likewise, you may specify
176-
these several times for different output files within the same command line. You
177-
may use as many digits in any combination you would like. E.g. "anaannnaana"
178-
would be valid, but quite insane (see BLOCKS AND BYTES section). Other possible
179-
approach is MAC. If "MAC" is used, a suffix dmg and several dmgpart will be
180-
appended. In other words, it will generate a partial disk image file, used by
181-
the Mac OS X operating system. dmgpart files are usually provided with a
182-
corresponding dmg file, which is the master file for the split archive. If dmg
183-
is opened in Mac OS X, all dmgpart will be read too. The last option is WIN,
184-
which will automatically output file naming of foo.001, foo.002, \.\.\., foo.999,
185-
foo.1000, \.\.\..
177+
The file extension format for split operation. You may use "a" for letters
178+
and "n" for numbers. If you use annn, an extension started as a000 will be
179+
appended; the last possible extension for this format will be z999.
180+
splitformat=an will provide a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, b0, b1,
181+
b2, b3\.\.\. If nothing is specified the default format is "nnn". NOTE: the split
182+
and splitformat options take effect only for output files (option of=) specified
183+
AFTER these options appear in the command line (e.g. split=50M splitformat=annn
184+
of=/tmp/test.iso).
185+
Likewise, you may specify it several times for different output files within
186+
the same command line. You may use as many digits in any combination you would
187+
like. E.g. "anaannnaana" would be valid, but a quite insane (see BLOCKS AND BYTES
188+
section).
189+
Other possible approach is MAC. If "MAC" is used, a suffix dmg and several
190+
dmgpart will be appended. In other words, it will generate a partial disk image
191+
file, used by the Mac OS X operating system. dmgpart files are usually provided
192+
with a corresponding dmg file, which is the master file for the split archive.
193+
If dmg is opened in Mac OS X, all dmgpart will be read too. The last option is
194+
WIN, which will automatically output file naming of foo.001, foo.002, \.\.\.,
195+
foo.999, foo.1000, \.\.\..
186196
.TP
187197
.B
188198
vf=FILE
@@ -251,14 +261,14 @@ Continue after read errors.
251261
.TP
252262
.B
253263
sync
254-
Pad every input block with NULs to ibs-size. When used with block or unblock, pad with spaces rather
255-
than NULs.
264+
Pad every input block with NULs to ibs-size. When used with block or unblock, pad with spaces
265+
rather than NULs.
256266
.SH FORMAT
257267
The structure of FORMAT may contain any valid text and special variables. The built-in variables are the
258-
following format: #variable_name#. To pass FORMAT strings to the program from a command line, it may be necessary to
268+
following format: #variable_name#. To pass FORMAT strings to the program from a command line, it may be
259269
.TP
260270
.B
261-
surround your FORMAT strings with "quotes."
271+
necessary to surround your FORMAT strings with "quotes."
262272
The built-in variables are listed below:
263273
.TP
264274
.B
@@ -297,23 +307,134 @@ The FORMAT structure accepts the following escape codes:
297307
.TP
298308
.B
299309
\\n
300-
Newline.
310+
Newline
301311
.TP
302312
.B
303313
\\t
304-
Tab.
314+
Tab
305315
.TP
306316
.B
307317
\\r
308-
Carriage return.
318+
Carriage return
309319
.TP
310320
.B
311321
\\
312-
Insert the '\\' character.
322+
Insert the '\\' character
313323
.TP
314324
.B
315325
##
316-
Insert the '#' character as text, not a variable.
326+
Insert the '#' character as text, not a variable
327+
.SH EXAMPLES
328+
329+
Each following line will create a 100 MiB file containing zeros:
330+
.PP
331+
.nf
332+
.fam C
333+
$ dcfldd if=/dev/zero of=test bs=1M count=100
334+
$ dcfldd if=/dev/zero of=test bs=100M count=1
335+
$ dcfldd if=/dev/zero of=test bs=50M count=2
336+
$ dcfldd if=/dev/zero of=test limit=100M
337+
338+
.fam T
339+
.fi
340+
To create a copy (forensics image) from a disk called /dev/sdb inside a file, using input/output blocks
341+
of 4096 bytes (4 KiB) instead of 32 KiB (default):
342+
.PP
343+
.nf
344+
.fam C
345+
$ dcfldd if=/dev/sdb bs=4096 of=sdb.img
346+
347+
.fam T
348+
.fi
349+
As the last example, plus calculating MD5 and SHA256 hashes, putting the results inside sdb.md5 and
350+
sdb.sha256. It is very useful for forensics works because the hashes will be processed in real time,
351+
avoiding a waste of time to make something as 'dd + md5 + sha256'. Considering that I/O disk is very
352+
slow and RAM is very fast, the hashes will be calculated, bit per bit in memory, when the next portion
353+
of the disk is read. When all disk was read, all hashes are now ready.
354+
.PP
355+
.nf
356+
.fam C
357+
$ dcfldd if=/dev/sdb bs=4096 hash=md5,sha256 md5log=sdb.md5 sha256log=sdb.sha256 of=sdb.img
358+
359+
.fam T
360+
.fi
361+
To validate the image file against the original source:
362+
.PP
363+
.nf
364+
.fam C
365+
$ dcfldd if=/dev/sdb vf=sdb.img
366+
367+
.fam T
368+
.fi
369+
Splitting the image in 500 MiB slices, using the default bs value (32 KiB). Note that split= must be
370+
put before of= to work:
371+
.PP
372+
.nf
373+
.fam C
374+
$ dcfldd if=/dev/sdb split=500M of=sdb.img
375+
376+
.fam T
377+
.fi
378+
At the last example, using from a0000 up to z9999 as suffix for each split file:
379+
.PP
380+
.nf
381+
.fam C
382+
$ dcfldd if=/dev/sdb split=500M splitformat=annnn of=sdb.img
383+
384+
.fam T
385+
.fi
386+
Now, \fBdcfldd\fP will work byte per byte (bs=1) and will hop 1056087439 bytes. After this, \fBdcfldd\fP will collect
387+
200000 bytes and write the results to a file called airplane.jpg.
388+
.PP
389+
.nf
390+
.fam C
391+
$ dcfldd if=/dev/sda3 bs=1 skip=1056087439 count=200000 of=airplane.jpg
392+
393+
.fam T
394+
.fi
395+
In the last example, the same result could be obtained using "limit" instead of "count". The main
396+
difference is that count uses 200000*bs and limit uses 200000 bytes (regardless of the value declared in
397+
bs option):
398+
.PP
399+
.nf
400+
.fam C
401+
$ dcfldd if=/dev/sda3 bs=1 skip=1056087439 limit=200000 of=airplane.jpg
402+
403+
.fam T
404+
.fi
405+
To write something inside a file, you can use seek. Suppose you want to write a message from a file called
406+
message.txt inside a file called target.iso, hopping 200000 bytes from start of file:
407+
.PP
408+
.nf
409+
.fam C
410+
$ dcfldd if=message.txt bs=1 seek=200000 of=target.iso
411+
412+
.fam T
413+
.fi
414+
\fBdcfldd\fP also can send a result to be processed by an external command:
415+
.PP
416+
.nf
417+
.fam C
418+
$ dcfldd if=text.txt of:="cat | sort -u"
419+
420+
.fam T
421+
.fi
422+
To convert a file from ASCII to EBCDIC:
423+
.PP
424+
.nf
425+
.fam C
426+
$ dcfldd if=text.asc conv=ebcdic of=text.ebcdic
427+
428+
.fam T
429+
.fi
430+
To convert a file from EBCDIC to ASCII:
431+
.PP
432+
.nf
433+
.fam C
434+
$ dcfldd if=text.ebcdic conv=ascii of=text.asc
435+
436+
.fam T
437+
.fi
317438
.SH SEE ALSO
318439
\fBdd\fP(1)
319440
.SH REPORTING BUGS

0 commit comments

Comments
 (0)