jame 1.0.dev0__tar.gz → 1.0.dev2__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.
- {jame-1.0.dev0 → jame-1.0.dev2}/PKG-INFO +4 -1
- {jame-1.0.dev0 → jame-1.0.dev2}/README.md +2 -0
- jame-1.0.dev2/jame/cli/jame_cli.py +178 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame.egg-info/PKG-INFO +4 -1
- {jame-1.0.dev0 → jame-1.0.dev2}/jame.egg-info/requires.txt +1 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/pyproject.toml +2 -1
- {jame-1.0.dev0 → jame-1.0.dev2}/tests/test_cli.py +19 -1
- jame-1.0.dev0/jame/cli/jame_cli.py +0 -151
- {jame-1.0.dev0 → jame-1.0.dev2}/LICENSE +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/__init__.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/__main__.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/cli/__init__.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/core/__init__.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/core/filetype.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/core/jame.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/core/patterns.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/core/utils.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/modules/__init__.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/modules/archive.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/modules/binary.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/modules/crypto.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/modules/forensics.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/modules/stego.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/results/__init__.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/results/binary_result.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/results/crypto_result.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/results/forensics_result.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/results/scan_result.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/results/solve_result.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame/results/stego_result.py +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame.egg-info/SOURCES.txt +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame.egg-info/dependency_links.txt +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame.egg-info/entry_points.txt +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/jame.egg-info/top_level.txt +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/setup.cfg +0 -0
- {jame-1.0.dev0 → jame-1.0.dev2}/tests/test_api.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jame
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.dev2
|
|
4
4
|
Summary: Just Another Method of Exploitation
|
|
5
5
|
Author: JAMe Contributors
|
|
6
6
|
License: MIT
|
|
@@ -19,6 +19,7 @@ Classifier: Development Status :: 4 - Beta
|
|
|
19
19
|
Requires-Python: >=3.10
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
|
+
Requires-Dist: c2e
|
|
22
23
|
Requires-Dist: PyYAML>=6.0
|
|
23
24
|
Dynamic: license-file
|
|
24
25
|
|
|
@@ -74,6 +75,8 @@ to require five characters, not `hcr{*****}`.
|
|
|
74
75
|
Other available methods:
|
|
75
76
|
|
|
76
77
|
```bash
|
|
78
|
+
./jame.sh update
|
|
79
|
+
./jame.sh update --pre
|
|
77
80
|
./jame.sh find-flag tests/files/challenge.txt --format 'hcr{*4}'
|
|
78
81
|
./jame.sh scan tests/files/scan.txt
|
|
79
82
|
./jame.sh crypto tests/files/strings.txt --verbose
|
|
@@ -50,6 +50,8 @@ to require five characters, not `hcr{*****}`.
|
|
|
50
50
|
Other available methods:
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
+
./jame.sh update
|
|
54
|
+
./jame.sh update --pre
|
|
53
55
|
./jame.sh find-flag tests/files/challenge.txt --format 'hcr{*4}'
|
|
54
56
|
./jame.sh scan tests/files/scan.txt
|
|
55
57
|
./jame.sh crypto tests/files/strings.txt --verbose
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
'''Command-line entry point for JAMe.'''
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import subprocess
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
from c2e import LiveCLI, command
|
|
8
|
+
|
|
9
|
+
from jame import Jame
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _print_result(cli: LiveCLI, result: object, detailed: bool = False) -> None:
|
|
13
|
+
if detailed:
|
|
14
|
+
to_dict = getattr(result, 'to_dict', None)
|
|
15
|
+
output = to_dict() if callable(to_dict) else result
|
|
16
|
+
cli.safePrint(json.dumps(output, indent=2, default=str))
|
|
17
|
+
elif hasattr(result, 'summary'):
|
|
18
|
+
cli.safePrint(result.summary)
|
|
19
|
+
elif result is None:
|
|
20
|
+
cli.safePrint('No flag found.')
|
|
21
|
+
elif isinstance(result, list):
|
|
22
|
+
cli.safePrint('\n'.join(str(item) for item in result) if result else 'No results.')
|
|
23
|
+
elif isinstance(result, (dict, tuple)):
|
|
24
|
+
cli.safePrint(json.dumps(result, indent=2, default=str))
|
|
25
|
+
else:
|
|
26
|
+
cli.safePrint(result)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@command('solve')
|
|
30
|
+
def solve(cli: LiveCLI, path: str) -> None:
|
|
31
|
+
'''Find a flag and extract supported archives.'''
|
|
32
|
+
engine = Jame(flag_patterns=[format()], max_depth=max_depth(), verbose=verbose())
|
|
33
|
+
result = engine.autoSolve(
|
|
34
|
+
path,
|
|
35
|
+
format=format(),
|
|
36
|
+
maxDepth=max_depth(),
|
|
37
|
+
verbose=verbose(),
|
|
38
|
+
)
|
|
39
|
+
_print_result(cli, result, verbose())
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@solve.param('format', type=str, default='flag{*}')
|
|
43
|
+
def _solve_format(value):
|
|
44
|
+
'''Flag pattern; '*' matches any length and '*N' matches exactly N characters.'''
|
|
45
|
+
return value
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@solve.param('max-depth', type=int, default=3)
|
|
49
|
+
def _solve_max_depth(value):
|
|
50
|
+
'''Maximum recursive archive extraction depth.'''
|
|
51
|
+
return value
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@solve.flag('verbose')
|
|
55
|
+
def _solve_verbose(value):
|
|
56
|
+
'''Print structured result details.'''
|
|
57
|
+
return value
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@command('find-flag')
|
|
61
|
+
def find_flag(cli: LiveCLI, path: str) -> None:
|
|
62
|
+
'''Find a flag matching a wildcard pattern.'''
|
|
63
|
+
result = Jame().findFlag(path, format())
|
|
64
|
+
_print_result(cli, result, verbose())
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@find_flag.param('format', type=str, default='flag{*}')
|
|
68
|
+
def _find_flag_format(value):
|
|
69
|
+
'''Flag pattern; '*' matches any length and '*N' matches exactly N characters.'''
|
|
70
|
+
return value
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@find_flag.flag('verbose')
|
|
74
|
+
def _find_flag_verbose(value):
|
|
75
|
+
'''Print structured result details.'''
|
|
76
|
+
return value
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _register_path_command(name: str, method_name: str, description: str) -> None:
|
|
80
|
+
@command(name)
|
|
81
|
+
def handler(cli: LiveCLI, path: str) -> None:
|
|
82
|
+
result = getattr(Jame(), method_name)(path)
|
|
83
|
+
_print_result(cli, result, verbose())
|
|
84
|
+
|
|
85
|
+
handler.func.__doc__ = description
|
|
86
|
+
handler.desc = description
|
|
87
|
+
def verbose_flag(value):
|
|
88
|
+
'''Print structured result details.'''
|
|
89
|
+
return value
|
|
90
|
+
|
|
91
|
+
handler.flag('verbose')(verbose_flag)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
_register_path_command('scan', 'scanFile', 'Run all available analyzers.')
|
|
95
|
+
_register_path_command('crypto', 'cryptoAnalyze', 'Analyze crypto indicators.')
|
|
96
|
+
_register_path_command('binary', 'binaryAnalyze', 'Analyze binary indicators.')
|
|
97
|
+
_register_path_command('stego', 'stegoAnalyze', 'Check for steganography indicators.')
|
|
98
|
+
_register_path_command('forensics', 'forensicsAnalyze', 'Run forensic checks.')
|
|
99
|
+
_register_path_command('file-type', 'getFileType', 'Detect the file type.')
|
|
100
|
+
_register_path_command('strings', 'runStrings', 'Extract printable strings.')
|
|
101
|
+
_register_path_command('binwalk', 'runBinwalk', 'Run binwalk when installed.')
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@command('archive')
|
|
105
|
+
def archive(cli: LiveCLI, path: str) -> None:
|
|
106
|
+
'''Extract supported archives.'''
|
|
107
|
+
engine = Jame(max_depth=max_depth(), verbose=verbose())
|
|
108
|
+
_print_result(cli, engine.archiveExtract(path), verbose())
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
@archive.param('max-depth', type=int, default=3)
|
|
112
|
+
def _archive_max_depth(value):
|
|
113
|
+
'''Maximum recursive archive extraction depth.'''
|
|
114
|
+
return value
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
@archive.flag('verbose')
|
|
118
|
+
def _archive_verbose(value):
|
|
119
|
+
'''Print structured result details.'''
|
|
120
|
+
return value
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@command('caesar')
|
|
124
|
+
def caesar(cli: LiveCLI, text: str) -> None:
|
|
125
|
+
'''Decode Caesar-shifted text.'''
|
|
126
|
+
shift_value = shift()
|
|
127
|
+
if shift_value != 'brute':
|
|
128
|
+
try:
|
|
129
|
+
shift_value = int(shift_value)
|
|
130
|
+
except ValueError:
|
|
131
|
+
cli.safePrint("Error: --shift must be an integer or 'brute'")
|
|
132
|
+
raise SystemExit(2) from None
|
|
133
|
+
result = Jame().decodeCaesar(text, shift_value)
|
|
134
|
+
_print_result(cli, result, verbose())
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@caesar.param('shift', type=str, default='brute')
|
|
138
|
+
def _caesar_shift(value):
|
|
139
|
+
'''Integer shift or 'brute' to check every Caesar shift.'''
|
|
140
|
+
return value
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@caesar.flag('verbose')
|
|
144
|
+
def _caesar_verbose(value):
|
|
145
|
+
'''Print structured result details.'''
|
|
146
|
+
return value
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
@command('update')
|
|
150
|
+
def update(cli: LiveCLI) -> None:
|
|
151
|
+
'''Upgrade JAMe and its C2E CLI dependency.'''
|
|
152
|
+
cli.safePrint('Updating JAMe...')
|
|
153
|
+
command = [sys.executable, '-m', 'pip', 'install', '--upgrade']
|
|
154
|
+
if pre():
|
|
155
|
+
command.append('--pre')
|
|
156
|
+
command.extend(['c2e', 'jame'])
|
|
157
|
+
result = subprocess.run(command, check=False)
|
|
158
|
+
if result.returncode:
|
|
159
|
+
raise SystemExit(result.returncode)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
@update.flag('pre')
|
|
163
|
+
def _update_pre(value):
|
|
164
|
+
'''Include pre-release versions when upgrading.'''
|
|
165
|
+
return value
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def main() -> None:
|
|
169
|
+
'''Parse command-line options and dispatch them through C2E.'''
|
|
170
|
+
LiveCLI().run_argv(
|
|
171
|
+
prog='jame',
|
|
172
|
+
description='Just Another Method of Exploitation',
|
|
173
|
+
default_command='solve',
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
if __name__ == '__main__':
|
|
178
|
+
main()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jame
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.dev2
|
|
4
4
|
Summary: Just Another Method of Exploitation
|
|
5
5
|
Author: JAMe Contributors
|
|
6
6
|
License: MIT
|
|
@@ -19,6 +19,7 @@ Classifier: Development Status :: 4 - Beta
|
|
|
19
19
|
Requires-Python: >=3.10
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
|
+
Requires-Dist: c2e
|
|
22
23
|
Requires-Dist: PyYAML>=6.0
|
|
23
24
|
Dynamic: license-file
|
|
24
25
|
|
|
@@ -74,6 +75,8 @@ to require five characters, not `hcr{*****}`.
|
|
|
74
75
|
Other available methods:
|
|
75
76
|
|
|
76
77
|
```bash
|
|
78
|
+
./jame.sh update
|
|
79
|
+
./jame.sh update --pre
|
|
77
80
|
./jame.sh find-flag tests/files/challenge.txt --format 'hcr{*4}'
|
|
78
81
|
./jame.sh scan tests/files/scan.txt
|
|
79
82
|
./jame.sh crypto tests/files/strings.txt --verbose
|
|
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "jame"
|
|
10
|
-
version = "1.0-dev"
|
|
10
|
+
version = "1.0-dev.2"
|
|
11
11
|
description = "Just Another Method of Exploitation"
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
requires-python = ">=3.10"
|
|
@@ -24,6 +24,7 @@ keywords = [
|
|
|
24
24
|
"jame",
|
|
25
25
|
]
|
|
26
26
|
dependencies = [
|
|
27
|
+
"c2e",
|
|
27
28
|
"PyYAML>=6.0",
|
|
28
29
|
]
|
|
29
30
|
classifiers = [
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
4
|
import sys
|
|
5
|
+
from types import SimpleNamespace
|
|
5
6
|
|
|
7
|
+
from jame.cli import jame_cli
|
|
6
8
|
from jame.cli.jame_cli import main
|
|
7
9
|
|
|
8
10
|
|
|
@@ -54,4 +56,20 @@ def test_cli_supports_caesar_method(monkeypatch, capsys):
|
|
|
54
56
|
output = run_cli(monkeypatch, capsys, 'caesar', 'Khoor', '--shift', '3')
|
|
55
57
|
|
|
56
58
|
result = json.loads(output)
|
|
57
|
-
assert result == {'shift': 3, 'decoded': 'Hello'}
|
|
59
|
+
assert result == {'shift': 3, 'decoded': 'Hello'}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def test_cli_update_pre_requests_prereleases(monkeypatch, capsys):
|
|
63
|
+
'''Pass --pre through to pip when updating JAMe and C2E.'''
|
|
64
|
+
calls = []
|
|
65
|
+
|
|
66
|
+
def fake_run(arguments, check):
|
|
67
|
+
calls.append((arguments, check))
|
|
68
|
+
return SimpleNamespace(returncode=0)
|
|
69
|
+
|
|
70
|
+
monkeypatch.setattr(jame_cli.subprocess, 'run', fake_run)
|
|
71
|
+
run_cli(monkeypatch, capsys, 'update', '--pre')
|
|
72
|
+
|
|
73
|
+
arguments, check = calls[0]
|
|
74
|
+
assert arguments[-4:] == ['--upgrade', '--pre', 'c2e', 'jame']
|
|
75
|
+
assert check is False
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
'''Command-line entry point for JAMe.'''
|
|
2
|
-
|
|
3
|
-
import argparse
|
|
4
|
-
import json
|
|
5
|
-
import sys
|
|
6
|
-
|
|
7
|
-
from jame import Jame
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
_COMMANDS = {
|
|
11
|
-
'archive',
|
|
12
|
-
'binary',
|
|
13
|
-
'binwalk',
|
|
14
|
-
'caesar',
|
|
15
|
-
'crypto',
|
|
16
|
-
'file-type',
|
|
17
|
-
'find-flag',
|
|
18
|
-
'forensics',
|
|
19
|
-
'scan',
|
|
20
|
-
'solve',
|
|
21
|
-
'stego',
|
|
22
|
-
'strings',
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def _add_path_arguments(command: argparse.ArgumentParser) -> None:
|
|
27
|
-
command.add_argument('path', help='Path to the file to analyze')
|
|
28
|
-
command.add_argument('--verbose', action='store_true', help='Print structured result details')
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def _build_parser() -> argparse.ArgumentParser:
|
|
32
|
-
parser = argparse.ArgumentParser(
|
|
33
|
-
prog='jame',
|
|
34
|
-
description='Just Another Method of Exploitation',
|
|
35
|
-
)
|
|
36
|
-
subparsers = parser.add_subparsers(dest='command', required=True)
|
|
37
|
-
|
|
38
|
-
solve = subparsers.add_parser('solve', help='Find a flag and extract supported archives')
|
|
39
|
-
_add_path_arguments(solve)
|
|
40
|
-
solve.add_argument(
|
|
41
|
-
'--format',
|
|
42
|
-
default='flag{*}',
|
|
43
|
-
help="Flag pattern; '*' matches any length and '*N' matches exactly N characters",
|
|
44
|
-
)
|
|
45
|
-
solve.add_argument('--max-depth', type=int, default=3, help='Archive extraction depth')
|
|
46
|
-
|
|
47
|
-
find_flag = subparsers.add_parser('find-flag', help='Find a flag matching a pattern')
|
|
48
|
-
_add_path_arguments(find_flag)
|
|
49
|
-
find_flag.add_argument(
|
|
50
|
-
'--format',
|
|
51
|
-
default='flag{*}',
|
|
52
|
-
help="Flag pattern; '*' matches any length and '*N' matches exactly N characters",
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
for name, description in (
|
|
56
|
-
('scan', 'Run all available analyzers'),
|
|
57
|
-
('crypto', 'Analyze crypto indicators'),
|
|
58
|
-
('binary', 'Analyze binary indicators'),
|
|
59
|
-
('stego', 'Check for steganography indicators'),
|
|
60
|
-
('forensics', 'Run forensic checks'),
|
|
61
|
-
('file-type', 'Detect the file type'),
|
|
62
|
-
('strings', 'Extract printable strings'),
|
|
63
|
-
('binwalk', 'Run binwalk when installed'),
|
|
64
|
-
):
|
|
65
|
-
command = subparsers.add_parser(name, help=description)
|
|
66
|
-
_add_path_arguments(command)
|
|
67
|
-
|
|
68
|
-
archive = subparsers.add_parser('archive', help='Extract supported archives')
|
|
69
|
-
_add_path_arguments(archive)
|
|
70
|
-
archive.add_argument('--max-depth', type=int, default=3, help='Archive extraction depth')
|
|
71
|
-
|
|
72
|
-
caesar = subparsers.add_parser('caesar', help='Decode Caesar-shifted text')
|
|
73
|
-
caesar.add_argument('text', help='Text to decode')
|
|
74
|
-
caesar.add_argument('--shift', default='brute', help="Integer shift or 'brute'")
|
|
75
|
-
caesar.add_argument('--verbose', action='store_true', help='Print structured result details')
|
|
76
|
-
|
|
77
|
-
return parser
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
def _print_result(result: object, verbose: bool) -> None:
|
|
81
|
-
if verbose:
|
|
82
|
-
to_dict = getattr(result, 'to_dict', None)
|
|
83
|
-
output = to_dict() if callable(to_dict) else result
|
|
84
|
-
print(json.dumps(output, indent=2, default=str))
|
|
85
|
-
elif hasattr(result, 'summary'):
|
|
86
|
-
print(result.summary)
|
|
87
|
-
elif result is None:
|
|
88
|
-
print('No flag found.')
|
|
89
|
-
elif isinstance(result, list):
|
|
90
|
-
print('\n'.join(str(item) for item in result) if result else 'No results.')
|
|
91
|
-
elif isinstance(result, (dict, tuple)):
|
|
92
|
-
print(json.dumps(result, indent=2, default=str))
|
|
93
|
-
else:
|
|
94
|
-
print(result)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def main() -> None:
|
|
98
|
-
'''Parse command-line options and run the requested JAMe method.'''
|
|
99
|
-
argv = sys.argv[1:]
|
|
100
|
-
if argv and argv[0] not in _COMMANDS and argv[0] not in {'-h', '--help'}:
|
|
101
|
-
argv.insert(0, 'solve')
|
|
102
|
-
|
|
103
|
-
parser = _build_parser()
|
|
104
|
-
args = parser.parse_args(argv)
|
|
105
|
-
max_depth = getattr(args, 'max_depth', 3)
|
|
106
|
-
engine = Jame(
|
|
107
|
-
flag_patterns=[getattr(args, 'format', 'flag{*}')],
|
|
108
|
-
max_depth=max_depth,
|
|
109
|
-
verbose=args.verbose,
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
if args.command == 'solve':
|
|
113
|
-
result = engine.autoSolve(
|
|
114
|
-
args.path,
|
|
115
|
-
format=args.format,
|
|
116
|
-
maxDepth=args.max_depth,
|
|
117
|
-
verbose=args.verbose,
|
|
118
|
-
)
|
|
119
|
-
elif args.command == 'find-flag':
|
|
120
|
-
result = engine.findFlag(args.path, args.format)
|
|
121
|
-
elif args.command == 'scan':
|
|
122
|
-
result = engine.scanFile(args.path)
|
|
123
|
-
elif args.command == 'crypto':
|
|
124
|
-
result = engine.cryptoAnalyze(args.path)
|
|
125
|
-
elif args.command == 'binary':
|
|
126
|
-
result = engine.binaryAnalyze(args.path)
|
|
127
|
-
elif args.command == 'stego':
|
|
128
|
-
result = engine.stegoAnalyze(args.path)
|
|
129
|
-
elif args.command == 'forensics':
|
|
130
|
-
result = engine.forensicsAnalyze(args.path)
|
|
131
|
-
elif args.command == 'archive':
|
|
132
|
-
engine.setMaxDepth(args.max_depth)
|
|
133
|
-
result = engine.archiveExtract(args.path)
|
|
134
|
-
elif args.command == 'file-type':
|
|
135
|
-
result = engine.getFileType(args.path)
|
|
136
|
-
elif args.command == 'strings':
|
|
137
|
-
result = engine.runStrings(args.path)
|
|
138
|
-
elif args.command == 'binwalk':
|
|
139
|
-
result = engine.runBinwalk(args.path)
|
|
140
|
-
else:
|
|
141
|
-
try:
|
|
142
|
-
shift = 'brute' if args.shift == 'brute' else int(args.shift)
|
|
143
|
-
except ValueError:
|
|
144
|
-
parser.error("--shift must be an integer or 'brute'")
|
|
145
|
-
result = engine.decodeCaesar(args.text, shift)
|
|
146
|
-
|
|
147
|
-
_print_result(result, args.verbose)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if __name__ == '__main__':
|
|
151
|
-
main()
|
|
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
|
|
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
|