fuzzy1337.portscan¶
Experimental finite native.nmap / network.tcp-connect product workflow under
ADR 0092. Explicit IP/port selection, current consent and STANDARD policy plus
exact confirmation precede governed execution. Original streams and truthful
terminal facts precede canonical Host/Port/reported-Service persistence; open
ports produce no Findings, and omitted/grouped ports remain unassessed
individually. The optional trusted executable remains operator-supplied.
fuzzy1337.portscan
¶
Finite optional TCP-connect scans through existing governed Workbench owners.
PortScanAuthorityDeniedError
¶
Bases: PermissionError
The selected operator differs from the current recorded scope consent actor.
Source code in fuzzy1337/portscan.py
77 78 | |
PortScanUnavailableError
¶
Bases: RuntimeError
The explicitly selected optional Nmap executable is unavailable or unhealthy.
Source code in fuzzy1337/portscan.py
81 82 | |
PortScanLimits
dataclass
¶
Bound host/executor time; the owning job adds five seconds for cleanup and custody.
Source code in fuzzy1337/portscan.py
85 86 87 88 89 90 91 92 93 94 95 96 97 | |
__post_init__() -> None
¶
Reject booleans and timeouts outside the existing adapter contract.
Source code in fuzzy1337/portscan.py
91 92 93 94 95 96 97 | |
PortScanPlan
dataclass
¶
Read-only exact invocation and STANDARD confirmation intent for one finite scan.
Source code in fuzzy1337/portscan.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
ToDict() -> dict[str, object]
¶
Expose exact provider inputs and current intent without granting execution.
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
Detached schema-one invocation, policy plan, and required confirmation fields. |
Source code in fuzzy1337/portscan.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
PortScanSummary
dataclass
¶
Truthful owned-job terminal state and durable canonical discovery counts.
Source code in fuzzy1337/portscan.py
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 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
ToDict() -> dict[str, object]
¶
Serialize actual job/evidence state without claiming all selected ports were assessed.
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
Detached schema-one terminal fields, model counts, and ordered job events. |
Source code in fuzzy1337/portscan.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
ExitCode() -> int
¶
Keep completed/denied/failed/cancelled product exit codes 0/3/4/130.
Returns:
| Type | Description |
|---|---|
int
|
Zero for completion, three for authority denial, four for failure, 130 for cancellation. |
Source code in fuzzy1337/portscan.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
PortScanWorkflow
dataclass
¶
Compose existing policy, process, job, evidence, and canonical discovery owners.
Source code in fuzzy1337/portscan.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | |
Context() -> PolicyContext
¶
Rebind actual address to the selected target and reread current operator authority.
Returns:
| Type | Description |
|---|---|
PolicyContext
|
Current owning scope/policy context for the exact originally selected operation. |
Source code in fuzzy1337/portscan.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
Run(context: JobContext) -> None
async
¶
Authorize the exact confirmed invocation and preserve acquisitions before completion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
JobContext
|
Existing owner of job events, cancellation, and original raw evidence. |
required |
Source code in fuzzy1337/portscan.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
Ingest(context: JobContext, report: AdapterReport, *, grant: PolicyGrant) -> None
async
¶
Map reported facts to existing Host/Port/Service identities and save under current grant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
JobContext
|
Owning job, receiving only actually saved model deltas and observations. |
required |
report
|
AdapterReport
|
Original successful executor facts and verified stdout/stderr references. |
required |
grant
|
PolicyGrant
|
The exact launch grant, revalidated immediately before model CAS Save. |
required |
Source code in fuzzy1337/portscan.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | |
PersistReferences() -> None
¶
Verify retained originals and preserve acquisition/model/job workspace references.
Source code in fuzzy1337/portscan.py
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | |
PortRequest(target: Target, ports: tuple[int, ...], limits: PortScanLimits) -> AdapterRequest
¶
Bind actual address and opaque subject to the same explicitly selected literal IP.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
Target
|
Canonical IP target; URL, domain, network, and artifact targets are refused. |
required |
ports
|
tuple[int, ...]
|
Immutable explicit port selection, validated by the existing Nmap adapter. |
required |
limits
|
PortScanLimits
|
Typed existing finite timeout; no permission is derived from these limits. |
required |
Returns:
| Type | Description |
|---|---|
AdapterRequest
|
The sole supported STANDARD TCP-connect request without credentials or arbitrary flags. |
Source code in fuzzy1337/portscan.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
CurrentContext(workspace_root: Path, scope_id: str, target: Target, owner_reference: str, policy_provider: Callable[[], ImpactPolicy]) -> PolicyContext
¶
Read current recorded actor, consent, IP scope, and explicit typed capability policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace_root
|
Path
|
Existing owning workspace partition. |
required |
scope_id
|
str
|
Explicit existing scope; this reader never registers a target. |
required |
target
|
Target
|
The same canonical IP used as the actual invocation address. |
required |
owner_reference
|
str
|
Operator required to match the current recorded authority. |
required |
policy_provider
|
Callable[[], ImpactPolicy]
|
Trusted fresh policy reader; omissions grant no permission. |
required |
Returns:
| Type | Description |
|---|---|
PolicyContext
|
Current policy context with exactly the selected IP as its actual destination. |
Source code in fuzzy1337/portscan.py
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 | |
PlanPortScan(workspace_root: Path, scope_id: str, target: Target, owner_reference: str, ports: tuple[int, ...], executable: str, policy_provider: Callable[[], ImpactPolicy], *, limits: PortScanLimits = PortScanLimits(), clock: Callable[[], datetime] = UtcNow) -> PortScanPlan
¶
Plan one finite optional TCP-connect operation without contacting a target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace_root
|
Path
|
Existing initialized workspace, model, and verified retained evidence. |
required |
scope_id
|
str
|
Explicit existing IP scope with independently granted consent. |
required |
target
|
Target
|
One selected literal IP; no DNS resolution or target expansion occurs. |
required |
owner_reference
|
str
|
Operator matching current recorded scope authority. |
required |
ports
|
tuple[int, ...]
|
Explicit unique TCP ports, one through 1024 entries, each from 1 through 65535. |
required |
executable
|
str
|
Explicit trusted absolute local Nmap executable, never installed implicitly. |
required |
policy_provider
|
Callable[[], ImpactPolicy]
|
Fresh synchronous typed policy reader; no authority defaults are added. |
required |
limits
|
PortScanLimits
|
Existing Nmap/executor timeout; the owning job adds five cleanup/custody seconds. |
PortScanLimits()
|
clock
|
Callable[[], datetime]
|
Aware authority clock; only the bounded local version probe may execute here. |
UtcNow
|
Returns:
| Type | Description |
|---|---|
PortScanPlan
|
Exact invocation and policy intent requiring a separate STANDARD confirmation. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Selection, retained evidence, or stored state violates its contract. |
PermissionError
|
Current owner, consent, scope, capability, or impact is denied. |
PortScanUnavailableError
|
The selected optional executable is unavailable or unhealthy. |
OSError
|
Initial authoritative local state cannot be read. |
Source code in fuzzy1337/portscan.py
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 | |
RunPortScan(workspace_root: Path, scope_id: str, target: Target, owner_reference: str, ports: tuple[int, ...], executable: str, policy_provider: Callable[[], ImpactPolicy], *, confirmation: PolicyConfirmation | None = None, limits: PortScanLimits = PortScanLimits(), on_event: Callable[[JobEvent], None] | None = None, clock: Callable[[], datetime] = UtcNow) -> PortScanSummary
async
¶
Rebuild the current exact plan and run one explicitly confirmed finite TCP-connect scan.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace_root
|
Path
|
Existing initialized caller-owned workspace partition. |
required |
scope_id
|
str
|
Explicit current recorded IP scope; execution never broadens membership. |
required |
target
|
Target
|
The selected literal IP, also used as the sole actual policy destination. |
required |
owner_reference
|
str
|
Operator matching current recorded consent at every authority boundary. |
required |
ports
|
tuple[int, ...]
|
Explicit immutable unique TCP port selection under the existing adapter bounds. |
required |
executable
|
str
|
Explicit trusted absolute optional Nmap executable, never installed implicitly. |
required |
policy_provider
|
Callable[[], ImpactPolicy]
|
Trusted fresh typed policy reader with explicit capability permission. |
required |
confirmation
|
PolicyConfirmation | None
|
Separate STANDARD approval binding the exact previously presented intent. |
None
|
limits
|
PortScanLimits
|
Finite host/executor deadline, plus five owning-job cleanup/custody seconds. |
PortScanLimits()
|
on_event
|
Callable[[JobEvent], None] | None
|
Fast synchronous presentation sink; errors cancel and await owned cleanup. |
None
|
clock
|
Callable[[], datetime]
|
Aware authority clock checked at planning, launch, and immediately before Save. |
UtcNow
|
Returns:
| Type | Description |
|---|---|
PortScanSummary
|
Truthful terminal job result after owned cleanup and workspace reference persistence. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Initial selection, evidence, or stored state violates its contract. |
PermissionError
|
Initial current scope, owner, or capability authority is denied. |
PortScanUnavailableError
|
The optional selected provider is unavailable or unhealthy. |
OSError
|
Initial authoritative local state cannot be read. |
Exception
|
Presentation fails after actual owned cancellation and cleanup. |
Source code in fuzzy1337/portscan.py
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 | |