2024-03-18 19:32:37 +00:00
# sys-compare
2024-10-19 18:19:34 +00:00
Store Filesystem Integrity information via 'Snapshots' which contain a HashMap of the files and their corresponding hash signature from a specified directory.
2024-03-29 14:46:28 +00:00
2024-03-29 14:53:29 +00:00
## Installation
```shell
2024-10-19 18:20:15 +00:00
cargo install sys-compare
2024-03-29 14:53:29 +00:00
```
2024-03-29 14:46:28 +00:00
### Modes
```shell
Usage: sys-compare < COMMAND >
Commands:
2024-03-29 21:01:55 +00:00
create Create a snapshot
compare Compare two snapshots
2024-03-29 14:46:28 +00:00
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
```
2024-03-18 23:01:37 +00:00
### Create Snapshot
```shell
2024-03-29 14:46:28 +00:00
Usage: sys-compare create --root-dir < ROOT_DIR > --output-path < OUTPUT_PATH >
Options:
2024-03-29 21:01:55 +00:00
-r, --root-dir < ROOT_DIR > Directory to create snapshot from
-o, --output-path < OUTPUT_PATH > Snapshot output/save location
2024-03-29 14:46:28 +00:00
-h, --help Print help
2024-03-18 23:01:37 +00:00
```
2024-03-25 18:52:39 +00:00
### Compare Snapshots
2024-03-18 23:01:37 +00:00
```shell
2024-03-29 14:46:28 +00:00
Usage: sys-compare compare [OPTIONS] --left < LEFT > --right < RIGHT >
Options:
2024-03-29 21:01:55 +00:00
-l, --left < LEFT > left side of diff
-r, --right < RIGHT > right side of diff
-s, --selection < SELECTION > OPTIONAL: specify which change type specifically to return
-c < COUNT_ONLY > OPTIONAL: when using selection specify to return count only or not [possible values: true, false]
2024-03-29 14:46:28 +00:00
-h, --help Print help
2024-03-18 23:01:37 +00:00
```
2024-03-26 16:52:11 +00:00
2024-04-15 03:07:10 +00:00
## Example output
```shell
$ sys-compare create -r /etc -o ~/test.snapshot
Creating snapshot..
Total FileHash Entries 1891
$ sudo touch /etc/2
$ sys-compare create -r /etc -o ~/test2.snapshot
Creating snapshot..
Total FileHash Entries 1892
$ sys-compare compare -l ~/test.snapshot -r ~/test2.snapshot
Created: 1
Deleted: 0
Changed: 0
$ sys-compare compare -l ~/test.snapshot -r ~/test2.snapshot -s created
/etc/2
Created: 1
2024-04-21 17:37:56 +00:00
$ sys-compare compare -l ~/test.snapshot -r ~/test2.snapshot -s created -c
2024-04-15 03:07:10 +00:00
1
```
2024-03-26 16:52:11 +00:00
## Development and Collaboration
#### Feel free to open a pull request, please run the following prior to your submission please!
echo "Run clippy"; cargo clippy -- -D clippy::all
echo "Format source code"; cargo fmt -- --check