hashprint-cli 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hashprint_cli-1.0.0/.gitignore +11 -0
- hashprint_cli-1.0.0/.python-version +1 -0
- hashprint_cli-1.0.0/LICENSE +21 -0
- hashprint_cli-1.0.0/PKG-INFO +135 -0
- hashprint_cli-1.0.0/README.md +122 -0
- hashprint_cli-1.0.0/pyproject.toml +24 -0
- hashprint_cli-1.0.0/src/HashPrint/__init__.py +7 -0
- hashprint_cli-1.0.0/src/HashPrint/cli.py +100 -0
- hashprint_cli-1.0.0/src/HashPrint/database.py +660 -0
- hashprint_cli-1.0.0/src/HashPrint/formatter.py +119 -0
- hashprint_cli-1.0.0/src/HashPrint/identifier.py +27 -0
- hashprint_cli-1.0.0/src/HashPrint/main.py +134 -0
- hashprint_cli-1.0.0/src/HashPrint/printer.py +26 -0
- hashprint_cli-1.0.0/src/HashPrint/reader.py +29 -0
- hashprint_cli-1.0.0/src/HashPrint/validator.py +33 -0
- hashprint_cli-1.0.0/src/HashPrint/walker.py +34 -0
- hashprint_cli-1.0.0/uv.lock +112 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.14
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Taha Qaisar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: hashprint-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A forensic CLI tool for hash identification
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.14
|
|
8
|
+
Requires-Dist: pyfiglet>=1.0.4
|
|
9
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
10
|
+
Requires-Dist: rich-argparse>=1.8.0
|
|
11
|
+
Requires-Dist: rich>=15.0.0
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# HashPrint
|
|
15
|
+
|
|
16
|
+
## What's this?
|
|
17
|
+
|
|
18
|
+
***Note: this is a student project***
|
|
19
|
+
|
|
20
|
+
Surely a random string like ***'b318c90ba09d05dfc9ff3991974eee68'*** can look scary.
|
|
21
|
+
Be afraid no more, HashPrint got your back.
|
|
22
|
+
|
|
23
|
+
## About HashPrint
|
|
24
|
+
|
|
25
|
+
HashPrint is a forensic CLI tool that can identify which algorithm (like MD5, bcrypt, SHA256) produced the scary looking string, called a hash, like the above one.
|
|
26
|
+
|
|
27
|
+
## Features of HashPrint
|
|
28
|
+
|
|
29
|
+
1. **Hash Support:** HashPrint can identify 90+ hashes.
|
|
30
|
+
2. **Export Options:** HashPrint allows you to export results in various formats, like JSON and YAML.
|
|
31
|
+
3. **Multiple Hashes:** HashPrint can read multiple hashes from a text file. It can recursively scan a directory to locate text files that contain hashes. It can also accept multiple hashes from the command-line.
|
|
32
|
+
4. **Coloured Output:** HashPrint outputs coloured results, making them easier to read.
|
|
33
|
+
5. **Easy to use:** if you ever feel stuck, remember help is just a flag away.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
***Requires Python 3.14+***
|
|
38
|
+
|
|
39
|
+
If installing with pip, then you must have Python 3.14 or higher installed on your system
|
|
40
|
+
|
|
41
|
+
```console
|
|
42
|
+
$ pip install hashprint
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**OR with uv**
|
|
46
|
+
|
|
47
|
+
uv installs the correct Python version if necessary
|
|
48
|
+
|
|
49
|
+
**First setup a virtual environment:**
|
|
50
|
+
|
|
51
|
+
```console
|
|
52
|
+
$ uv venv
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Then install:**
|
|
56
|
+
|
|
57
|
+
```console
|
|
58
|
+
$ uv pip install hashprint
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Use without installing**
|
|
62
|
+
|
|
63
|
+
***Requires uv***
|
|
64
|
+
|
|
65
|
+
```console
|
|
66
|
+
$ uv tool run hashprint
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**OR**
|
|
70
|
+
|
|
71
|
+
```console
|
|
72
|
+
$ uvx hashprint
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## How to use HashPrint?
|
|
76
|
+
|
|
77
|
+
| Option | Purpose |
|
|
78
|
+
|:------:|:-------------|
|
|
79
|
+
*-h*, *--help* | shows the help message and exits. |
|
|
80
|
+
*-f*, *--hash-file* | this option takes a path to a text file as an argument. With this option, HashPrint will read the file at the specified path for hashes. The file must contain one hash per line. |
|
|
81
|
+
*-c*, *--hash* | this option takes a hash as an argument and identifies it. It should be between single quotes and without the 0x prefix. |
|
|
82
|
+
*-x*, *--format* | this option lets you choose between the export formats. You can export the results in JSON, YAML and text formats. This option cannot work without the *-p*, *--path* option. |
|
|
83
|
+
*-p*, *--path* | this option specifies the path of the export file. If a path to a pre-existing file is specified, it will be overwritten if it already contains content. If the file at the specified path does not exist, HashPrint will create it. |
|
|
84
|
+
*-w*, *--walk* | this option recursively scans a directory at the specified path for text files, containing one hash per line. |
|
|
85
|
+
*-v*, *--version* | this option displays the version number of HashPrint. |
|
|
86
|
+
|
|
87
|
+
## Usage examples
|
|
88
|
+
|
|
89
|
+
**For help**
|
|
90
|
+
|
|
91
|
+
```console
|
|
92
|
+
$ hashprint --help
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Display the version number**
|
|
96
|
+
|
|
97
|
+
```console
|
|
98
|
+
$ hashprint --version
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Identify a single hash**
|
|
102
|
+
|
|
103
|
+
```console
|
|
104
|
+
$ hashprint -c 'a9993e364706816aba3e25717850c26c9cd0d89d'
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
OR
|
|
108
|
+
|
|
109
|
+
```console
|
|
110
|
+
$ hashprint --hash 'a9993e364706816aba3e25717850c26c9cd0d89d'
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Identify multiple hashes**
|
|
114
|
+
|
|
115
|
+
```console
|
|
116
|
+
$ hashprint -c '0cc175b9c0f1b6a831c399e269772661' -c 'e8b7be43'
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Identify hashes from a file + export results to a file**
|
|
120
|
+
|
|
121
|
+
```console
|
|
122
|
+
$ hashprint -f path/to/txt/file/containing/hashes -x text -p path/of/export/file
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The above command exports results in a human readable text format at a file of your choice. HashPrint will create the file if it does not exist.
|
|
126
|
+
|
|
127
|
+
**Recursive Directory Scanner + exporting results to a file**
|
|
128
|
+
|
|
129
|
+
```console
|
|
130
|
+
$ hashprint -w path/to/directory -x format -p path/of/export/file
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## LICENSE
|
|
134
|
+
|
|
135
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# HashPrint
|
|
2
|
+
|
|
3
|
+
## What's this?
|
|
4
|
+
|
|
5
|
+
***Note: this is a student project***
|
|
6
|
+
|
|
7
|
+
Surely a random string like ***'b318c90ba09d05dfc9ff3991974eee68'*** can look scary.
|
|
8
|
+
Be afraid no more, HashPrint got your back.
|
|
9
|
+
|
|
10
|
+
## About HashPrint
|
|
11
|
+
|
|
12
|
+
HashPrint is a forensic CLI tool that can identify which algorithm (like MD5, bcrypt, SHA256) produced the scary looking string, called a hash, like the above one.
|
|
13
|
+
|
|
14
|
+
## Features of HashPrint
|
|
15
|
+
|
|
16
|
+
1. **Hash Support:** HashPrint can identify 90+ hashes.
|
|
17
|
+
2. **Export Options:** HashPrint allows you to export results in various formats, like JSON and YAML.
|
|
18
|
+
3. **Multiple Hashes:** HashPrint can read multiple hashes from a text file. It can recursively scan a directory to locate text files that contain hashes. It can also accept multiple hashes from the command-line.
|
|
19
|
+
4. **Coloured Output:** HashPrint outputs coloured results, making them easier to read.
|
|
20
|
+
5. **Easy to use:** if you ever feel stuck, remember help is just a flag away.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
***Requires Python 3.14+***
|
|
25
|
+
|
|
26
|
+
If installing with pip, then you must have Python 3.14 or higher installed on your system
|
|
27
|
+
|
|
28
|
+
```console
|
|
29
|
+
$ pip install hashprint
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**OR with uv**
|
|
33
|
+
|
|
34
|
+
uv installs the correct Python version if necessary
|
|
35
|
+
|
|
36
|
+
**First setup a virtual environment:**
|
|
37
|
+
|
|
38
|
+
```console
|
|
39
|
+
$ uv venv
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Then install:**
|
|
43
|
+
|
|
44
|
+
```console
|
|
45
|
+
$ uv pip install hashprint
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Use without installing**
|
|
49
|
+
|
|
50
|
+
***Requires uv***
|
|
51
|
+
|
|
52
|
+
```console
|
|
53
|
+
$ uv tool run hashprint
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**OR**
|
|
57
|
+
|
|
58
|
+
```console
|
|
59
|
+
$ uvx hashprint
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## How to use HashPrint?
|
|
63
|
+
|
|
64
|
+
| Option | Purpose |
|
|
65
|
+
|:------:|:-------------|
|
|
66
|
+
*-h*, *--help* | shows the help message and exits. |
|
|
67
|
+
*-f*, *--hash-file* | this option takes a path to a text file as an argument. With this option, HashPrint will read the file at the specified path for hashes. The file must contain one hash per line. |
|
|
68
|
+
*-c*, *--hash* | this option takes a hash as an argument and identifies it. It should be between single quotes and without the 0x prefix. |
|
|
69
|
+
*-x*, *--format* | this option lets you choose between the export formats. You can export the results in JSON, YAML and text formats. This option cannot work without the *-p*, *--path* option. |
|
|
70
|
+
*-p*, *--path* | this option specifies the path of the export file. If a path to a pre-existing file is specified, it will be overwritten if it already contains content. If the file at the specified path does not exist, HashPrint will create it. |
|
|
71
|
+
*-w*, *--walk* | this option recursively scans a directory at the specified path for text files, containing one hash per line. |
|
|
72
|
+
*-v*, *--version* | this option displays the version number of HashPrint. |
|
|
73
|
+
|
|
74
|
+
## Usage examples
|
|
75
|
+
|
|
76
|
+
**For help**
|
|
77
|
+
|
|
78
|
+
```console
|
|
79
|
+
$ hashprint --help
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Display the version number**
|
|
83
|
+
|
|
84
|
+
```console
|
|
85
|
+
$ hashprint --version
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Identify a single hash**
|
|
89
|
+
|
|
90
|
+
```console
|
|
91
|
+
$ hashprint -c 'a9993e364706816aba3e25717850c26c9cd0d89d'
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
OR
|
|
95
|
+
|
|
96
|
+
```console
|
|
97
|
+
$ hashprint --hash 'a9993e364706816aba3e25717850c26c9cd0d89d'
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Identify multiple hashes**
|
|
101
|
+
|
|
102
|
+
```console
|
|
103
|
+
$ hashprint -c '0cc175b9c0f1b6a831c399e269772661' -c 'e8b7be43'
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Identify hashes from a file + export results to a file**
|
|
107
|
+
|
|
108
|
+
```console
|
|
109
|
+
$ hashprint -f path/to/txt/file/containing/hashes -x text -p path/of/export/file
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The above command exports results in a human readable text format at a file of your choice. HashPrint will create the file if it does not exist.
|
|
113
|
+
|
|
114
|
+
**Recursive Directory Scanner + exporting results to a file**
|
|
115
|
+
|
|
116
|
+
```console
|
|
117
|
+
$ hashprint -w path/to/directory -x format -p path/of/export/file
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## LICENSE
|
|
121
|
+
|
|
122
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "hashprint-cli"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "A forensic CLI tool for hash identification"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.14"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"pyfiglet>=1.0.4",
|
|
9
|
+
"pyyaml>=6.0.3",
|
|
10
|
+
"rich>=15.0.0",
|
|
11
|
+
"rich-argparse>=1.8.0",
|
|
12
|
+
]
|
|
13
|
+
license = "MIT"
|
|
14
|
+
license-files = ["LICENSE"]
|
|
15
|
+
|
|
16
|
+
[project.scripts]
|
|
17
|
+
hashprint = "HashPrint.main:main"
|
|
18
|
+
|
|
19
|
+
[build-system]
|
|
20
|
+
requires = ["hatchling"]
|
|
21
|
+
build-backend = "hatchling.build"
|
|
22
|
+
|
|
23
|
+
[tool.hatch.build.targets.wheel]
|
|
24
|
+
packages = ["src/HashPrint"]
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# In the Name of God, the Most Compassionate, Most Merciful
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
import pyfiglet
|
|
6
|
+
from rich_argparse import RichHelpFormatter
|
|
7
|
+
from rich.console import Console
|
|
8
|
+
from rich.theme import Theme
|
|
9
|
+
import sys
|
|
10
|
+
from HashPrint import __project_name__
|
|
11
|
+
|
|
12
|
+
DISCLAIMER_MESSAGE = "Hash identification is based on pattern matching - therefore some hashes cannot be identified with certainty"
|
|
13
|
+
POSSIBILITY_MESSAGE = "The string may not be a real hash"
|
|
14
|
+
SUCCESS_MESSAGE = f"{__project_name__} ran successfully"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Parser(argparse.ArgumentParser):
|
|
18
|
+
def error(self, message):
|
|
19
|
+
console.print(f"[error]\nError: {message}[/error]")
|
|
20
|
+
console.print(f"[hint]{hint_line}[/hint]")
|
|
21
|
+
sys.exit()
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def print_banner():
|
|
25
|
+
banner = pyfiglet.figlet_format(__project_name__, font="slant")
|
|
26
|
+
console.print(f"[banner]{banner}[/banner]")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
theme = Theme(
|
|
30
|
+
{
|
|
31
|
+
"success": "#00A86B", # Jade color
|
|
32
|
+
"information": "#00D084", # Bright Jade color
|
|
33
|
+
"error": "bold #FF4A4A", # Coral red color
|
|
34
|
+
"fail": "#EC5B38", # Warm orange-red color
|
|
35
|
+
"hint": "#FF5FCF", # Bright hot pink color
|
|
36
|
+
"banner": "#499A13", # Vida Loca color
|
|
37
|
+
"description": "#24B1B1", # Medium dark teal color
|
|
38
|
+
"usage": "#2F2FE4", # Electric blue color
|
|
39
|
+
"disclaimer": "#B8860B", # Dark goldenrod color
|
|
40
|
+
"warning": "#FFFF00", # Yellow color
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
RichHelpFormatter.styles["argparse.args"] = "#03AED2" # Sky blue color
|
|
45
|
+
RichHelpFormatter.styles["argparse.groups"] = "#FF6D1F" # Bright orange color
|
|
46
|
+
RichHelpFormatter.styles["argparse.text"] = "#24B1B1" # Medium dark teal color
|
|
47
|
+
|
|
48
|
+
console = Console(highlight=False, theme=theme)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
description = "\nA forensic CLI tool for hash identification"
|
|
52
|
+
hint_line = "\nRun with -h for usage information"
|
|
53
|
+
program_name_cli = "hashprint"
|
|
54
|
+
format_choices = ["text", "json", "yaml"]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def cli_parser():
|
|
58
|
+
if len(sys.argv) == 1:
|
|
59
|
+
print_banner()
|
|
60
|
+
console.print(f"[description]{description}[/description]")
|
|
61
|
+
console.print(f"[hint]{hint_line}[/hint]")
|
|
62
|
+
sys.exit()
|
|
63
|
+
|
|
64
|
+
parser = Parser(
|
|
65
|
+
prog=program_name_cli,
|
|
66
|
+
description=description,
|
|
67
|
+
formatter_class=RichHelpFormatter,
|
|
68
|
+
color=False,
|
|
69
|
+
)
|
|
70
|
+
parser.add_argument(
|
|
71
|
+
"-f",
|
|
72
|
+
"--hash-file",
|
|
73
|
+
action="append",
|
|
74
|
+
help="path to a text (.txt) file containing one hash per line",
|
|
75
|
+
)
|
|
76
|
+
parser.add_argument(
|
|
77
|
+
"-c",
|
|
78
|
+
"--hash",
|
|
79
|
+
dest="candidate_hash",
|
|
80
|
+
action="append",
|
|
81
|
+
help="hash to identify between single quotes and without the 0x prefix",
|
|
82
|
+
)
|
|
83
|
+
parser.add_argument("-x", "--format", choices=format_choices, help="output format")
|
|
84
|
+
parser.add_argument(
|
|
85
|
+
"-p",
|
|
86
|
+
"--path",
|
|
87
|
+
metavar="PATH",
|
|
88
|
+
help="path of the output file - overwrites the file if it is not empty",
|
|
89
|
+
)
|
|
90
|
+
parser.add_argument(
|
|
91
|
+
"-w",
|
|
92
|
+
"--walk",
|
|
93
|
+
metavar="PATH",
|
|
94
|
+
help="recursively scans a directory for text (.txt) files - containing one hash per line",
|
|
95
|
+
)
|
|
96
|
+
parser.add_argument(
|
|
97
|
+
"-v", "--version", action="store_true", help="displays the version number"
|
|
98
|
+
)
|
|
99
|
+
args = parser.parse_args()
|
|
100
|
+
return args
|