fiddlesticks 0.1.0__tar.gz → 0.2.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
+ * text eol=lf
2
+ *.kdbx binary
3
+ *.kdbx -text -diff
@@ -18,6 +18,7 @@ jobs:
18
18
  "test_aegis_checker_from_CLI",
19
19
  "test_aegis_checker_errors_from_CLI",
20
20
  "test_aegis_checker_against_avdu_vault",
21
+ "test_pykeepass_checker_against_Test_vault",
21
22
  ]
22
23
  steps:
23
24
  - name: Check out repo
@@ -30,7 +31,7 @@ jobs:
30
31
 
31
32
  - name: Install dependencies
32
33
  run: |
33
- pip install -e .[tests,py7zr,aegis]
34
+ pip install -e .[tests,py7zr,aegis,keepassxc]
34
35
 
35
36
  - name: Run PyTest
36
37
  run: |
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: fiddlesticks
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Password recovery tool for encrypted archives (currently only .7z files supported).
5
5
  Project-URL: GitHub, https://github.com/Hazardous-Area/fiddlesticks
6
6
  Author-email: James Parrott <james@jamesparrott.dev>
@@ -9,6 +9,8 @@ License-File: LICENSE
9
9
  Requires-Python: >=3.12
10
10
  Provides-Extra: aegis
11
11
  Requires-Dist: py-avdu; extra == 'aegis'
12
+ Provides-Extra: keepassxc
13
+ Requires-Dist: pykeepass; extra == 'keepassxc'
12
14
  Provides-Extra: py7zr
13
15
  Requires-Dist: py7zr; extra == 'py7zr'
14
16
  Provides-Extra: tests
@@ -20,6 +22,8 @@ Description-Content-Type: text/markdown
20
22
  *"Aaaagh! I forgot my 7zip password"* - James (more times than he cares to remember).
21
23
  ![Tests passing](https://github.com/Hazardous-Area/fiddlesticks/actions/workflows/tests.yml/badge.svg)
22
24
 
25
+ Version 0.2.0
26
+
23
27
  ## Description
24
28
  Password recovery tool, for password-encrypted files, using simple off-line brute
25
29
  force attacks. Password candidates are generated, using common variations
@@ -62,23 +66,27 @@ archive can also do so - the password wasn't strong enough.
62
66
  the user to share the guesses for their passwords with the service. Even if the password
63
67
  was not used for anything else, sharing even guesses for secret credentials with 3rd parties,
64
68
  is a critical security issue.
65
- - Fiddlesticks is designed to minimise the need for this. It is designed to both i) require as
66
- few dependencies as possible, and ii) be as easy to install as possible.
67
- The intention is ii) assists users to run Fiddlesticks in their own secure
68
- environment, locked down as much as they want, without requiring them to take their
69
- password guesses outside of that. Only stock 7zip is required. Fiddlesticks can even
70
- generate a file of candidate passwords, for any possible application. Secondly
71
- i) helps users decide for themselves whether or not to trust Fiddlesticks
69
+ - Fiddlesticks is designed to minimise the need for this. It is designed to i) be as easy
70
+ to install as possible, and in particular ii) require as few dependencies as possible.
71
+ Firstly, the intention of i) is to assist users to run Fiddlesticks in their own secure
72
+ environment, locked down as much as they want (e.g. offline and disconnected from
73
+ all external network access), without requiring them to take their
74
+ password guesses outside of that. For example, for recovery of password encrypted .7z archives,
75
+ only a normal installation of 7zip is required on Linux (plus a close enough guess of the password!).
76
+ Fiddlesticks can even generate a file of candidate passwords, for external programs, and other
77
+ possible applications. Secondly, ii) helps users decide for themselves whether or not to trust Fiddlesticks
72
78
  in the first place. In particular whether or not it will take their password guesses outside
73
79
  of its running environment. When the project was concieved, the intention was also to
74
80
  iii) require as little code as possible. But the code base has since become somewhat more
75
- complex, mainly in order to have a nice CLI. Simplicity and brevity should both be much
76
- more highly prized features of any software, than they are. But you
77
- be the judge of whether or not c) is still the case. It's only a single ~500 line file.
81
+ complex, mainly to have a nice CLI. Simplicity and brevity should both be much
82
+ more highly prized features of software in general. But you
83
+ be the judge of whether or not c) is still the case. The application code is all in a 526 line file.
78
84
 
79
85
  ### Usage
80
86
  Recommended use is simply to automate attempts to open a 7z archive via the user's own 7zip.
81
- Fiddlesticks can also try to decrypt Aegis vault files (for TOTP authenticators) if [py-avdu](https://pypi.org/project/py-avdu/) is also installed.
87
+ Fiddlesticks can also try to decrypt KeepassXC vaults and Aegis vault files (for TOTP authenticators) if
88
+ [pykeepass](https://pypi.org/project/pykeepass/) and [py-avdu](https://pypi.org/project/py-avdu/) respectively, are
89
+ also installed.
82
90
 
83
91
  There are a couple of alternative modes too, firstly: automating any other external Bash command that a candidate password can be appended to (that obeys the normal return code convention).
84
92
 
@@ -2,6 +2,8 @@
2
2
  *"Aaaagh! I forgot my 7zip password"* - James (more times than he cares to remember).
3
3
  ![Tests passing](https://github.com/Hazardous-Area/fiddlesticks/actions/workflows/tests.yml/badge.svg)
4
4
 
5
+ Version 0.2.0
6
+
5
7
  ## Description
6
8
  Password recovery tool, for password-encrypted files, using simple off-line brute
7
9
  force attacks. Password candidates are generated, using common variations
@@ -44,23 +46,27 @@ archive can also do so - the password wasn't strong enough.
44
46
  the user to share the guesses for their passwords with the service. Even if the password
45
47
  was not used for anything else, sharing even guesses for secret credentials with 3rd parties,
46
48
  is a critical security issue.
47
- - Fiddlesticks is designed to minimise the need for this. It is designed to both i) require as
48
- few dependencies as possible, and ii) be as easy to install as possible.
49
- The intention is ii) assists users to run Fiddlesticks in their own secure
50
- environment, locked down as much as they want, without requiring them to take their
51
- password guesses outside of that. Only stock 7zip is required. Fiddlesticks can even
52
- generate a file of candidate passwords, for any possible application. Secondly
53
- i) helps users decide for themselves whether or not to trust Fiddlesticks
49
+ - Fiddlesticks is designed to minimise the need for this. It is designed to i) be as easy
50
+ to install as possible, and in particular ii) require as few dependencies as possible.
51
+ Firstly, the intention of i) is to assist users to run Fiddlesticks in their own secure
52
+ environment, locked down as much as they want (e.g. offline and disconnected from
53
+ all external network access), without requiring them to take their
54
+ password guesses outside of that. For example, for recovery of password encrypted .7z archives,
55
+ only a normal installation of 7zip is required on Linux (plus a close enough guess of the password!).
56
+ Fiddlesticks can even generate a file of candidate passwords, for external programs, and other
57
+ possible applications. Secondly, ii) helps users decide for themselves whether or not to trust Fiddlesticks
54
58
  in the first place. In particular whether or not it will take their password guesses outside
55
59
  of its running environment. When the project was concieved, the intention was also to
56
60
  iii) require as little code as possible. But the code base has since become somewhat more
57
- complex, mainly in order to have a nice CLI. Simplicity and brevity should both be much
58
- more highly prized features of any software, than they are. But you
59
- be the judge of whether or not c) is still the case. It's only a single ~500 line file.
61
+ complex, mainly to have a nice CLI. Simplicity and brevity should both be much
62
+ more highly prized features of software in general. But you
63
+ be the judge of whether or not c) is still the case. The application code is all in a 526 line file.
60
64
 
61
65
  ### Usage
62
66
  Recommended use is simply to automate attempts to open a 7z archive via the user's own 7zip.
63
- Fiddlesticks can also try to decrypt Aegis vault files (for TOTP authenticators) if [py-avdu](https://pypi.org/project/py-avdu/) is also installed.
67
+ Fiddlesticks can also try to decrypt KeepassXC vaults and Aegis vault files (for TOTP authenticators) if
68
+ [pykeepass](https://pypi.org/project/pykeepass/) and [py-avdu](https://pypi.org/project/py-avdu/) respectively, are
69
+ also installed.
64
70
 
65
71
  There are a couple of alternative modes too, firstly: automating any other external Bash command that a candidate password can be appended to (that obeys the normal return code convention).
66
72
 
@@ -16,9 +16,11 @@ dynamic=["version"]
16
16
  dependencies = []
17
17
 
18
18
  [project.optional-dependencies]
19
- tests = ["pytest", "hypothesis",]
20
- py7zr = ["py7zr",]
21
- aegis = ["py-avdu",]
19
+ py7zr = ["py7zr"]
20
+ aegis = ["py-avdu"]
21
+ keepassxc = ["pykeepass"]
22
+ tests = ["pytest", "hypothesis"]
23
+
22
24
 
23
25
  [project.urls]
24
26
  GitHub = "https://github.com/Hazardous-Area/fiddlesticks"
@@ -2,13 +2,14 @@
2
2
  # requires-python = ">=3.12"
3
3
  # dependencies = []
4
4
  # optional_dependencies = [
5
- # tests = ["pytest", "hypothesis"],
6
5
  # py7zr = ["py7zr"],
7
6
  # aegis = ["py-avdu"],
7
+ # keepassxc = ["pykeepass"],
8
+ # tests = ["pytest", "hypothesis"],
8
9
  # ]
9
10
  # ///
10
11
 
11
- __version__ = "0.1.0"
12
+ __version__ = "0.2.0"
12
13
 
13
14
  import argparse
14
15
  import atexit
@@ -268,6 +269,21 @@ def make_py_avdu_aegis_checker(file: str, **kwargs):
268
269
 
269
270
  return checker
270
271
 
272
+ def make_pykeepass_checker(file: str, **kwargs):
273
+
274
+ from pykeepass import PyKeePass
275
+ from pykeepass.exceptions import CredentialsError
276
+
277
+ def checker(candidate: str) -> bool:
278
+ try:
279
+ PyKeePass(file, password=candidate)
280
+ return True
281
+ except CredentialsError:
282
+ return False
283
+
284
+
285
+ return checker
286
+
271
287
 
272
288
  def test_passwords_sequentially(
273
289
  candidates: Iterable[str],
@@ -305,6 +321,8 @@ def test_passwords_sequentially(
305
321
  default_password_protected_file_checker_factories = {
306
322
  ".7z" : make_7zip_checker,
307
323
  ".json" : make_py_avdu_aegis_checker,
324
+ ".kdbx" : make_pykeepass_checker,
325
+ ".kdb" : make_pykeepass_checker,
308
326
  }
309
327
 
310
328
 
@@ -430,6 +448,7 @@ add_checker_factory_arg("--7zip-persistent", make_persistent_7zip_checker)
430
448
  add_checker_factory_arg("--shell", make_subprocess_checker)
431
449
  add_checker_factory_arg("--py7zr", make_py7zr_checker)
432
450
  add_checker_factory_arg("--aegis", make_py_avdu_aegis_checker)
451
+ add_checker_factory_arg("--keypassxc", make_pykeepass_checker)
433
452
  add_checker_factory_arg(
434
453
  "--pipe",
435
454
  make_password_candidate_piper,
@@ -0,0 +1,29 @@
1
+ import subprocess
2
+
3
+ import pytest
4
+
5
+ from fiddlesticks import make_py_avdu_aegis_checker, make_pykeepass_checker
6
+
7
+ from .helpers import IS_WINDOWS, KDBX_TEST_VAULT, avdu_test_vault
8
+
9
+
10
+ @pytest.mark.skipif(IS_WINDOWS, reason="I haven't figured out the 7zip CLI on Windows yet")
11
+ def test_is_7zip_installed():
12
+ args = ["7z", "--help"]
13
+ subprocess.check_call(args)
14
+
15
+
16
+ def test_aegis_checker_against_avdu_vault(avdu_test_vault):
17
+ checker = make_py_avdu_aegis_checker(avdu_test_vault)
18
+ # """
19
+ # # Run using the encrypted test file. (Enter password "test" when prompted.)
20
+ # go run ./cmd/avdu -p test/data/aegis_encrypted.json -e
21
+ # https://github.com/Sammy-T/avdu/blob/master/README.md
22
+ # """
23
+ assert checker("test")
24
+ assert not checker("wrong_password")
25
+
26
+ def test_pykeepass_checker_against_Test_vault():
27
+ checker = make_pykeepass_checker(KDBX_TEST_VAULT)
28
+ assert checker("test")
29
+ assert not checker("wrong_password")
@@ -13,10 +13,10 @@ import fiddlesticks
13
13
 
14
14
  from .helpers import (
15
15
  IS_WINDOWS,
16
+ avdu_test_vault,
16
17
  _assert_candidate_within_M_of_pwd,
17
18
  _assert_files_same,
18
19
  _create_password_protected_7z_archive,
19
- avdu_test_vault,
20
20
  file_names_and_contents,
21
21
  guesses_and_num_subs_from_password,
22
22
  passwords_guesses_and_num_subs,
@@ -19,6 +19,7 @@ import fiddlesticks
19
19
 
20
20
  IS_WINDOWS = sys.platform == "win32"
21
21
  BI_MAP = fiddlesticks.SHIFT_AND_LEET_BI_MAP
22
+ KDBX_TEST_VAULT = Path(__file__).parent / "Test_vault_Do_Not_Use.kdbx"
22
23
 
23
24
  file_names = text(
24
25
  alphabet=string.ascii_letters + string.digits,
@@ -1 +0,0 @@
1
- * text eol=lf
@@ -1,22 +0,0 @@
1
- import subprocess
2
-
3
- import pytest
4
-
5
- from .helpers import (
6
- avdu_test_vault,
7
- IS_WINDOWS,
8
- )
9
-
10
- from fiddlesticks import make_py_avdu_aegis_checker
11
-
12
-
13
- @pytest.mark.skipif(IS_WINDOWS, reason="I haven't figured out the 7zip CLI on Windows yet")
14
- def test_is_7zip_installed():
15
- args = ["7z", "--help"]
16
- subprocess.check_call(args)
17
-
18
-
19
- def test_aegis_checker_against_avdu_vault(avdu_test_vault):
20
- checker = make_py_avdu_aegis_checker(avdu_test_vault)
21
- assert checker("test")
22
- assert not checker("not_test")
File without changes
File without changes
File without changes