跳转至

English fallback

This translation is missing; the canonical English reference follows.

fuzzy1337.cli

The Experimental version-one paths analyze route delegates to its Internal read-only owner with exact saved-model revision/snapshot pins, explicit original source/target/transitions and assessment manifests or --no-assessments, offline context/scope, replay clock, freshness and finite search/cut budgets. The existing whole-model 512-eligible-object ceiling is checked before proof reads. --json preserves original UNKNOWN/reasons and declared versus effective confidence, structural counts and separate search/cut completeness in a bounded explanation. Static help reads no local state; dispatch grants no authority and writes no Core/model/workspace/evidence or hidden output.

Experimental version-one sbom import spdx-graph imports an explicitly owned offline original file or exact known original product manifest. The caller selects source/read-consent attribution, image digest semantics, offline scope, run and both current revision bases. The Internal handler preserves original custody, all-known SBOM alias preflight and three independent acquisition/model/ workspace acknowledgements. Static help opens no local state; import grants no scanner, remote retrieval, reachability or license-compliance authority.

The Experimental version-one api import graphql-introspection route imports one explicit owned original file or known original evidence custody. Endpoint, current scope, run and model/workspace revision bases remain caller-selected. The Internal handler uses unchanged SDK/store owners, refuses incompatible occupied API collections and reports acquisition/model/workspace acknowledgements separately. It retains bounded original bytes unredacted and supplies no introspection fetch, request preview, HTTP/native execution, Finding or execution grant.

The Experimental version-one trace ioc import|inspect route imports an explicitly selected owned non-secret local file or verifies independently retained snapshot and original receipt manifest identities. Source/version/license/hash/scope/read references and finite budgets remain explicit; no dataset or source is inferred. The unchanged IOC evidence owner retains original bytes while terminal summaries show only counts, observed hashes and evidence identifiers. Neither action saves Core/workspace state, probes targets or grants authority; the handler is Internal.

The Experimental version-one runtime import docker-inspect route imports one explicit owned offline file or exact retained manifest using an existing literal HOST, scope and caller-selected model/workspace revisions. New-file acquisition requires explicit read-consent references. --json preserves independent acquisition/model/workspace acknowledgements and partial failures; static runtime help opens no local state. The owning handler and its helpers remain Internal.

ci scan dispatches an explicit selected-profile finding predicate and three verified report exports. Satisfied/violated outcomes remain distinct from invalid setup, authority refusal, integrity failure and cancellation.

The product CLI routes explicit local intel import|inspect|apply commands to their owning evidence/model workflow. --json emits bounded terminal summaries; command preparation grants no remote acquisition or automatic enrichment.

fuzzy1337.cli

Minimal installed entry point for 1337 Security Workbench.

InstalledVersionAction

Bases: Action

Read distribution metadata only when argparse dispatches --version.

源代码位于: fuzzy1337/cli.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class InstalledVersionAction(argparse.Action):
    """Read distribution metadata only when argparse dispatches --version."""

    def __call__(
        self,
        parser: argparse.ArgumentParser,
        namespace: argparse.Namespace,
        values: str | Sequence[str] | None,
        option_string: str | None = None,
    ) -> None:
        """Preserve argparse's immediate version exit without eager metadata reads.

        Args:
            parser: CLI parser used to write output and exit.
            namespace: Unused argparse destination state.
            values: Unused values for this zero-argument action.
            option_string: Unused spelling of the requested option.

        Raises:
            SystemExit: Installed version output exits with status zero.
            PackageNotFoundError: The requested distribution metadata is absent.
        """

        sys.stdout.write(f"1337 {version('1337')}\n")
        parser.exit()

__call__(parser: argparse.ArgumentParser, namespace: argparse.Namespace, values: str | Sequence[str] | None, option_string: str | None = None) -> None

Preserve argparse's immediate version exit without eager metadata reads.

参数:

名称 类型 描述 默认
parser ArgumentParser

CLI parser used to write output and exit.

必需
namespace Namespace

Unused argparse destination state.

必需
values str | Sequence[str] | None

Unused values for this zero-argument action.

必需
option_string str | None

Unused spelling of the requested option.

None

引发:

类型 描述
SystemExit

Installed version output exits with status zero.

PackageNotFoundError

The requested distribution metadata is absent.

源代码位于: fuzzy1337/cli.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
def __call__(
    self,
    parser: argparse.ArgumentParser,
    namespace: argparse.Namespace,
    values: str | Sequence[str] | None,
    option_string: str | None = None,
) -> None:
    """Preserve argparse's immediate version exit without eager metadata reads.

    Args:
        parser: CLI parser used to write output and exit.
        namespace: Unused argparse destination state.
        values: Unused values for this zero-argument action.
        option_string: Unused spelling of the requested option.

    Raises:
        SystemExit: Installed version output exits with status zero.
        PackageNotFoundError: The requested distribution metadata is absent.
    """

    sys.stdout.write(f"1337 {version('1337')}\n")
    parser.exit()

GetCommands() -> dict[str, str]

Return descriptions from the deterministic developer-command registry.

返回:

类型 描述
dict[str, str]

Developer command names mapped to human-readable execution plans.

源代码位于: fuzzy1337/cli.py
47
48
49
50
51
52
53
54
def GetCommands() -> dict[str, str]:
    """Return descriptions from the deterministic developer-command registry.

    Returns:
        Developer command names mapped to human-readable execution plans.
    """

    return DescribeCommands()

GetCommandRegistry() -> CommandRegistry

Return the centralized user-command registry without exposing mutable state.

返回:

类型 描述
CommandRegistry

Shared user-command registry with immutable descriptors.

源代码位于: fuzzy1337/cli.py
57
58
59
60
61
62
63
64
def GetCommandRegistry() -> CommandRegistry:
    """Return the centralized user-command registry without exposing mutable state.

    Returns:
        Shared user-command registry with immutable descriptors.
    """

    return COMMAND_REGISTRY

CommandEpilog(registry: CommandRegistry) -> str

Render currently available commands from their centralized descriptors.

参数:

名称 类型 描述 默认
registry CommandRegistry

Command descriptors to display in presentation order.

必需

返回:

类型 描述
str

Help epilog with usages, summaries and the shell hint.

源代码位于: fuzzy1337/cli.py
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
def CommandEpilog(registry: CommandRegistry) -> str:
    """Render currently available commands from their centralized descriptors.

    Args:
        registry: Command descriptors to display in presentation order.

    Returns:
        Help epilog with usages, summaries and the shell hint.
    """

    lines = ["Currently available commands:"]
    lines.extend(
        f"  {descriptor.usage:<28}{descriptor.summary}" for descriptor in registry.Commands
    )
    lines.append("Run '1337 shell' to start the interactive workbench.")
    return "\n".join(lines)

Main(argv: Sequence[str] | None = None) -> int

Dispatch local workspace/scope commands, bounded scans, explicit CI gates and reports.

Writes to the terminal and may enter the interactive shell. The default dispatch does not start a scan.

参数:

名称 类型 描述 默认
argv Sequence[str] | None

Arguments excluding the executable, or None for process arguments.

None

返回:

类型 描述
int

Zero for completed commands or satisfied explicit CI predicates; one for CI violation,

int

two for invalid setup, three for scan denial,

int

four for scan/export integrity, execution or storage failure, 130 for interruption,

int

or inspection status.

引发:

类型 描述
SystemExit

Argument parsing rejects input or handles help/version.

PackageNotFoundError

Explicit --version output requests absent distribution metadata.

源代码位于: fuzzy1337/cli.py
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
def Main(argv: Sequence[str] | None = None) -> int:
    """Dispatch local workspace/scope commands, bounded scans, explicit CI gates and reports.

    Writes to the terminal and may enter the interactive shell. The default dispatch does not
    start a scan.

    Args:
        argv: Arguments excluding the executable, or None for process arguments.

    Returns:
        Zero for completed commands or satisfied explicit CI predicates; one for CI violation,
        two for invalid setup, three for scan denial,
        four for scan/export integrity, execution or storage failure, 130 for interruption,
        or inspection status.

    Raises:
        SystemExit: Argument parsing rejects input or handles help/version.
        PackageNotFoundError: Explicit --version output requests absent distribution metadata.
    """

    registry = GetCommandRegistry()
    parser = argparse.ArgumentParser(
        prog="1337",
        description="1337 Security Workbench by Fuzzy Technologies",
        epilog=CommandEpilog(registry),
        formatter_class=argparse.RawDescriptionHelpFormatter,
        add_help=False,
    )
    parser.add_argument("-h", "--help", action="store_true", help="Show command help and exit.")
    parser.add_argument(
        "--version",
        action=InstalledVersionAction,
        nargs=0,
        help="Show the installed distribution version and exit.",
    )
    parser.add_argument(
        "command",
        choices=("doctor", "help", "shell", "update", "workspace", "scope", "scan", "report",
                 "demo", "intel", "ci", "runtime", "paths", "sbom", "api", "trace", "response",
                 "raw", "image"),
        nargs="?",
        help=argparse.SUPPRESS,
    )
    parser.add_argument(
        "--json",
        action="store_true",
        help="Write experimental JSON for update or an explicit product command outcome.",
    )
    arguments, remaining = parser.parse_known_args(argv)

    if arguments.command == "raw":
        from fuzzy1337.raw_commands import RunRawCommands

        if arguments.help:
            separator = remaining.index("--") if "--" in remaining else len(remaining)
            remaining.insert(separator, "--help")

        return RunRawCommands(remaining, sys.stdout, json_output=arguments.json)

    if arguments.command == "image":
        from fuzzy1337.local_image_commands import RunLocalImageCommands

        if arguments.help:
            remaining.append("--help")

        return RunLocalImageCommands(remaining, sys.stdout, json_output=arguments.json)

    if arguments.command == "response":
        from fuzzy1337.response_commands import RunResponseCommands

        if arguments.help:
            remaining.append("--help")

        return RunResponseCommands(remaining, sys.stdout, json_output=arguments.json)

    if arguments.command == "paths":
        from fuzzy1337.path_commands import RunPathCommands

        if arguments.help:
            remaining.append("--help")

        return RunPathCommands(remaining, sys.stdout, json_output=arguments.json)

    if arguments.command == "sbom":
        from fuzzy1337.sbom_commands import RunSbomCommands

        if arguments.help:
            remaining.append("--help")

        return RunSbomCommands(remaining, sys.stdout, json_output=arguments.json)

    if arguments.command == "api":
        from fuzzy1337.api_commands import RunApiCommands

        if arguments.help:
            remaining.append("--help")

        return RunApiCommands(remaining, sys.stdout, json_output=arguments.json)

    if arguments.command == "runtime":
        from fuzzy1337.runtime_commands import RunRuntimeCommands

        if arguments.help:
            remaining.append("--help")

        return RunRuntimeCommands(remaining, sys.stdout, json_output=arguments.json)

    if arguments.command == "trace":
        from fuzzy1337.ioc_commands import RunIocCommands

        if arguments.help:
            remaining.append("--help")

        return RunIocCommands(remaining, sys.stdout, json_output=arguments.json)

    if arguments.command == "ci":
        from fuzzy1337.ci_commands import RunCiCommands

        if arguments.help:
            remaining.append("--help")

        return RunCiCommands(remaining, sys.stdout, json_output=arguments.json)

    if arguments.command == "intel":
        from fuzzy1337.intelligence_commands import RunIntelCommands

        if arguments.help:
            remaining.append("--help")

        return RunIntelCommands(remaining, sys.stdout, json_output=arguments.json)

    if arguments.command == "demo":
        from fuzzy1337.demo_commands import RunDemoCommands

        if arguments.help:
            remaining.append("--help")

        return RunDemoCommands(remaining, sys.stdout, json_output=arguments.json)

    if arguments.command == "report":
        from fuzzy1337.report_commands import RunReportCommands

        if arguments.help:
            remaining.append("--help")

        return RunReportCommands(remaining, sys.stdout, json_output=arguments.json)

    if arguments.command in {"workspace", "scope", "scan"}:
        from fuzzy1337.scan_commands import RunCommands

        if arguments.help:
            remaining.append("--help")

        return RunCommands(arguments.command, remaining, sys.stdout, json_output=arguments.json)

    if arguments.help:
        parser.print_help()
        parser.exit()

    if remaining:
        parser.error("unrecognized arguments: " + " ".join(remaining))

    if arguments.json and arguments.command != "update":
        parser.error(
            "--json is only available for update, workspace, scope, scan, report, demo, "
            "intel, ci, runtime, paths, sbom, api, trace, response, raw and image"
        )

    if arguments.command == "shell" or (arguments.command is None and sys.stdin.isatty()):
        return RunInteractiveShell()

    if arguments.command == "doctor":
        return RunDoctor(sys.stdout)

    if arguments.command == "update":
        return RunUpdate(sys.stdout, json_output=arguments.json)

    parser.print_help()
    return 0