jame 1.0.dev2__tar.gz → 1.0.dev3__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.
Files changed (35) hide show
  1. {jame-1.0.dev2 → jame-1.0.dev3}/PKG-INFO +39 -28
  2. {jame-1.0.dev2 → jame-1.0.dev3}/README.md +37 -27
  3. {jame-1.0.dev2 → jame-1.0.dev3}/jame/cli/jame_cli.py +40 -8
  4. {jame-1.0.dev2 → jame-1.0.dev3}/jame.egg-info/PKG-INFO +39 -28
  5. {jame-1.0.dev2 → jame-1.0.dev3}/jame.egg-info/requires.txt +1 -0
  6. {jame-1.0.dev2 → jame-1.0.dev3}/pyproject.toml +2 -1
  7. {jame-1.0.dev2 → jame-1.0.dev3}/tests/test_cli.py +46 -5
  8. {jame-1.0.dev2 → jame-1.0.dev3}/LICENSE +0 -0
  9. {jame-1.0.dev2 → jame-1.0.dev3}/jame/__init__.py +0 -0
  10. {jame-1.0.dev2 → jame-1.0.dev3}/jame/__main__.py +0 -0
  11. {jame-1.0.dev2 → jame-1.0.dev3}/jame/cli/__init__.py +0 -0
  12. {jame-1.0.dev2 → jame-1.0.dev3}/jame/core/__init__.py +0 -0
  13. {jame-1.0.dev2 → jame-1.0.dev3}/jame/core/filetype.py +0 -0
  14. {jame-1.0.dev2 → jame-1.0.dev3}/jame/core/jame.py +0 -0
  15. {jame-1.0.dev2 → jame-1.0.dev3}/jame/core/patterns.py +0 -0
  16. {jame-1.0.dev2 → jame-1.0.dev3}/jame/core/utils.py +0 -0
  17. {jame-1.0.dev2 → jame-1.0.dev3}/jame/modules/__init__.py +0 -0
  18. {jame-1.0.dev2 → jame-1.0.dev3}/jame/modules/archive.py +0 -0
  19. {jame-1.0.dev2 → jame-1.0.dev3}/jame/modules/binary.py +0 -0
  20. {jame-1.0.dev2 → jame-1.0.dev3}/jame/modules/crypto.py +0 -0
  21. {jame-1.0.dev2 → jame-1.0.dev3}/jame/modules/forensics.py +0 -0
  22. {jame-1.0.dev2 → jame-1.0.dev3}/jame/modules/stego.py +0 -0
  23. {jame-1.0.dev2 → jame-1.0.dev3}/jame/results/__init__.py +0 -0
  24. {jame-1.0.dev2 → jame-1.0.dev3}/jame/results/binary_result.py +0 -0
  25. {jame-1.0.dev2 → jame-1.0.dev3}/jame/results/crypto_result.py +0 -0
  26. {jame-1.0.dev2 → jame-1.0.dev3}/jame/results/forensics_result.py +0 -0
  27. {jame-1.0.dev2 → jame-1.0.dev3}/jame/results/scan_result.py +0 -0
  28. {jame-1.0.dev2 → jame-1.0.dev3}/jame/results/solve_result.py +0 -0
  29. {jame-1.0.dev2 → jame-1.0.dev3}/jame/results/stego_result.py +0 -0
  30. {jame-1.0.dev2 → jame-1.0.dev3}/jame.egg-info/SOURCES.txt +0 -0
  31. {jame-1.0.dev2 → jame-1.0.dev3}/jame.egg-info/dependency_links.txt +0 -0
  32. {jame-1.0.dev2 → jame-1.0.dev3}/jame.egg-info/entry_points.txt +0 -0
  33. {jame-1.0.dev2 → jame-1.0.dev3}/jame.egg-info/top_level.txt +0 -0
  34. {jame-1.0.dev2 → jame-1.0.dev3}/setup.cfg +0 -0
  35. {jame-1.0.dev2 → jame-1.0.dev3}/tests/test_api.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jame
3
- Version: 1.0.dev2
3
+ Version: 1.0.dev3
4
4
  Summary: Just Another Method of Exploitation
5
5
  Author: JAMe Contributors
6
6
  License: MIT
@@ -20,6 +20,7 @@ Requires-Python: >=3.10
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: c2e
23
+ Requires-Dist: mapres
23
24
  Requires-Dist: PyYAML>=6.0
24
25
  Dynamic: license-file
25
26
 
@@ -41,31 +42,36 @@ JAMe is a lightweight forensic and triage toolkit for scanning files, extracting
41
42
 
42
43
  ## Installation
43
44
 
44
- JAMe requires Python 3.10 or newer. From the repository root, this one-line
45
- installer creates the virtual environment, installs JAMe, links the command
46
- into the absolute path `$HOME/.local/bin`, and adds that directory to the
47
- current shell and future Bash login/interactive shells:
45
+ JAMe requires Python 3.10 or newer. Install the latest published package and
46
+ register `jame` on your user PATH with:
48
47
 
49
48
  ```bash
50
- python3 -m venv .venv && .venv/bin/pip install jame && mkdir -p "$HOME/.local/bin" && if [[ -e "$HOME/.local/bin/jame" && ! "$HOME/.local/bin/jame" -ef "$(pwd -P)/.venv/bin/jame" ]]; then printf '%s\n' 'Refusing to replace existing command at ~/.local/bin/jame' >&2; exit 1; fi && ln -sfn "$(pwd -P)/.venv/bin/jame" "$HOME/.local/bin/jame" && for rc in "$HOME/.profile" "$HOME/.bashrc"; do grep -qxF 'export PATH="$HOME/.local/bin:$PATH"' "$rc" 2>/dev/null || printf '%s\n' 'export PATH="$HOME/.local/bin:$PATH"' >> "$rc"; done && export PATH="$HOME/.local/bin:$PATH" && jame --help
49
+ curl -fsSL https://raw.githubusercontent.com/HungerNet/JAMe/main/install.sh | bash
51
50
  ```
52
51
 
52
+ The installer creates a dedicated environment under `$HOME/.local/share/jame`,
53
+ installs the MapRes pre-release API, `jame`, and C2E, and links the command to
54
+ `$HOME/.local/bin/jame`. It adds that directory to Bash or Zsh startup files;
55
+ open a new shell if it was not already on your current PATH.
56
+
57
+ Set `JAME_PYTHON` to select a specific Python 3.10+ executable. Set
58
+ `JAME_INSTALL_DIR` or `JAME_BIN_DIR` to change the absolute install or bin path.
59
+
53
60
  ## CLI
54
61
 
55
- From a checkout, the Bash launcher can also be run directly; it uses the active
56
- virtual environment, the checkout's `.venv`, or `python3.10`, in that order:
62
+ After installation, run the `jame` command from any directory:
57
63
 
58
64
  ```bash
59
- ./jame.sh --help
60
- ./jame.sh tests/files/solution.txt
65
+ jame --help
66
+ jame tests/files/solution.txt
61
67
  ```
62
68
 
63
- The default command finds a flag and extracts supported archives. The original
64
- path-only form remains supported:
69
+ The default command finds a flag and extracts supported archives. The explicit
70
+ `solve` form is also available:
65
71
 
66
72
  ```bash
67
- ./jame.sh tests/files/solution.txt
68
- ./jame.sh solve tests/files/solution.txt --format 'flag{*}'
73
+ jame tests/files/solution.txt
74
+ jame solve tests/files/solution.txt --format 'flag{*}'
69
75
  ```
70
76
 
71
77
  Use `*` for any-length text and `*N` for exactly `N` characters. Repeating
@@ -75,23 +81,28 @@ to require five characters, not `hcr{*****}`.
75
81
  Other available methods:
76
82
 
77
83
  ```bash
78
- ./jame.sh update
79
- ./jame.sh update --pre
80
- ./jame.sh find-flag tests/files/challenge.txt --format 'hcr{*4}'
81
- ./jame.sh scan tests/files/scan.txt
82
- ./jame.sh crypto tests/files/strings.txt --verbose
83
- ./jame.sh binary tests/files/strings.txt
84
- ./jame.sh stego tests/files/strings.txt
85
- ./jame.sh forensics tests/files/strings.txt
86
- ./jame.sh archive path/to/archive.zip --max-depth 2
87
- ./jame.sh file-type tests/files/strings.txt
88
- ./jame.sh strings tests/files/strings.txt
89
- ./jame.sh binwalk path/to/file.bin
90
- ./jame.sh caesar 'Khoor' --shift 3
84
+ jame update
85
+ jame update --pre
86
+ jame find-flag tests/files/challenge.txt --format 'hcr{*4}'
87
+ jame scan tests/files/scan.txt
88
+ jame crypto tests/files/strings.txt --verbose
89
+ jame binary tests/files/strings.txt
90
+ jame stego tests/files/strings.txt
91
+ jame forensics tests/files/strings.txt
92
+ jame archive path/to/archive.zip --max-depth 2
93
+ jame file-type tests/files/strings.txt
94
+ jame strings tests/files/strings.txt
95
+ jame binwalk path/to/file.bin
96
+ jame caesar 'Khoor'
97
+ jame caesar 'Khoor' --verbose
98
+ jame caesar 'Khoor' --shift 3
91
99
  ```
92
100
 
93
101
  `--verbose` prints the structured result, including analyzer details and raw
94
- output where available. `binwalk` requires the external `binwalk` utility.
102
+ output where available. Caesar brute force prints only its highest-ranked
103
+ decoded candidate by default; `--verbose` shows the ranked candidates.
104
+ `jame update` upgrades JAMe and C2E; `jame update --pre` also upgrades MapRes
105
+ using prerelease versions. `binwalk` requires the external `binwalk` utility.
95
106
 
96
107
  ## Quickstart
97
108
 
@@ -16,31 +16,36 @@ JAMe is a lightweight forensic and triage toolkit for scanning files, extracting
16
16
 
17
17
  ## Installation
18
18
 
19
- JAMe requires Python 3.10 or newer. From the repository root, this one-line
20
- installer creates the virtual environment, installs JAMe, links the command
21
- into the absolute path `$HOME/.local/bin`, and adds that directory to the
22
- current shell and future Bash login/interactive shells:
19
+ JAMe requires Python 3.10 or newer. Install the latest published package and
20
+ register `jame` on your user PATH with:
23
21
 
24
22
  ```bash
25
- python3 -m venv .venv && .venv/bin/pip install jame && mkdir -p "$HOME/.local/bin" && if [[ -e "$HOME/.local/bin/jame" && ! "$HOME/.local/bin/jame" -ef "$(pwd -P)/.venv/bin/jame" ]]; then printf '%s\n' 'Refusing to replace existing command at ~/.local/bin/jame' >&2; exit 1; fi && ln -sfn "$(pwd -P)/.venv/bin/jame" "$HOME/.local/bin/jame" && for rc in "$HOME/.profile" "$HOME/.bashrc"; do grep -qxF 'export PATH="$HOME/.local/bin:$PATH"' "$rc" 2>/dev/null || printf '%s\n' 'export PATH="$HOME/.local/bin:$PATH"' >> "$rc"; done && export PATH="$HOME/.local/bin:$PATH" && jame --help
23
+ curl -fsSL https://raw.githubusercontent.com/HungerNet/JAMe/main/install.sh | bash
26
24
  ```
27
25
 
26
+ The installer creates a dedicated environment under `$HOME/.local/share/jame`,
27
+ installs the MapRes pre-release API, `jame`, and C2E, and links the command to
28
+ `$HOME/.local/bin/jame`. It adds that directory to Bash or Zsh startup files;
29
+ open a new shell if it was not already on your current PATH.
30
+
31
+ Set `JAME_PYTHON` to select a specific Python 3.10+ executable. Set
32
+ `JAME_INSTALL_DIR` or `JAME_BIN_DIR` to change the absolute install or bin path.
33
+
28
34
  ## CLI
29
35
 
30
- From a checkout, the Bash launcher can also be run directly; it uses the active
31
- virtual environment, the checkout's `.venv`, or `python3.10`, in that order:
36
+ After installation, run the `jame` command from any directory:
32
37
 
33
38
  ```bash
34
- ./jame.sh --help
35
- ./jame.sh tests/files/solution.txt
39
+ jame --help
40
+ jame tests/files/solution.txt
36
41
  ```
37
42
 
38
- The default command finds a flag and extracts supported archives. The original
39
- path-only form remains supported:
43
+ The default command finds a flag and extracts supported archives. The explicit
44
+ `solve` form is also available:
40
45
 
41
46
  ```bash
42
- ./jame.sh tests/files/solution.txt
43
- ./jame.sh solve tests/files/solution.txt --format 'flag{*}'
47
+ jame tests/files/solution.txt
48
+ jame solve tests/files/solution.txt --format 'flag{*}'
44
49
  ```
45
50
 
46
51
  Use `*` for any-length text and `*N` for exactly `N` characters. Repeating
@@ -50,23 +55,28 @@ to require five characters, not `hcr{*****}`.
50
55
  Other available methods:
51
56
 
52
57
  ```bash
53
- ./jame.sh update
54
- ./jame.sh update --pre
55
- ./jame.sh find-flag tests/files/challenge.txt --format 'hcr{*4}'
56
- ./jame.sh scan tests/files/scan.txt
57
- ./jame.sh crypto tests/files/strings.txt --verbose
58
- ./jame.sh binary tests/files/strings.txt
59
- ./jame.sh stego tests/files/strings.txt
60
- ./jame.sh forensics tests/files/strings.txt
61
- ./jame.sh archive path/to/archive.zip --max-depth 2
62
- ./jame.sh file-type tests/files/strings.txt
63
- ./jame.sh strings tests/files/strings.txt
64
- ./jame.sh binwalk path/to/file.bin
65
- ./jame.sh caesar 'Khoor' --shift 3
58
+ jame update
59
+ jame update --pre
60
+ jame find-flag tests/files/challenge.txt --format 'hcr{*4}'
61
+ jame scan tests/files/scan.txt
62
+ jame crypto tests/files/strings.txt --verbose
63
+ jame binary tests/files/strings.txt
64
+ jame stego tests/files/strings.txt
65
+ jame forensics tests/files/strings.txt
66
+ jame archive path/to/archive.zip --max-depth 2
67
+ jame file-type tests/files/strings.txt
68
+ jame strings tests/files/strings.txt
69
+ jame binwalk path/to/file.bin
70
+ jame caesar 'Khoor'
71
+ jame caesar 'Khoor' --verbose
72
+ jame caesar 'Khoor' --shift 3
66
73
  ```
67
74
 
68
75
  `--verbose` prints the structured result, including analyzer details and raw
69
- output where available. `binwalk` requires the external `binwalk` utility.
76
+ output where available. Caesar brute force prints only its highest-ranked
77
+ decoded candidate by default; `--verbose` shows the ranked candidates.
78
+ `jame update` upgrades JAMe and C2E; `jame update --pre` also upgrades MapRes
79
+ using prerelease versions. `binwalk` requires the external `binwalk` utility.
70
80
 
71
81
  ## Quickstart
72
82
 
@@ -1,13 +1,27 @@
1
1
  '''Command-line entry point for JAMe.'''
2
2
 
3
3
  import json
4
+ import os
4
5
  import subprocess
5
6
  import sys
6
7
 
7
8
  from c2e import LiveCLI, command
9
+ from mapres import ascii_colors, rprint, res, setGlobalMaps
8
10
 
9
11
  from jame import Jame
10
12
 
13
+ setGlobalMaps(ascii_colors)
14
+ _COLOR_ENABLED = sys.stdout.isatty() and 'NO_COLOR' not in os.environ
15
+
16
+
17
+ def _paint(text: object, color: str, *, bold: bool = False) -> str:
18
+ if not _COLOR_ENABLED:
19
+ return str(text)
20
+ style = res(f'<{color}>')
21
+ if bold:
22
+ style = res('<bold>') + style
23
+ return f'{style}{text}{res("<reset>")}'
24
+
11
25
 
12
26
  def _print_result(cli: LiveCLI, result: object, detailed: bool = False) -> None:
13
27
  if detailed:
@@ -15,15 +29,22 @@ def _print_result(cli: LiveCLI, result: object, detailed: bool = False) -> None:
15
29
  output = to_dict() if callable(to_dict) else result
16
30
  cli.safePrint(json.dumps(output, indent=2, default=str))
17
31
  elif hasattr(result, 'summary'):
18
- cli.safePrint(result.summary)
32
+ if hasattr(result, 'flag'):
33
+ color = 'green' if result.flag else 'yellow'
34
+ else:
35
+ color = 'green' if getattr(result, 'confidence', 0.0) >= 0.7 else 'aqua'
36
+ cli.safePrint(_paint(result.summary, color))
37
+ if getattr(result, 'flag', None):
38
+ cli.safePrint(_paint(result.flag, 'green', bold=True))
19
39
  elif result is None:
20
- cli.safePrint('No flag found.')
40
+ cli.safePrint(_paint('No flag found.', 'yellow'))
21
41
  elif isinstance(result, list):
22
- cli.safePrint('\n'.join(str(item) for item in result) if result else 'No results.')
42
+ output = '\n'.join(str(item) for item in result) if result else 'No results.'
43
+ cli.safePrint(_paint(output, 'blue'))
23
44
  elif isinstance(result, (dict, tuple)):
24
- cli.safePrint(json.dumps(result, indent=2, default=str))
45
+ cli.safePrint(_paint(json.dumps(result, indent=2, default=str), 'blue'))
25
46
  else:
26
- cli.safePrint(result)
47
+ cli.safePrint(_paint(result, 'aqua'))
27
48
 
28
49
 
29
50
  @command('solve')
@@ -131,7 +152,16 @@ def caesar(cli: LiveCLI, text: str) -> None:
131
152
  cli.safePrint("Error: --shift must be an integer or 'brute'")
132
153
  raise SystemExit(2) from None
133
154
  result = Jame().decodeCaesar(text, shift_value)
134
- _print_result(cli, result, verbose())
155
+ if verbose():
156
+ _print_result(cli, result, detailed=True)
157
+ elif shift_value == 'brute':
158
+ best = result.get('best')
159
+ if best:
160
+ cli.safePrint(_paint(best['decoded'], 'green', bold=True))
161
+ else:
162
+ cli.safePrint(_paint('No Caesar candidate found.', 'yellow'))
163
+ else:
164
+ cli.safePrint(_paint(result.get('decoded', result.get('error', '')), 'green'))
135
165
 
136
166
 
137
167
  @caesar.param('shift', type=str, default='brute')
@@ -148,12 +178,14 @@ def _caesar_verbose(value):
148
178
 
149
179
  @command('update')
150
180
  def update(cli: LiveCLI) -> None:
151
- '''Upgrade JAMe and its C2E CLI dependency.'''
152
- cli.safePrint('Updating JAMe...')
181
+ '''Upgrade JAMe and C2E, optionally including the MapRes prerelease.'''
182
+ rprint(_paint('Updating JAMe...', 'aqua'))
153
183
  command = [sys.executable, '-m', 'pip', 'install', '--upgrade']
154
184
  if pre():
155
185
  command.append('--pre')
156
186
  command.extend(['c2e', 'jame'])
187
+ if pre():
188
+ command.append('mapres')
157
189
  result = subprocess.run(command, check=False)
158
190
  if result.returncode:
159
191
  raise SystemExit(result.returncode)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jame
3
- Version: 1.0.dev2
3
+ Version: 1.0.dev3
4
4
  Summary: Just Another Method of Exploitation
5
5
  Author: JAMe Contributors
6
6
  License: MIT
@@ -20,6 +20,7 @@ Requires-Python: >=3.10
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: c2e
23
+ Requires-Dist: mapres
23
24
  Requires-Dist: PyYAML>=6.0
24
25
  Dynamic: license-file
25
26
 
@@ -41,31 +42,36 @@ JAMe is a lightweight forensic and triage toolkit for scanning files, extracting
41
42
 
42
43
  ## Installation
43
44
 
44
- JAMe requires Python 3.10 or newer. From the repository root, this one-line
45
- installer creates the virtual environment, installs JAMe, links the command
46
- into the absolute path `$HOME/.local/bin`, and adds that directory to the
47
- current shell and future Bash login/interactive shells:
45
+ JAMe requires Python 3.10 or newer. Install the latest published package and
46
+ register `jame` on your user PATH with:
48
47
 
49
48
  ```bash
50
- python3 -m venv .venv && .venv/bin/pip install jame && mkdir -p "$HOME/.local/bin" && if [[ -e "$HOME/.local/bin/jame" && ! "$HOME/.local/bin/jame" -ef "$(pwd -P)/.venv/bin/jame" ]]; then printf '%s\n' 'Refusing to replace existing command at ~/.local/bin/jame' >&2; exit 1; fi && ln -sfn "$(pwd -P)/.venv/bin/jame" "$HOME/.local/bin/jame" && for rc in "$HOME/.profile" "$HOME/.bashrc"; do grep -qxF 'export PATH="$HOME/.local/bin:$PATH"' "$rc" 2>/dev/null || printf '%s\n' 'export PATH="$HOME/.local/bin:$PATH"' >> "$rc"; done && export PATH="$HOME/.local/bin:$PATH" && jame --help
49
+ curl -fsSL https://raw.githubusercontent.com/HungerNet/JAMe/main/install.sh | bash
51
50
  ```
52
51
 
52
+ The installer creates a dedicated environment under `$HOME/.local/share/jame`,
53
+ installs the MapRes pre-release API, `jame`, and C2E, and links the command to
54
+ `$HOME/.local/bin/jame`. It adds that directory to Bash or Zsh startup files;
55
+ open a new shell if it was not already on your current PATH.
56
+
57
+ Set `JAME_PYTHON` to select a specific Python 3.10+ executable. Set
58
+ `JAME_INSTALL_DIR` or `JAME_BIN_DIR` to change the absolute install or bin path.
59
+
53
60
  ## CLI
54
61
 
55
- From a checkout, the Bash launcher can also be run directly; it uses the active
56
- virtual environment, the checkout's `.venv`, or `python3.10`, in that order:
62
+ After installation, run the `jame` command from any directory:
57
63
 
58
64
  ```bash
59
- ./jame.sh --help
60
- ./jame.sh tests/files/solution.txt
65
+ jame --help
66
+ jame tests/files/solution.txt
61
67
  ```
62
68
 
63
- The default command finds a flag and extracts supported archives. The original
64
- path-only form remains supported:
69
+ The default command finds a flag and extracts supported archives. The explicit
70
+ `solve` form is also available:
65
71
 
66
72
  ```bash
67
- ./jame.sh tests/files/solution.txt
68
- ./jame.sh solve tests/files/solution.txt --format 'flag{*}'
73
+ jame tests/files/solution.txt
74
+ jame solve tests/files/solution.txt --format 'flag{*}'
69
75
  ```
70
76
 
71
77
  Use `*` for any-length text and `*N` for exactly `N` characters. Repeating
@@ -75,23 +81,28 @@ to require five characters, not `hcr{*****}`.
75
81
  Other available methods:
76
82
 
77
83
  ```bash
78
- ./jame.sh update
79
- ./jame.sh update --pre
80
- ./jame.sh find-flag tests/files/challenge.txt --format 'hcr{*4}'
81
- ./jame.sh scan tests/files/scan.txt
82
- ./jame.sh crypto tests/files/strings.txt --verbose
83
- ./jame.sh binary tests/files/strings.txt
84
- ./jame.sh stego tests/files/strings.txt
85
- ./jame.sh forensics tests/files/strings.txt
86
- ./jame.sh archive path/to/archive.zip --max-depth 2
87
- ./jame.sh file-type tests/files/strings.txt
88
- ./jame.sh strings tests/files/strings.txt
89
- ./jame.sh binwalk path/to/file.bin
90
- ./jame.sh caesar 'Khoor' --shift 3
84
+ jame update
85
+ jame update --pre
86
+ jame find-flag tests/files/challenge.txt --format 'hcr{*4}'
87
+ jame scan tests/files/scan.txt
88
+ jame crypto tests/files/strings.txt --verbose
89
+ jame binary tests/files/strings.txt
90
+ jame stego tests/files/strings.txt
91
+ jame forensics tests/files/strings.txt
92
+ jame archive path/to/archive.zip --max-depth 2
93
+ jame file-type tests/files/strings.txt
94
+ jame strings tests/files/strings.txt
95
+ jame binwalk path/to/file.bin
96
+ jame caesar 'Khoor'
97
+ jame caesar 'Khoor' --verbose
98
+ jame caesar 'Khoor' --shift 3
91
99
  ```
92
100
 
93
101
  `--verbose` prints the structured result, including analyzer details and raw
94
- output where available. `binwalk` requires the external `binwalk` utility.
102
+ output where available. Caesar brute force prints only its highest-ranked
103
+ decoded candidate by default; `--verbose` shows the ranked candidates.
104
+ `jame update` upgrades JAMe and C2E; `jame update --pre` also upgrades MapRes
105
+ using prerelease versions. `binwalk` requires the external `binwalk` utility.
95
106
 
96
107
  ## Quickstart
97
108
 
@@ -1,2 +1,3 @@
1
1
  c2e
2
+ mapres
2
3
  PyYAML>=6.0
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "jame"
10
- version = "1.0-dev.2"
10
+ version = "1.0-dev.3"
11
11
  description = "Just Another Method of Exploitation"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.10"
@@ -25,6 +25,7 @@ keywords = [
25
25
  ]
26
26
  dependencies = [
27
27
  "c2e",
28
+ "mapres",
28
29
  "PyYAML>=6.0",
29
30
  ]
30
31
  classifiers = [
@@ -4,16 +4,26 @@ import json
4
4
  import sys
5
5
  from types import SimpleNamespace
6
6
 
7
+ from mapres import ascii_colors
8
+
7
9
  from jame.cli import jame_cli
8
10
  from jame.cli.jame_cli import main
9
11
 
10
12
 
11
13
  def run_cli(monkeypatch, capsys, *arguments: str) -> str:
12
14
  monkeypatch.setattr(sys, 'argv', ['jame', *arguments])
15
+ monkeypatch.setattr(jame_cli, '_COLOR_ENABLED', False)
13
16
  main()
14
17
  return capsys.readouterr().out
15
18
 
16
19
 
20
+ def test_cli_uses_mapres_color_tokens(monkeypatch):
21
+ '''Render color tokens from MapRes's registered ASCII map.'''
22
+ monkeypatch.setattr(jame_cli, '_COLOR_ENABLED', True)
23
+
24
+ assert jame_cli._paint('candidate', 'orange') == f'{ascii_colors.orange}candidate{ascii_colors.reset}'
25
+
26
+
17
27
  def test_cli_uses_numbered_wildcard_for_exact_length(monkeypatch, capsys):
18
28
  '''Treat numbered wildcard length as exact and unnumbered stars as open-ended.'''
19
29
  unbounded = run_cli(
@@ -52,11 +62,26 @@ def test_cli_verbose_prints_structured_analyzer_details(monkeypatch, capsys):
52
62
 
53
63
 
54
64
  def test_cli_supports_caesar_method(monkeypatch, capsys):
55
- '''Expose the Caesar decoder as a CLI command.'''
56
- output = run_cli(monkeypatch, capsys, 'caesar', 'Khoor', '--shift', '3')
65
+ '''Return only the best Caesar decode by default.'''
66
+ output = run_cli(monkeypatch, capsys, 'caesar', 'Khoor')
67
+
68
+ assert output.strip() == 'Hello'
69
+
70
+
71
+ def test_cli_caesar_verbose_shows_ranked_candidates(monkeypatch, capsys):
72
+ '''Expose ranked Caesar candidates through verbose output.'''
73
+ output = run_cli(monkeypatch, capsys, 'caesar', 'Khoor', '--verbose')
57
74
 
58
75
  result = json.loads(output)
59
- assert result == {'shift': 3, 'decoded': 'Hello'}
76
+ assert result['best']['decoded'] == 'Hello'
77
+ assert len(result['results']) == 25
78
+
79
+
80
+ def test_cli_caesar_explicit_shift(monkeypatch, capsys):
81
+ '''Decode one Caesar shift without verbose metadata.'''
82
+ output = run_cli(monkeypatch, capsys, 'caesar', 'Khoor', '--shift', '3')
83
+
84
+ assert output.strip() == 'Hello'
60
85
 
61
86
 
62
87
  def test_cli_update_pre_requests_prereleases(monkeypatch, capsys):
@@ -71,5 +96,21 @@ def test_cli_update_pre_requests_prereleases(monkeypatch, capsys):
71
96
  run_cli(monkeypatch, capsys, 'update', '--pre')
72
97
 
73
98
  arguments, check = calls[0]
74
- assert arguments[-4:] == ['--upgrade', '--pre', 'c2e', 'jame']
75
- assert check is False
99
+ assert arguments[-5:] == ['--upgrade', '--pre', 'c2e', 'jame', 'mapres']
100
+ assert check is False
101
+
102
+
103
+ def test_cli_stable_update_leaves_mapres_prerelease_installed(monkeypatch, capsys):
104
+ '''Avoid downgrading the required MapRes API during a stable update.'''
105
+ calls = []
106
+
107
+ def fake_run(arguments, check):
108
+ calls.append(arguments)
109
+ return SimpleNamespace(returncode=0)
110
+
111
+ monkeypatch.setattr(jame_cli.subprocess, 'run', fake_run)
112
+ run_cli(monkeypatch, capsys, 'update')
113
+
114
+ assert calls[0][-2:] == ['c2e', 'jame']
115
+ assert '--pre' not in calls[0]
116
+ assert 'mapres' not in calls[0]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes