本CLI工具用于计算、存储、验证磁盘文件的hash值,可检查文件是否被篡改。
Project description
简介
This tool only provides Simplified Chinese user interface.
本CLI工具用于计算、存储、验证磁盘文件的hash值,可检查文件是否被篡改。
有以下功能:
- 将磁盘文件的hash值、大小、路径保存到数据库的hash链中
- 验证数据库中的记录,检查记录的路径、hash值、大小
- 验证磁盘文件,将hash值、大小、路径与数据库中的记录对比
- 只计算磁盘文件的hash值
CLI命令
添加文件信息到数据库中:
filehash add 'E:\software\python-3.13.12-amd64.exe‘
遍历数据库中的记录,如果文件仍在磁盘,验证文件的hash值、大小:
如果磁盘文件已被删除,会提示文件不存在,但不会中止。
filehash verify_record '*.exe'
filehash verify_record '*'
检查磁盘上的文件,hash值、大小是否在数据库中:
可以Windows/Linux双系统时使用,支持glob路径语法。
如果数据库中没有该hash值、大小的数据,程序会中止。
filehash verify_file 'E:\software\**\*.exe'
在终端运行filehash,打印完整的帮助信息:
PS E:\> filehash
usage: filehash.py [-h] [-m hash_meth] [-n] [--db-dir db_dir] [--backup-dir backup_dir]
[--backup-size backup_size]
[cmd] [path]
文件hash校验。版本: 2.2.2
positional arguments:
cmd 命令
path 路径,支持glob语法,*表示所有文件,dir/**/*.exe遍历子目录。
options:
-h, --help show this help message and exit
-m, --hash-meth hash_meth
创建数据库时使用的hash算法,覆盖FILEHASH_HASH_METH环境变量。
-n, --no-space 打印hash时,不添加空格。
--db-dir db_dir 数据库目录,覆盖FILEHASH_DB_DIR环境变量。
--backup-dir backup_dir
备份保存的数据库目录,覆盖FILEHASH_BACKUP_DIR环境变量。
--backup-size backup_size
备份保存的数据库数量,覆盖FILEHASH_BACKUP_SIZE环境变量。
可用命令:
add/a 登记文件到数据库
verify_record/vr 验证数据库中的记录
print_record/pr 打印数据库中的记录
print_existing_record/per 打印数据库中尚存在的记录
verify_file/vf 验证磁盘文件
print_file/pf 计算文件hash值 (不加载数据库)
保证存在的hash算法: blake2b, blake2s, md5, sha1, sha224, sha256, sha384, sha3_224, sha3_256, sha3_384, sha3_512, sha512, shake_128, shake_256
其它可用的hash算法: md5-sha1, ripemd160, sha512_224, sha512_256, sm3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
filehash_tool-2.2.4.tar.gz
(11.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file filehash_tool-2.2.4.tar.gz.
File metadata
- Download URL: filehash_tool-2.2.4.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3aea304df036ca074dfa1b009bef6626d04624b5063d0475073719dece212150
|
|
| MD5 |
9287ef3554f3fbda116b6c6c5bbd1ec4
|
|
| BLAKE2b-256 |
1081b1b3829a25ff728161b0d609a6427b471af23b567a8aa46b24e12d139ff7
|
File details
Details for the file filehash_tool-2.2.4-py3-none-any.whl.
File metadata
- Download URL: filehash_tool-2.2.4-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16bc658532fbfa30ae4e8b8757e7e26c9c067f8b7e6909b92dc581c3033e8b09
|
|
| MD5 |
39b9999260417df690feb2eb10d4ce5b
|
|
| BLAKE2b-256 |
76e7b23012102e031da8e3d57e984dde053c5803392aca6a29170fc6e98e794a
|