hwid 0.1.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.
@@ -0,0 +1,3 @@
1
+ # Changelog
2
+
3
+ Please check [this page in the documentation](https://hasansezertasan.github.io/hwid/changelog/).
hwid-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Hasan Sezer Taşan
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.
hwid-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,92 @@
1
+ Metadata-Version: 2.1
2
+ Name: hwid
3
+ Version: 0.1.0
4
+ Summary: Extract the `hwid` on Windows, Linux, Mac. Cross-platform using Python, native OS detection.
5
+ License: MIT
6
+ Keywords: hwid,hardware,id,unique,identifier,machine,fingerprint,fingerprinting,licensing,license,licensing,identification,machine
7
+ Author: hasansezertasan
8
+ Author-email: hasansezertasan@gmail.com
9
+ Maintainer: hasansezertasan
10
+ Maintainer-email: hasansezertasan@gmail.com
11
+ Requires-Python: >=3.0,<4.0
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.4
20
+ Classifier: Programming Language :: Python :: 3.5
21
+ Classifier: Programming Language :: Python :: 3.6
22
+ Classifier: Programming Language :: Python :: 3.7
23
+ Classifier: Programming Language :: Python :: 3.8
24
+ Classifier: Programming Language :: Python :: 3.9
25
+ Classifier: Programming Language :: Python :: 3.10
26
+ Classifier: Programming Language :: Python :: 3.11
27
+ Classifier: Programming Language :: Python :: 3 :: Only
28
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
29
+ Project-URL: documentation, https://hasansezertasan.github.io/hwid/
30
+ Project-URL: homepage, https://github.com/hasansezertasan/hwid
31
+ Project-URL: repository, https://github.com/hasansezertasan/hwid
32
+ Description-Content-Type: text/markdown
33
+
34
+ <h1 align="center">
35
+ <strong>HWID</strong>
36
+ </h1>
37
+ <p align="center">
38
+ <em>Extract the `hwid` on Windows, Linux, Mac. Cross-platform using Python, native OS detection.</em>
39
+ </p>
40
+ <p align="center">
41
+ <a href="https://github.com/hasansezertasan/hwid" target="_blank">
42
+ <img src="https://img.shields.io/github/last-commit/hasansezertasan/hwid" alt="Latest Commit">
43
+ </a>
44
+ <img src="https://img.shields.io/github/workflow/status/hasansezertasan/hwid/Test">
45
+ <img src="https://img.shields.io/codecov/c/github/hasansezertasan/hwid">
46
+ <br />
47
+ <a href="https://pypi.org/project/hwid" target="_blank">
48
+ <img src="https://img.shields.io/pypi/v/hwid" alt="Package version">
49
+ </a>
50
+ <a href="https://pypi.org/project/hwid" target="_blank">
51
+ <img src="https://img.shields.io/pypi/pyversions/hwid">
52
+ </a>
53
+ <img src="https://img.shields.io/github/license/hasansezertasan/hwid">
54
+ </p>
55
+
56
+ ## Installation
57
+
58
+ ``` bash
59
+ pip install hwid
60
+ ```
61
+
62
+ ## Usage
63
+
64
+ Module:
65
+
66
+ ```python
67
+ import hwid
68
+ print(hwid.get_hwid())
69
+ # 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
70
+ ```
71
+
72
+ CLI:
73
+
74
+ ```bash
75
+ hwid
76
+ XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
77
+ ```
78
+
79
+ ## Why?
80
+
81
+ I have created a bunch of desktop applications for Windows to sell. I needed a way to license my applications. I decided to use the hwid of the computer to license my applications. I needed a way to get the hwid of the computer, so I created this module. It has only one purpose: getting the hwid of the computer. It is cross-platform and does not require any external dependencies.
82
+
83
+ I do not recommend using this module for licensing purposes by itself. You can use it as a part of your licensing system.
84
+
85
+ If you are using server-client architecture, you can send the encrypted hwid to the server and check if it is valid. It's easy to intercept the request to the server. You can check [mitmproxy](https://mitmproxy.org/) for that.
86
+
87
+ If you are using a local licensing system, you can encrypt the hwid and store it in a file. Then you can check if the encrypted hwid is valid. You can use [pyarmor](https://github.com/dashingsoft/pyarmor) to obfuscate your code. It will make it harder to reverse engineer your code.
88
+
89
+ ## Disclaimer
90
+
91
+ This module is not intended to be used for malicious purposes. The author is not responsible for any damage caused by this module. Use at your own risk.
92
+
hwid-0.1.0/README.md ADDED
@@ -0,0 +1,58 @@
1
+ <h1 align="center">
2
+ <strong>HWID</strong>
3
+ </h1>
4
+ <p align="center">
5
+ <em>Extract the `hwid` on Windows, Linux, Mac. Cross-platform using Python, native OS detection.</em>
6
+ </p>
7
+ <p align="center">
8
+ <a href="https://github.com/hasansezertasan/hwid" target="_blank">
9
+ <img src="https://img.shields.io/github/last-commit/hasansezertasan/hwid" alt="Latest Commit">
10
+ </a>
11
+ <img src="https://img.shields.io/github/workflow/status/hasansezertasan/hwid/Test">
12
+ <img src="https://img.shields.io/codecov/c/github/hasansezertasan/hwid">
13
+ <br />
14
+ <a href="https://pypi.org/project/hwid" target="_blank">
15
+ <img src="https://img.shields.io/pypi/v/hwid" alt="Package version">
16
+ </a>
17
+ <a href="https://pypi.org/project/hwid" target="_blank">
18
+ <img src="https://img.shields.io/pypi/pyversions/hwid">
19
+ </a>
20
+ <img src="https://img.shields.io/github/license/hasansezertasan/hwid">
21
+ </p>
22
+
23
+ ## Installation
24
+
25
+ ``` bash
26
+ pip install hwid
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ Module:
32
+
33
+ ```python
34
+ import hwid
35
+ print(hwid.get_hwid())
36
+ # 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
37
+ ```
38
+
39
+ CLI:
40
+
41
+ ```bash
42
+ hwid
43
+ XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
44
+ ```
45
+
46
+ ## Why?
47
+
48
+ I have created a bunch of desktop applications for Windows to sell. I needed a way to license my applications. I decided to use the hwid of the computer to license my applications. I needed a way to get the hwid of the computer, so I created this module. It has only one purpose: getting the hwid of the computer. It is cross-platform and does not require any external dependencies.
49
+
50
+ I do not recommend using this module for licensing purposes by itself. You can use it as a part of your licensing system.
51
+
52
+ If you are using server-client architecture, you can send the encrypted hwid to the server and check if it is valid. It's easy to intercept the request to the server. You can check [mitmproxy](https://mitmproxy.org/) for that.
53
+
54
+ If you are using a local licensing system, you can encrypt the hwid and store it in a file. Then you can check if the encrypted hwid is valid. You can use [pyarmor](https://github.com/dashingsoft/pyarmor) to obfuscate your code. It will make it harder to reverse engineer your code.
55
+
56
+ ## Disclaimer
57
+
58
+ This module is not intended to be used for malicious purposes. The author is not responsible for any damage caused by this module. Use at your own risk.
@@ -0,0 +1 @@
1
+ from hwid.core import get_hwid
@@ -0,0 +1,4 @@
1
+ from .main import app
2
+
3
+ if __name__ == "__main__":
4
+ app()
@@ -0,0 +1,33 @@
1
+ import subprocess
2
+ from sys import platform
3
+ import re
4
+ from .exceptions import UnsupportedOS, InvalidHWID
5
+
6
+ def validate_hwid(hwid):
7
+ if re.match(r"^[a-fA-F0-9]{8}-([a-fA-F0-9]{4}-){3}[a-fA-F0-9]{12}$", hwid):
8
+ return True
9
+ else:
10
+ return False
11
+
12
+ def get_hwid():
13
+ """Gets the HWID."""
14
+ if platform in ["linux", "linux2"]:
15
+ command = "sudo dmidecode -s system-uuid"
16
+ output = subprocess.check_output(command, shell=True)
17
+ output = output.decode("utf-8").strip()
18
+ elif platform in ["win32"]:
19
+ command = "wmic csproduct get uuid"
20
+ output = subprocess.check_output(command, shell=True)
21
+ output = output.decode("utf-8").strip()
22
+ output = output.split("\n")[1].strip()
23
+ elif platform in ["darwin"]:
24
+ command = "system_profiler SPHardwareDataType | grep 'UUID'"
25
+ output = subprocess.check_output(command, shell=True)
26
+ output = output.decode("utf-8").strip()
27
+ output = output.split(":")[1].strip()
28
+ else:
29
+ raise UnsupportedOS("Unsupported OS")
30
+ if validate_hwid(output):
31
+ return output
32
+ else:
33
+ raise InvalidHWID("Invalid HWID")
@@ -0,0 +1,4 @@
1
+ class UnsupportedOS(Exception):
2
+ pass
3
+ class InvalidHWID(Exception):
4
+ pass
@@ -0,0 +1,9 @@
1
+ from .core import get_hwid
2
+
3
+
4
+ def app():
5
+ """
6
+ Get the HWID of the current machine.
7
+ """
8
+ hwid = get_hwid()
9
+ print(f"HWID: {hwid}")
@@ -0,0 +1,114 @@
1
+ [build-system]
2
+ requires = ["poetry-core"]
3
+ build-backend = "poetry.core.masonry.api"
4
+
5
+ [tool.poetry]
6
+ name = "hwid"
7
+ version = "0.1.0"
8
+ description = "Extract the `hwid` on Windows, Linux, Mac. Cross-platform using Python, native OS detection."
9
+ authors = ["hasansezertasan <hasansezertasan@gmail.com>"]
10
+ maintainers = ["hasansezertasan <hasansezertasan@gmail.com>"]
11
+ keywords = ["hwid", "hardware", "id", "unique", "identifier", "machine", "fingerprint", "fingerprinting", "licensing", "license", "licensing", "identification", "machine"]
12
+ classifiers = [
13
+ "Development Status :: 5 - Production/Stable",
14
+ "License :: OSI Approved :: MIT License",
15
+ 'Environment :: Console',
16
+ "Topic :: Software Development :: Libraries :: Python Modules",
17
+ "Intended Audience :: Developers",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python",
21
+ "Programming Language :: Python :: 3 :: Only",
22
+ "Programming Language :: Python :: 3.6",
23
+ "Programming Language :: Python :: 3.7",
24
+ "Programming Language :: Python :: 3.8",
25
+ "Programming Language :: Python :: 3.9",
26
+ "Programming Language :: Python :: 3.10",
27
+ "Programming Language :: Python :: 3.11",
28
+ ]
29
+ packages = [{ include = "hwid" }]
30
+ include = ["CHANGELOG.md"]
31
+ readme = "README.md"
32
+ license = "MIT"
33
+
34
+ [tool.poetry.urls]
35
+ repository = "https://github.com/hasansezertasan/hwid"
36
+ homepage = "https://github.com/hasansezertasan/hwid"
37
+ documentation = "https://hasansezertasan.github.io/hwid/"
38
+
39
+
40
+
41
+ [tool.ruff]
42
+ # Run `ruff linter` command to see all available linters and their descriptions
43
+ target-version = "py311"
44
+ line-length = 120
45
+ select = [
46
+ # "B",
47
+ # "C",
48
+ "E",
49
+ "F",
50
+ "W",
51
+ "I",
52
+ "B9",
53
+ ]
54
+ ignore = [
55
+ "B008", # do not perform function calls in argument defaults
56
+ "C901", # too complex
57
+ "E501", # line too long, handled by black
58
+ "F401", # imported but unused
59
+ "E402", # module level import not at top of file
60
+ "E712", # comparison to True should be 'if cond is True:' or 'if cond:'
61
+ ]
62
+ exclude = [
63
+ "alembic",
64
+ "migrations",
65
+ ]
66
+ show-fixes = true
67
+
68
+ [tool.isort]
69
+ profile = "black"
70
+ multi_line_output = 3
71
+ include_trailing_comma = true
72
+ force_grid_wrap = 0
73
+ use_parentheses = true
74
+ ensure_newline_before_comments = true
75
+ line_length = 120
76
+ split_on_trailing_comma = true
77
+ skip_glob = ["**/alembic/**", "**/migrations/**"]
78
+
79
+
80
+ [tool.black]
81
+ line-length = 120
82
+ target-version = ['py311']
83
+ exclude = '''
84
+ (
85
+ /(
86
+ \.eggs
87
+ | \.git
88
+ | \.hg
89
+ | \.mypy_cache
90
+ | \.nox
91
+ | \.tox
92
+ | \.venv
93
+ | _build
94
+ | buck-out
95
+ | build
96
+ | dist
97
+ | alembic
98
+ )/
99
+ )
100
+ '''
101
+
102
+
103
+ [tool.poe.tasks]
104
+ black = "black ."
105
+ isort = "isort ."
106
+ ruff = "ruff ."
107
+ bir = ["black", "isort", "ruff"]
108
+
109
+ [tool.poetry.scripts]
110
+ hwid = "hwid.__main__:app"
111
+
112
+
113
+ [tool.poetry.dependencies]
114
+ python = ">=3.0,<4.0"