Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/helloimalemur/filesystem-hashing
Filesystem hashtable lib - for comparing / diff of filesystems
https://github.com/helloimalemur/filesystem-hashing
Last synced: 5 days ago
JSON representation
Filesystem hashtable lib - for comparing / diff of filesystems
- Host: GitHub
- URL: https://github.com/helloimalemur/filesystem-hashing
- Owner: helloimalemur
- Created: 2024-03-09T22:50:19.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-04-11T03:53:58.000Z (7 months ago)
- Last Synced: 2024-04-11T03:56:38.245Z (7 months ago)
- Language: Rust
- Size: 80.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#### filesystem-hashing
## Track Filesystem Integrity via Snapshots
~ contain a HashMap of the files and their corresponding hash signature from a specified directory.
~ are exported as JSON files.## Snapshot structure
```rustpub enum HashType {
MD5,
SHA3,
BLAKE3,
}
pub struct Snapshot {
pub file_hashes: Arc>>,
pub black_list: Vec,
pub root_path: String,
pub hash_type: HashType,
pub uuid: String,
pub date_created: i64,
}
pub struct FileMetadata {
pub path: String,
pub check_sum: Vec,
pub size: u64,
pub ino: u64,
pub ctime: i64,
pub mtime: i64,
}
```
### Snapshot Comparison result structure
```rust
pub enum SnapshotChangeType {
None,
Created,
Deleted,
Changed,
}
pub struct SnapshotCompareResult {
pub created: Vec,
pub deleted: Vec,
pub changed: Vec,
}```
## Usage
```rust
fn main() {
/// snapshot creation
let snapshot = create_snapshot("/etc", BLAKE3, vec![])?;
let snapshot2 = create_snapshot("/etc", BLAKE3, vec![])?;
/// snapshot export
export_snapshot(snapshot.clone(), "./".to_string(), true)?;
/// compare snapshots
let results: (SnapshotChangeType, SnapshotCompareResult) = compare_snapshots(snapshot(), snapshot2)?;
}
```## Utilized in the following project(s)
#### [sys-compare](https://github.com/helloimalemur/sys-compare)## Notes
~ It is advised to **exclude** tmp directories, mail spools, log directories, proc filesystems,
user's home directories, web content directories, and psuedo-device files.
~ It is advised to **include** all system binaries, libraries, include files, system source files.
~ It is also advisable to include directories you don't often look in such as /dev, or /usr/man/.## 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