Using Sigtool
Using Sigtool
(Note: this text file is in Markdown format - if you have a markdown reader this
can be rendered as a document).
sigtool can:
## Usage
To use sigtool:
```
sigtool [Options] {expressions}
```
### Options
The options control how signatures are processed, or print help.
### Expressions
Expressions are PRONOM syntax regular expressions we want to convert. For example,
two expressions are given in the command below:
```
sigtool "01 02 03 (B1 B2 | C1 C2)" "'start:'(22|27)[01:2F]"
```
You can also specify --binary signature syntax or use --container syntax (the
default). This also works for container files, where you get a little more
metadata:
```
sigtool --expression --file "container-signature-20221102.xml"
```
Gives the following output (snippet):
| Expressions: | 'SOMEFILEHEADER'
|------------------------------------|------------------
| File | Hits
| /home/user/Documents/somefile.xyz | 0
In this example we didn't get a match. Note that, by default, sigtool assumes that
signatures are anchored to the beginning of the file. So this expression would
only match if it is literally the first bytes in the file.
If you want to search the entire file for the sequence, you have to specify a
"variable" anchor, as follows:
```
sigtool --anchor Variable --match "/home/user/Documents/somefile.xyz"
"'SOMEFILEHEADER'"
```
which gives:
|Expressions: | 'SOMEFILEHEADER' |
|------------------------------------|------------------
|File | Hits
|/home/user/Documents/somefile.xyz | 1
If you want to scan more than one file, you can specify a folder instead of a file.
sigtool will then scan all the immediate child files of that folder, although it
won't process sub-folders currently. For example:
```
sigtool --match "/home/user/Documents/" "'SOMEFILEHEADER'"
```
which might give:
|Expressions: | 'SOMEFILEHEADER'
|------------------------------------|------------------
|File | Hits
|/home/user/Documents/somefile.xyz | 1
|/home/user/Documents/another.txt | 0
|/home/user/Documents/more.doc | 0
|/home/user/Documents/example.png | 1
Finally, if you want to test more than one expression at a time against a file or
folder, you can just add more expressions as arguments. For example:
```
sigtool --match "/home/user/Documents/" "'SOMEFILEHEADER'" "'Another thing'" "01 02
03 (04|05|06) 'complex'"
```
would add all the different expressions as columns against each file.
For example:
```
sigTool --match "/home/user/Documents/" --internal "META-INF/manifest.xml" "{0-
1024}'manifest:media-type=\"application/vnd.oasis.opendocument.text'"
```
Could give an output like this:
|Expressions: |
{0-1024}'manifest:media-type=\"application/vnd.oasis.opendocument.text'
|------------------------------------|------------------
|File | Hits
|/home/user/Documents/somefile.zip | 0
|/home/user/Documents/another.odt | 1
|/home/user/Documents/more.doc | 0
|/home/user/Documents/example.png | 0