pwn 0.5.795 → 0.5.796
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/bin/pwn_autoinc_version +4 -5
- data/bin/pwn_web_cache_deception +40 -29
- data/documentation/AWS.md +15 -5
- data/documentation/Diagrams.md +1 -1
- data/documentation/Home.md +2 -2
- data/documentation/How-PWN-Works.md +1 -1
- data/documentation/What-is-PWN.md +1 -1
- data/documentation/diagrams/aws-cloud-security.svg +1 -1
- data/documentation/diagrams/dot/aws-cloud-security.dot +1 -1
- data/documentation/diagrams/dot/network-infra-testing.dot +1 -1
- data/documentation/diagrams/network-infra-testing.svg +1 -1
- data/etc/default_cron/session_cleanup.rb +84 -51
- data/lib/pwn/ai/agent/assembly.rb +0 -2
- data/lib/pwn/ai/agent/btc.rb +0 -2
- data/lib/pwn/ai/agent/burp_suite.rb +0 -2
- data/lib/pwn/ai/agent/curriculum.rb +2 -2
- data/lib/pwn/ai/agent/dispatch.rb +3 -0
- data/lib/pwn/ai/agent/engagement.rb +96 -41
- data/lib/pwn/ai/agent/extrospection/osint/bridges.rb +2 -0
- data/lib/pwn/ai/agent/extrospection.rb +50 -13
- data/lib/pwn/ai/agent/gqrx.rb +0 -2
- data/lib/pwn/ai/agent/hacker_one.rb +0 -2
- data/lib/pwn/ai/agent/learning.rb +45 -13
- data/lib/pwn/ai/agent/loop.rb +12 -11
- data/lib/pwn/ai/agent/metrics.rb +1 -1
- data/lib/pwn/ai/agent/mission.rb +6 -3
- data/lib/pwn/ai/agent/policy.rb +1 -1
- data/lib/pwn/ai/agent/policy_evaluation.rb +2 -2
- data/lib/pwn/ai/agent/reflect.rb +1 -0
- data/lib/pwn/ai/agent/request_runtime.rb +1 -1
- data/lib/pwn/ai/agent/reward.rb +155 -53
- data/lib/pwn/ai/agent/sast.rb +0 -2
- data/lib/pwn/ai/agent/task_dag.rb +5 -3
- data/lib/pwn/ai/agent/task_summarizer.rb +21 -11
- data/lib/pwn/ai/agent/tool_guard.rb +19 -0
- data/lib/pwn/ai/agent/tools/ruby_eval.rb +1 -1
- data/lib/pwn/ai/agent/tools/verify.rb +7 -3
- data/lib/pwn/ai/agent/transparent_browser.rb +0 -2
- data/lib/pwn/ai/agent/turn_finalizer.rb +3 -0
- data/lib/pwn/ai/anthropic.rb +3 -3
- data/lib/pwn/ai/context.rb +2 -1
- data/lib/pwn/ai/gemini.rb +7 -5
- data/lib/pwn/ai/grok.rb +37 -18
- data/lib/pwn/ai/mcp.rb +17 -5
- data/lib/pwn/ai/ollama.rb +76 -35
- data/lib/pwn/ai/open_ai.rb +7 -19
- data/lib/pwn/ai/open_web_ui.rb +76 -40
- data/lib/pwn/aws/cloud_search_domain.rb +6 -0
- data/lib/pwn/aws/iam.rb +2 -2
- data/lib/pwn/aws/workspaces.rb +2 -2
- data/lib/pwn/aws.rb +0 -5
- data/lib/pwn/bounty/lifecycle_authz_replay.rb +1 -1
- data/lib/pwn/config.rb +17 -10
- data/lib/pwn/corpus.rb +33 -5
- data/lib/pwn/cron.rb +60 -17
- data/lib/pwn/driver.rb +2 -3
- data/lib/pwn/engagement.rb +28 -10
- data/lib/pwn/ffi/capstone.rb +3 -2
- data/lib/pwn/ffi/fftw.rb +8 -6
- data/lib/pwn/ffi/keystone.rb +3 -2
- data/lib/pwn/ffi/soapy_sdr.rb +10 -6
- data/lib/pwn/json_text.rb +25 -13
- data/lib/pwn/memory_index.rb +6 -4
- data/lib/pwn/module_skills.rb +3 -1
- data/lib/pwn/plugins/aflplusplus.rb +1 -0
- data/lib/pwn/plugins/ai_sandbox.rb +42 -10
- data/lib/pwn/plugins/android.rb +429 -466
- data/lib/pwn/plugins/artifact_registry.rb +12 -2
- data/lib/pwn/plugins/assembly.rb +9 -42
- data/lib/pwn/plugins/authentication_helper.rb +4 -3
- data/lib/pwn/plugins/baresip.rb +70 -28
- data/lib/pwn/plugins/binary_analysis.rb +14 -5
- data/lib/pwn/plugins/binary_parser.rb +42 -7
- data/lib/pwn/plugins/black_duck_binary_analysis.rb +3 -3
- data/lib/pwn/plugins/burp_suite.rb +15 -12
- data/lib/pwn/plugins/bus_pirate.rb +3 -7
- data/lib/pwn/plugins/char.rb +9 -3
- data/lib/pwn/plugins/credit_card.rb +7 -0
- data/lib/pwn/plugins/dao_ldap.rb +2 -2
- data/lib/pwn/plugins/dao_mongo.rb +1 -1
- data/lib/pwn/plugins/debugger.rb +1 -1
- data/lib/pwn/plugins/defect_dojo.rb +7 -3
- data/lib/pwn/plugins/detect_os.rb +1 -1
- data/lib/pwn/plugins/detonate.rb +9 -19
- data/lib/pwn/plugins/exploit_db.rb +1 -1
- data/lib/pwn/plugins/file_fu.rb +4 -1
- data/lib/pwn/plugins/findings.rb +76 -2
- data/lib/pwn/plugins/fuzz.rb +12 -3
- data/lib/pwn/plugins/gdb.rb +7 -2
- data/lib/pwn/plugins/gdbmi.rb +10 -6
- data/lib/pwn/plugins/git.rb +18 -13
- data/lib/pwn/plugins/github.rb +11 -6
- data/lib/pwn/plugins/google_workspace.rb +11 -3
- data/lib/pwn/plugins/hacker_one.rb +5 -1
- data/lib/pwn/plugins/httpx.rb +24 -8
- data/lib/pwn/plugins/ip_info.rb +11 -8
- data/lib/pwn/plugins/irc.rb +73 -45
- data/lib/pwn/plugins/jenkins.rb +2 -2
- data/lib/pwn/plugins/jira_data_center.rb +13 -6
- data/lib/pwn/plugins/jobs.rb +62 -4
- data/lib/pwn/plugins/log.rb +1 -1
- data/lib/pwn/plugins/monkey_patch.rb +1 -1
- data/lib/pwn/plugins/msr206.rb +157 -182
- data/lib/pwn/plugins/nessus_cloud.rb +2 -2
- data/lib/pwn/plugins/nexpose_vuln_scan.rb +44 -33
- data/lib/pwn/plugins/nuclei.rb +24 -8
- data/lib/pwn/plugins/ocr.rb +3 -1
- data/lib/pwn/plugins/open_api.rb +0 -4
- data/lib/pwn/plugins/openvas.rb +31 -43
- data/lib/pwn/plugins/packet.rb +40 -25
- data/lib/pwn/plugins/pony.rb +2 -2
- data/lib/pwn/plugins/preflight_checker.rb +1 -1
- data/lib/pwn/plugins/process_tube.rb +17 -2
- data/lib/pwn/plugins/ps.rb +6 -1
- data/lib/pwn/plugins/repl/ai.rb +1 -0
- data/lib/pwn/plugins/repl/ai_console.rb +12 -5
- data/lib/pwn/plugins/repl/mesh.rb +10 -2
- data/lib/pwn/plugins/sbom.rb +59 -27
- data/lib/pwn/plugins/scannable_codes.rb +3 -1
- data/lib/pwn/plugins/serial.rb +102 -44
- data/lib/pwn/plugins/shodan.rb +4 -10
- data/lib/pwn/plugins/sock.rb +16 -11
- data/lib/pwn/plugins/ssn.rb +3 -1
- data/lib/pwn/plugins/transparent_browser.rb +43 -3
- data/lib/pwn/plugins/vault.rb +92 -30
- data/lib/pwn/plugins/vin.rb +2 -1
- data/lib/pwn/plugins/vsphere.rb +2 -1
- data/lib/pwn/plugins/xxd.rb +3 -5
- data/lib/pwn/plugins/yubikey/security_domain/scp.rb +4 -0
- data/lib/pwn/plugins/yubikey/transport.rb +42 -11
- data/lib/pwn/plugins/yubikey.rb +21 -6
- data/lib/pwn/plugins/zaproxy.rb +3 -4
- data/lib/pwn/reports/ai_red_team.rb +4 -4
- data/lib/pwn/reports/pdf.rb +9 -5
- data/lib/pwn/reports/sast.rb +4 -4
- data/lib/pwn/sast/keystore.rb +2 -2
- data/lib/pwn/sast/logger.rb +1 -1
- data/lib/pwn/sast/php_type_juggling.rb +3 -6
- data/lib/pwn/sast/pom_version.rb +12 -6
- data/lib/pwn/sast/port.rb +1 -1
- data/lib/pwn/sast/sql.rb +3 -7
- data/lib/pwn/sast/test_case_engine.rb +62 -16
- data/lib/pwn/sast/type_script_type_juggling.rb +3 -6
- data/lib/pwn/sdr/decoder/base.rb +8 -0
- data/lib/pwn/sdr/decoder/lora.rb +1 -1
- data/lib/pwn/sdr/flipper_zero.rb +4 -7
- data/lib/pwn/sdr/gqrx.rb +35 -16
- data/lib/pwn/sdr/son_micro_rfid.rb +44 -26
- data/lib/pwn/sdr.rb +1 -1
- data/lib/pwn/session_trace.rb +7 -2
- data/lib/pwn/sessions.rb +307 -39
- data/lib/pwn/setup.rb +4 -3
- data/lib/pwn/version.rb +1 -1
- data/lib/pwn/www/app_cobalt_io.rb +14 -2
- data/lib/pwn/www/bing.rb +13 -1
- data/lib/pwn/www/bug_crowd.rb +14 -2
- data/lib/pwn/www/checkip.rb +13 -1
- data/lib/pwn/www/coinbase_pro.rb +14 -2
- data/lib/pwn/www/duckduckgo.rb +13 -1
- data/lib/pwn/www/facebook.rb +14 -2
- data/lib/pwn/www/github.rb +14 -2
- data/lib/pwn/www/google.rb +13 -1
- data/lib/pwn/www/hacker_one.rb +117 -33
- data/lib/pwn/www/linkedin.rb +14 -2
- data/lib/pwn/www/pandora.rb +14 -2
- data/lib/pwn/www/pastebin.rb +13 -1
- data/lib/pwn/www/paypal.rb +16 -4
- data/lib/pwn/www/synack.rb +14 -2
- data/lib/pwn/www/torch.rb +17 -3
- data/lib/pwn/www/trading_view.rb +14 -2
- data/lib/pwn/www/twitter.rb +14 -2
- data/lib/pwn/www/uber.rb +14 -2
- data/lib/pwn/www/upwork.rb +14 -2
- data/lib/pwn/www/wayback_machine.rb +16 -2
- data/lib/pwn/www/youtube.rb +13 -1
- data/pwn.gemspec +4 -0
- data/spec/integration/authentication_helper_oath_spec.rb +1 -1
- data/spec/integration/autoinc_lifecycle_supplement_spec.rb +47 -0
- data/spec/integration/gemspec_deleted_files_spec.rb +43 -0
- data/spec/integration/spec_curriculum_isolation_spec.rb +41 -0
- data/spec/integration/verify_acceptance_eui_regression_spec.rb +162 -0
- data/spec/integration/web_cache_lifecycle_closure_spec.rb +89 -0
- data/spec/integration/web_cache_lifecycle_supplement_spec.rb +70 -0
- data/spec/lib/pwn/ai/agent/analysis_errors_regression_spec.rb +33 -0
- data/spec/lib/pwn/ai/agent/curriculum_cooldown_regression_spec.rb +19 -0
- data/spec/lib/pwn/ai/agent/curriculum_spec.rb +2 -0
- data/spec/lib/pwn/ai/agent/engagement_boundary_regression_spec.rb +42 -0
- data/spec/lib/pwn/ai/agent/engagement_dispatch_review_spec.rb +82 -0
- data/spec/lib/pwn/ai/agent/engagement_roe_regression_spec.rb +25 -0
- data/spec/lib/pwn/ai/agent/engagement_scope_regression_spec.rb +37 -0
- data/spec/lib/pwn/ai/agent/extrospection/osint/bridges_spec.rb +4 -0
- data/spec/lib/pwn/ai/agent/extrospection_input_regression_spec.rb +31 -0
- data/spec/lib/pwn/ai/agent/extrospection_review_spec.rb +61 -0
- data/spec/lib/pwn/ai/agent/extrospection_serial_review_spec.rb +42 -0
- data/spec/lib/pwn/ai/agent/extrospection_spec.rb +9 -0
- data/spec/lib/pwn/ai/agent/extrospection_verification_regression_spec.rb +39 -0
- data/spec/lib/pwn/ai/agent/learning_last_answer_regression_spec.rb +32 -0
- data/spec/lib/pwn/ai/agent/learning_lifecycle_closure_spec.rb +84 -0
- data/spec/lib/pwn/ai/agent/learning_prune_regression_spec.rb +17 -0
- data/spec/lib/pwn/ai/agent/learning_spec.rb +2 -1
- data/spec/lib/pwn/ai/agent/loop_execution_audit_spec.rb +30 -0
- data/spec/lib/pwn/ai/agent/metrics_usage_regression_spec.rb +20 -0
- data/spec/lib/pwn/ai/agent/mission_execution_audit_spec.rb +27 -0
- data/spec/lib/pwn/ai/agent/mission_namespace_spec.rb +210 -18
- data/spec/lib/pwn/ai/agent/policy_confidence_regression_spec.rb +16 -0
- data/spec/lib/pwn/ai/agent/policy_evaluation_spec.rb +1 -1
- data/spec/lib/pwn/ai/agent/policy_evaluation_tmp_regression_spec.rb +36 -0
- data/spec/lib/pwn/ai/agent/reflect_model_regression_spec.rb +15 -0
- data/spec/lib/pwn/ai/agent/request_runtime_execution_audit_spec.rb +43 -0
- data/spec/lib/pwn/ai/agent/reward_binding_review_spec.rb +129 -0
- data/spec/lib/pwn/ai/agent/reward_dispatch_review_spec.rb +154 -0
- data/spec/lib/pwn/ai/agent/reward_envelope_regression_spec.rb +45 -0
- data/spec/lib/pwn/ai/agent/reward_turn_regression_spec.rb +40 -0
- data/spec/lib/pwn/ai/agent/swarm_spec.rb +2 -2
- data/spec/lib/pwn/ai/agent/task_dag_execution_audit_spec.rb +45 -0
- data/spec/lib/pwn/ai/agent/task_summarizer_failure_regression_spec.rb +26 -0
- data/spec/lib/pwn/ai/agent/tools/verify_execution_audit_spec.rb +33 -0
- data/spec/lib/pwn/ai/context_range_audit_spec.rb +24 -0
- data/spec/lib/pwn/ai/gemini_roundtrip_audit_spec.rb +33 -0
- data/spec/lib/pwn/ai/grok_reasoning_effort_spec.rb +43 -0
- data/spec/lib/pwn/ai/mcp_session_audit_spec.rb +36 -0
- data/spec/lib/pwn/ai/ollama_spec.rb +6 -11
- data/spec/lib/pwn/ai/open_web_ui_spec.rb +6 -11
- data/spec/lib/pwn/ai/provider_history_audit_spec.rb +44 -0
- data/spec/lib/pwn/ai/provider_operations_audit_spec.rb +53 -0
- data/spec/lib/pwn/ai/provider_review_history_stream_regression_spec.rb +143 -0
- data/spec/lib/pwn/ai/provider_review_tls_regression_spec.rb +62 -0
- data/spec/lib/pwn/ai/provider_stream_audit_spec.rb +49 -0
- data/spec/lib/pwn/aws/iam_decoding_regression_spec.rb +23 -0
- data/spec/lib/pwn/aws/services_runtime_regression_spec.rb +51 -0
- data/spec/lib/pwn/aws_spec.rb +6 -0
- data/spec/lib/pwn/banner_operational_audit_spec.rb +105 -0
- data/spec/lib/pwn/bounty/lifecycle_authz_replay_spec.rb +17 -0
- data/spec/lib/pwn/config_redaction_regression_spec.rb +24 -0
- data/spec/lib/pwn/config_skills_regression_spec.rb +38 -0
- data/spec/lib/pwn/corpus_core_review_regression_spec.rb +96 -0
- data/spec/lib/pwn/corpus_spec.rb +13 -0
- data/spec/lib/pwn/cron_core_review_regression_spec.rb +95 -0
- data/spec/lib/pwn/cron_execution_spec.rb +75 -0
- data/spec/lib/pwn/driver_core_review_regression_spec.rb +38 -0
- data/spec/lib/pwn/driver_spec.rb +13 -0
- data/spec/lib/pwn/engagement_core_review_regression_spec.rb +88 -0
- data/spec/lib/pwn/engagement_storage_regression_spec.rb +44 -0
- data/spec/lib/pwn/ffi/capstone_spec.rb +19 -0
- data/spec/lib/pwn/ffi/fftw_spec.rb +19 -0
- data/spec/lib/pwn/ffi/keystone_spec.rb +13 -0
- data/spec/lib/pwn/ffi/soapy_sdr_spec.rb +13 -0
- data/spec/lib/pwn/json_text_spec.rb +25 -0
- data/spec/lib/pwn/memory_index_spec.rb +23 -0
- data/spec/lib/pwn/module_skills_parsing_regression_spec.rb +34 -0
- data/spec/lib/pwn/plugins/ai_sandbox_boundary_review_spec.rb +57 -0
- data/spec/lib/pwn/plugins/ai_sandbox_spec.rb +10 -18
- data/spec/lib/pwn/plugins/android_review_fixes_spec.rb +121 -0
- data/spec/lib/pwn/plugins/android_transport_audit_spec.rb +64 -0
- data/spec/lib/pwn/plugins/api_import_namespace_audit_spec.rb +49 -0
- data/spec/lib/pwn/plugins/artifact_registry_namespace_audit_spec.rb +20 -0
- data/spec/lib/pwn/plugins/artifact_registry_review_fixes_spec.rb +63 -0
- data/spec/lib/pwn/plugins/assembly_namespace_audit_spec.rb +16 -0
- data/spec/lib/pwn/plugins/assembly_review_fixes_spec.rb +33 -0
- data/spec/lib/pwn/plugins/authentication_helper_spec.rb +14 -0
- data/spec/lib/pwn/plugins/baresip_review_fixes_spec.rb +127 -0
- data/spec/lib/pwn/plugins/baresip_transport_audit_spec.rb +59 -0
- data/spec/lib/pwn/plugins/binary_analysis_process_review_spec.rb +57 -0
- data/spec/lib/pwn/plugins/black_duck_namespace_audit_spec.rb +25 -0
- data/spec/lib/pwn/plugins/burp_suite_har_review_fixes_spec.rb +60 -0
- data/spec/lib/pwn/plugins/burp_suite_import_review_fixes_spec.rb +62 -0
- data/spec/lib/pwn/plugins/burp_suite_namespace_audit_spec.rb +37 -0
- data/spec/lib/pwn/plugins/bus_pirate_transport_audit_spec.rb +19 -0
- data/spec/lib/pwn/plugins/file_fu_namespace_audit_spec.rb +17 -0
- data/spec/lib/pwn/plugins/findings_structured_spec.rb +1 -1
- data/spec/lib/pwn/plugins/gdbmi_namespace_audit_spec.rb +28 -0
- data/spec/lib/pwn/plugins/gdbmi_review_fixes_spec.rb +73 -0
- data/spec/lib/pwn/plugins/github_argv_review_spec.rb +49 -0
- data/spec/lib/pwn/plugins/google_workspace_provider_review_oauth_spec.rb +80 -0
- data/spec/lib/pwn/plugins/irc_review_fixes_spec.rb +92 -0
- data/spec/lib/pwn/plugins/irc_transport_audit_spec.rb +37 -0
- data/spec/lib/pwn/plugins/jenkins_namespace_audit_spec.rb +12 -0
- data/spec/lib/pwn/plugins/jira_data_center_namespace_audit_spec.rb +44 -0
- data/spec/lib/pwn/plugins/jira_data_center_review_fixes_spec.rb +81 -0
- data/spec/lib/pwn/plugins/jsonl_elf_review_fixes_spec.rb +59 -0
- data/spec/lib/pwn/plugins/log_spec.rb +36 -20
- data/spec/lib/pwn/plugins/monkey_patch_spec.rb +16 -0
- data/spec/lib/pwn/plugins/msr206_readback_review_fixes_spec.rb +119 -0
- data/spec/lib/pwn/plugins/msr206_review_fixes_spec.rb +50 -0
- data/spec/lib/pwn/plugins/msr206_transport_audit_spec.rb +64 -0
- data/spec/lib/pwn/plugins/nessus_cloud_namespace_audit_spec.rb +14 -0
- data/spec/lib/pwn/plugins/nexpose_review_fixes_spec.rb +55 -0
- data/spec/lib/pwn/plugins/open_api_namespace_audit_spec.rb +22 -0
- data/spec/lib/pwn/plugins/packet_transport_audit_spec.rb +47 -0
- data/spec/lib/pwn/plugins/plugins_b_operational_regression_spec.rb +600 -0
- data/spec/lib/pwn/plugins/pony_namespace_audit_spec.rb +17 -0
- data/spec/lib/pwn/plugins/pony_review_fixes_spec.rb +33 -0
- data/spec/lib/pwn/plugins/process_tube_namespace_audit_spec.rb +19 -0
- data/spec/lib/pwn/plugins/ps_namespace_audit_spec.rb +12 -0
- data/spec/lib/pwn/plugins/repl/ai_console_spec.rb +111 -0
- data/spec/lib/pwn/plugins/repl/ai_spec.rb +38 -0
- data/spec/lib/pwn/plugins/repl/mesh_spec.rb +52 -0
- data/spec/lib/pwn/plugins/sandbox_spec.rb +9 -7
- data/spec/lib/pwn/plugins/sbom_review_fixes_spec.rb +43 -0
- data/spec/lib/pwn/plugins/scannable_codes_namespace_audit_spec.rb +15 -0
- data/spec/lib/pwn/plugins/serial_review_fixes_spec.rb +76 -0
- data/spec/lib/pwn/plugins/serial_transport_audit_spec.rb +102 -0
- data/spec/lib/pwn/plugins/shodan_namespace_audit_spec.rb +10 -0
- data/spec/lib/pwn/plugins/sock_transport_audit_spec.rb +55 -0
- data/spec/lib/pwn/plugins/transparent_browser_navigation_review_spec.rb +21 -0
- data/spec/lib/pwn/plugins/vault_master_key_eui_regression_spec.rb +242 -0
- data/spec/lib/pwn/plugins/vault_spec.rb +58 -0
- data/spec/lib/pwn/plugins/vault_store_safety_spec.rb +1 -1
- data/spec/lib/pwn/plugins/xxd_namespace_audit_spec.rb +34 -0
- data/spec/lib/pwn/plugins/yubikey_hid_cleanup_review_fixes_spec.rb +52 -0
- data/spec/lib/pwn/plugins/yubikey_lifecycle_audit_spec.rb +65 -0
- data/spec/lib/pwn/plugins/yubikey_options_audit_spec.rb +30 -0
- data/spec/lib/pwn/plugins/yubikey_selector_audit_spec.rb +26 -0
- data/spec/lib/pwn/plugins/yubikey_spec.rb +1 -1
- data/spec/lib/pwn/plugins/zaproxy_namespace_audit_spec.rb +30 -0
- data/spec/lib/pwn/reports/empty_report_audit_spec.rb +18 -0
- data/spec/lib/pwn/reports/pdf_spec.rb +25 -0
- data/spec/lib/pwn/reports/provider_review_encoding_regression_spec.rb +45 -0
- data/spec/lib/pwn/sast/engine_runtime_regression_spec.rb +91 -0
- data/spec/lib/pwn/sast/filter_edge_regression_spec.rb +39 -0
- data/spec/lib/pwn/sast/formatter_review_fixes_spec.rb +178 -0
- data/spec/lib/pwn/sast/path_review_fixes_spec.rb +60 -0
- data/spec/lib/pwn/sast/pom_runtime_regression_spec.rb +37 -0
- data/spec/lib/pwn/sast/rules_runtime_regression_spec.rb +78 -0
- data/spec/lib/pwn/sast/sql_review_fixes_spec.rb +38 -0
- data/spec/lib/pwn/sdr/decoder/base_iq_spec.rb +21 -18
- data/spec/lib/pwn/sdr/decoder/base_review_fixes_spec.rb +49 -0
- data/spec/lib/pwn/sdr/decoder/base_validation_spec.rb +78 -0
- data/spec/lib/pwn/sdr/decoder/lora_spec.rb +9 -0
- data/spec/lib/pwn/sdr/flipper_zero_review_fixes_spec.rb +34 -0
- data/spec/lib/pwn/sdr/gqrx_operational_spec.rb +83 -0
- data/spec/lib/pwn/sdr/gqrx_review_fixes_spec.rb +22 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_review_fixes_spec.rb +113 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_serial_review_fixes_spec.rb +76 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_spec.rb +39 -0
- data/spec/lib/pwn/sdr_spec.rb +5 -0
- data/spec/lib/pwn/session_cleanup_default_spec.rb +1 -1
- data/spec/lib/pwn/session_cleanup_lifecycle_supplement_spec.rb +39 -0
- data/spec/lib/pwn/session_cleanup_payload_spec.rb +3 -2
- data/spec/lib/pwn/session_trace_lifecycle_supplement_spec.rb +39 -0
- data/spec/lib/pwn/sessions_archive_closure_spec.rb +126 -0
- data/spec/lib/pwn/sessions_lifecycle_closure_spec.rb +373 -0
- data/spec/lib/pwn/sessions_lifecycle_supplement_spec.rb +204 -0
- data/spec/lib/pwn/setup_operational_regression_spec.rb +36 -0
- data/spec/lib/pwn/www/browser_review_fixes_spec.rb +70 -0
- data/spec/lib/pwn/www/browser_runtime_regression_spec.rb +100 -0
- data/spec/lib/pwn/www/hacker_one_runtime_regression_spec.rb +146 -0
- data/spec/lib/pwn/www/pagination_review_fixes_spec.rb +84 -0
- data/spec/support/namespace_controller_observability_fixture.rb +141 -0
- data/spec/support/sandbox.rb +8 -5
- data/third_party/pwn_rdoc.jsonl +73 -31
- metadata +137 -18
- data/etc/default_skills/pwn/aws/elastic_transcoder/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/lambda_preview/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/ops_works/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/ops_works_cm/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/sms/SKILL.md +0 -48
- data/lib/pwn/aws/elastic_transcoder.rb +0 -95
- data/lib/pwn/aws/lambda_preview.rb +0 -95
- data/lib/pwn/aws/ops_works.rb +0 -95
- data/lib/pwn/aws/ops_works_cm.rb +0 -95
- data/lib/pwn/aws/sms.rb +0 -95
- data/spec/lib/pwn/aws/elastic_transcoder_spec.rb +0 -15
- data/spec/lib/pwn/aws/lambda_preview_spec.rb +0 -15
- data/spec/lib/pwn/aws/ops_works_cm_spec.rb +0 -15
- data/spec/lib/pwn/aws/ops_works_spec.rb +0 -15
- data/spec/lib/pwn/aws/sms_spec.rb +0 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 32b81de8ec15d62449ac8f8894ae59adb2aff049f42e9fa7d5eafcaf172edea1
|
|
4
|
+
data.tar.gz: 5a4a451600653d08a64288b559ad54829755ad30c5f5dde538087cfc8cbd29f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b87c67abeb39e314cc040e2f186d9e08f5c04520540a25526f376792ac5d7f7081281b4901aa7ef0e7b0c4c3e1ff4afd2f88005d65ccc0692e7ea653049fffde
|
|
7
|
+
data.tar.gz: ba2a8e92e3318fa41df6821f74d62d2eb43e38a301fa3226b8a79468bb98f814046389adba32f9581ac3eb4d129d46a0418674d2ad829b9783f8d81bd5ea13a8
|
data/Gemfile
CHANGED
data/bin/pwn_autoinc_version
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
version_path = './lib/pwn/version.rb'
|
|
5
|
+
old_rev = File.read(version_path)[/^\s*VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]\s*$/, 1]
|
|
6
|
+
raise ArgumentError, 'Invalid checkout version' unless old_rev
|
|
5
7
|
|
|
6
|
-
old_rev = PWN::VERSION
|
|
7
|
-
readme_md_path = './README.md'
|
|
8
|
-
current_ruby = './.ruby-version'
|
|
9
8
|
placeholder_arr = old_rev.split('.')
|
|
10
9
|
major = placeholder_arr[0].to_i
|
|
11
10
|
minor = placeholder_arr[1].to_i
|
|
@@ -29,7 +28,7 @@ end
|
|
|
29
28
|
new_rev = placeholder_arr.join('.')
|
|
30
29
|
|
|
31
30
|
puts "Upgrading to #{new_rev}..."
|
|
32
|
-
File.open(
|
|
31
|
+
File.open(version_path, 'w') do |f|
|
|
33
32
|
f.puts '# frozen_string_literal: true'
|
|
34
33
|
f.puts "\n"
|
|
35
34
|
f.puts 'module PWN'
|
data/bin/pwn_web_cache_deception
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require 'pwn'
|
|
5
|
+
require 'uri'
|
|
6
|
+
require 'English'
|
|
5
7
|
|
|
6
8
|
opts = PWN::Env[:driver_opts]
|
|
7
9
|
PWN::Driver::Parser.new do |options|
|
|
@@ -45,7 +47,7 @@ PWN::Driver::Parser.new do |options|
|
|
|
45
47
|
opts[:yubikey_serial] = serial
|
|
46
48
|
end
|
|
47
49
|
|
|
48
|
-
options.on('
|
|
50
|
+
options.on('--proxy=PROXY', '<Optional - HTTP or Socks Proxy || tor>') do |p|
|
|
49
51
|
opts[:proxy] = p
|
|
50
52
|
end
|
|
51
53
|
end.parse!
|
|
@@ -66,9 +68,27 @@ end
|
|
|
66
68
|
# Required Flag Variables
|
|
67
69
|
target_url = opts[:target_url].to_s.scrub.strip.chomp
|
|
68
70
|
output_results = opts[:output_results].to_s.scrub.strip.chomp
|
|
71
|
+
raise ArgumentError, '--target-url and --output-results are required' if target_url.empty? || output_results.empty?
|
|
72
|
+
|
|
73
|
+
begin
|
|
74
|
+
target_uri = URI.parse(target_url)
|
|
75
|
+
rescue URI::InvalidURIError
|
|
76
|
+
raise ArgumentError, 'Target URL must be an absolute HTTP or HTTPS URL'
|
|
77
|
+
end
|
|
78
|
+
raise ArgumentError, 'Target URL must be an absolute HTTP or HTTPS URL' unless %w[http https].include?(target_uri.scheme) && !target_uri.host.to_s.empty?
|
|
79
|
+
raise ArgumentError, 'Invalid output path' if output_results.include?("\0") || File.symlink?(output_results)
|
|
80
|
+
raise ArgumentError, 'Invalid output file or parent directory' unless File.directory?(File.dirname(output_results)) && File.writable?(File.dirname(output_results)) && (!File.exist?(output_results) || (File.file?(output_results) && File.writable?(output_results)))
|
|
69
81
|
|
|
70
82
|
# Optional Flag Variables
|
|
71
83
|
pwn_www_mod_str = opts[:pwn_www_mod_str].to_s.scrub.strip.chomp
|
|
84
|
+
unless pwn_www_mod_str.empty?
|
|
85
|
+
begin
|
|
86
|
+
pwn_www_mod = PWN::WWW.const_get(pwn_www_mod_str, false)
|
|
87
|
+
raise ArgumentError, "Module PWN::WWW::#{pwn_www_mod_str} requires open, login, logout and close" unless %i[open login logout close].all? { |method| pwn_www_mod.respond_to?(method) }
|
|
88
|
+
rescue NameError
|
|
89
|
+
raise ArgumentError, "Invalid module PWN::WWW::#{pwn_www_mod_str}"
|
|
90
|
+
end
|
|
91
|
+
end
|
|
72
92
|
|
|
73
93
|
username = opts[:username].to_s.scrub.strip.chomp
|
|
74
94
|
|
|
@@ -91,11 +111,7 @@ unless opts[:yubikey_account].nil?
|
|
|
91
111
|
end
|
|
92
112
|
|
|
93
113
|
password = opts[:password] # Don't cast to string to detect if PWN::Plugins::AuthenticationHelper is necessary
|
|
94
|
-
if password.nil?
|
|
95
|
-
password = PWN::Plugins::AuthenticationHelper.mask_password
|
|
96
|
-
else
|
|
97
|
-
password = opts[:password].to_s.scrub.strip.chomp
|
|
98
|
-
end
|
|
114
|
+
password = PWN::Plugins::AuthenticationHelper.mask_password if password.nil? && !pwn_www_mod_str.empty?
|
|
99
115
|
|
|
100
116
|
mfa = opts[:mfa] || false
|
|
101
117
|
|
|
@@ -113,7 +129,7 @@ begin
|
|
|
113
129
|
orig_url_response_length = browser.html.length
|
|
114
130
|
|
|
115
131
|
http_result = ''
|
|
116
|
-
if target_url.include?('?')
|
|
132
|
+
if target_url.include?('?') || target_url.include?('#')
|
|
117
133
|
injected_target_url = URI.parse(target_url)
|
|
118
134
|
# Add non-existent file at the end of the path
|
|
119
135
|
injected_target_url.path = "#{injected_target_url.path.to_s.chomp('/')}/wcd.#{payload}"
|
|
@@ -154,19 +170,6 @@ begin
|
|
|
154
170
|
|
|
155
171
|
# Script starts crunching here...
|
|
156
172
|
if pwn_www_mod_str != ''
|
|
157
|
-
begin
|
|
158
|
-
pwn_www_mod = PWN::WWW.const_get(pwn_www_mod_str)
|
|
159
|
-
unless pwn_www_mod.respond_to?('open') && pwn_www_mod.respond_to?('login') && pwn_www_mod.respond_to?('logout')
|
|
160
|
-
puts "#{@dark_red}Module PWN::WWW::#{pwn_www_mod_str} Missing #open #login and/or #logout Method(s)#{@end_of_color}"
|
|
161
|
-
puts `#{File.basename($PROGRAM_NAME)} -l`
|
|
162
|
-
exit
|
|
163
|
-
end
|
|
164
|
-
rescue NAME_ERROR => e
|
|
165
|
-
puts "#{@dark_red}Invalid module PWN::WWW::#{pwn_www_mod_str}#{@end_of_color}"
|
|
166
|
-
puts `#{File.basename($PROGRAM_NAME)} -l`
|
|
167
|
-
exit
|
|
168
|
-
end
|
|
169
|
-
|
|
170
173
|
puts "#{@green}Leveraging PWN::WWW::#{pwn_www_mod_str} to Obtain a Post AuhN State...#{@end_of_color}"
|
|
171
174
|
if proxy
|
|
172
175
|
browser_obj = pwn_www_mod.open(
|
|
@@ -177,6 +180,7 @@ begin
|
|
|
177
180
|
browser_obj = pwn_www_mod.open(browser_type: :chrome)
|
|
178
181
|
end
|
|
179
182
|
# Now AuthN via PWN::WWW::<MODULE>
|
|
183
|
+
owned_browser = browser_obj
|
|
180
184
|
login_opts = {
|
|
181
185
|
browser_obj: browser_obj,
|
|
182
186
|
username: username,
|
|
@@ -195,6 +199,7 @@ begin
|
|
|
195
199
|
browser_obj = PWN::Plugins::TransparentBrowser.open(browser_type: :chrome)
|
|
196
200
|
end
|
|
197
201
|
|
|
202
|
+
owned_browser ||= browser_obj
|
|
198
203
|
browser = browser_obj[:browser]
|
|
199
204
|
|
|
200
205
|
puts "#{@green}Navigating to Target URL: #{target_url}#{@end_of_color}\n\n\n"
|
|
@@ -220,14 +225,20 @@ begin
|
|
|
220
225
|
rescue StandardError => e
|
|
221
226
|
raise e
|
|
222
227
|
ensure
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
228
|
+
primary_error = $ERROR_INFO
|
|
229
|
+
cleanup_error = nil
|
|
230
|
+
if owned_browser
|
|
231
|
+
begin
|
|
232
|
+
pwn_www_mod&.logout(browser_obj: owned_browser)
|
|
233
|
+
rescue StandardError => e
|
|
234
|
+
cleanup_error = e
|
|
235
|
+
ensure
|
|
236
|
+
begin
|
|
237
|
+
(pwn_www_mod || PWN::Plugins::TransparentBrowser).close(browser_obj: owned_browser)
|
|
238
|
+
rescue StandardError => e
|
|
239
|
+
cleanup_error ||= e
|
|
240
|
+
end
|
|
241
|
+
end
|
|
232
242
|
end
|
|
243
|
+
raise cleanup_error if cleanup_error && !primary_error
|
|
233
244
|
end
|
data/documentation/AWS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# `PWN::AWS` - Cloud Security (
|
|
1
|
+
# `PWN::AWS` - Cloud Security (85 service wrappers)
|
|
2
2
|
|
|
3
3
|
One thin module per AWS service, each wrapping the official `aws-sdk-*` gem
|
|
4
4
|
with the PWN `opts = {}` convention so they compose in the REPL and in
|
|
@@ -30,7 +30,7 @@ CLI: `pwn_aws_describe_resources -r us-east-1 -c /path/to/private-aws.yaml`
|
|
|
30
30
|
| Group | Modules |
|
|
31
31
|
|---|---|
|
|
32
32
|
| Identity | `IAM` `STS` `CognitoIdentity` `CognitoIdentityProvider` `CognitoSync` `DirectoryService` |
|
|
33
|
-
| Compute | `EC2` `ECS` `ECR` `Lambda` `
|
|
33
|
+
| Compute | `EC2` `ECS` `ECR` `Lambda` `Batch` `Lightsail` `ElasticBeanstalk` `AutoScaling` `ApplicationAutoScaling` `AppStream` |
|
|
34
34
|
| Storage | `S3` `Glacier` `EFS` `StorageGateway` `Snowball` |
|
|
35
35
|
| Data | `DynamoDB` `DynamoDBStreams` `RDS` `Redshift` `ElastiCache` `SimpleDB` `ElasticsearchService` |
|
|
36
36
|
| Network | `Route53` `Route53Domains` `ElasticLoadBalancing` `ElasticLoadBalancingV2` `APIGateway` `CloudFront` `DirectConnect` `WAF` `WAFRegional` `Shield` |
|
|
@@ -38,9 +38,19 @@ CLI: `pwn_aws_describe_resources -r us-east-1 -c /path/to/private-aws.yaml`
|
|
|
38
38
|
| Ops / Logs | `CloudTrail` `CloudWatch` `CloudWatchLogs` `CloudWatchEvents` `ConfigService` `SSM` `Health` `Inspector` `XRay` |
|
|
39
39
|
| Dev | `CodeBuild` `CodeCommit` `CodeDeploy` `CodePipeline` |
|
|
40
40
|
| Messaging | `SNS` `SQS` `SES` `Pinpoint` `Kinesis` `KinesisAnalytics` `Firehose` |
|
|
41
|
-
| ML / Media | `Rekognition` `Polly` `MachineLearning` `Lex`
|
|
42
|
-
| Infra | `CloudFormation` `CloudSearch` `CloudSearchDomain` `
|
|
43
|
-
| IoT / Other | `IoT` `IoTDataPlane` `DeviceFarm` `GameLift` `Workspaces` `Support` `Budgets` `ImportExport` `
|
|
41
|
+
| ML / Media | `Rekognition` `Polly` `MachineLearning` `Lex` |
|
|
42
|
+
| Infra | `CloudFormation` `CloudSearch` `CloudSearchDomain` `ServiceCatalog` `DataPipleline` `EMR` `SWF` `States` |
|
|
43
|
+
| IoT / Other | `IoT` `IoTDataPlane` `DeviceFarm` `GameLift` `Workspaces` `Support` `Budgets` `ImportExport` `DatabaseMigrationService` `ApplicationDiscoveryService` `MarketplaceCommerceAnalytics` `MarketplaceMetering` |
|
|
44
|
+
|
|
45
|
+
## Removed legacy wrappers
|
|
46
|
+
|
|
47
|
+
`ElasticTranscoder`, `LambdaPreview`, `OpsWorks`, `OpsWorksCM` and `SMS`
|
|
48
|
+
are no longer exported by PWN. Their source, module skills and obsolete
|
|
49
|
+
metadata-only specs have been removed rather than advertising unavailable
|
|
50
|
+
clients. Use `PWN::AWS::Lambda` for the current Lambda client; other service
|
|
51
|
+
migrations require explicit API changes, not silent aliases. See the
|
|
52
|
+
[AWS service shutdown list](https://docs.aws.amazon.com/general/latest/gr/full_shutdown_services.html)
|
|
53
|
+
for the retired Elastic Transcoder, OpsWorks and Server Migration services.
|
|
44
54
|
|
|
45
55
|
## Offensive patterns
|
|
46
56
|
|
data/documentation/Diagrams.md
CHANGED
|
@@ -142,7 +142,7 @@ operations. See [Operability](Operability.md).
|
|
|
142
142
|
|
|
143
143
|
## 5 · Domain-Specific
|
|
144
144
|
|
|
145
|
-
### AWS Cloud Security (
|
|
145
|
+
### AWS Cloud Security (85 services)
|
|
146
146
|
[source](diagrams/dot/aws-cloud-security.dot) · doc: [AWS](AWS.md)
|
|
147
147
|

|
|
148
148
|
|
data/documentation/Home.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **PWN** (/pōn/) - an open-source offensive-security automation framework and
|
|
4
4
|
> continuous-security-integration platform written in Ruby.
|
|
5
|
-
> 108 plugins · 48 SAST modules ·
|
|
5
|
+
> 108 plugins · 48 SAST modules · 85 AWS wrappers · 22 WWW drivers · 56 CLI
|
|
6
6
|
> executables · 6 LLM engines · a self-improving multi-agent AI · one REPL.
|
|
7
7
|
|
|
8
8
|
**Repo root:** `/opt/pwn` · **This wiki:** `/opt/pwn/documentation/` ·
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
| ↳ [YubiKey](YubiKey.md) | Device management, hardware vaults and OATH MFA |
|
|
62
62
|
| [SAST (48 rules)](SAST.md) | Static analysis + test-case engine |
|
|
63
63
|
| [WWW (22 drivers)](WWW.md) | Browser automations for real sites |
|
|
64
|
-
| [AWS (
|
|
64
|
+
| [AWS (85 services)](AWS.md) | Cloud-security enumeration |
|
|
65
65
|
| [SDR](SDR.md) | GQRX · FlipperZero · RFIDler · SonMicro · **Decoder::* (21 protocols + Base/DSP)** · FFI-accelerated DSP |
|
|
66
66
|
| [Blockchain](Blockchain.md) | BTC · ETH helpers |
|
|
67
67
|
| [Bounty](Bounty.md) | Lifecycle / auth-replay tooling |
|
|
@@ -44,7 +44,7 @@ call, and [Reinforcement Learning](Reinforcement-Learning.md) for how
|
|
|
44
44
|
|
|
45
45
|
## L3 - Capability namespaces (`lib/pwn/*`)
|
|
46
46
|
|
|
47
|
-
`Plugins` (108) · `SAST` (48) · `WWW` (22) · `AWS` (
|
|
47
|
+
`Plugins` (108) · `SAST` (48) · `WWW` (22) · `AWS` (85) · `SDR` · `Blockchain` ·
|
|
48
48
|
`Bounty` · `Reports` · `FFI` · `Banner` · **`Setup`** · **`Migrate`**. First launch also seeds bundled skills from `etc/default_skills/`. Each is
|
|
49
49
|
a plain module of `public_class_method def self.x(opts = {})` methods -
|
|
50
50
|
callable the same way from the REPL, from `pwn_eval`, or from a driver.
|
|
@@ -14,7 +14,7 @@ with a **tool-calling AI agent** on top that can run the same methods.
|
|
|
14
14
|
|---|---|---|
|
|
15
15
|
| `PWN::Plugins::*` | **108** | Wrappers for external and native tooling (Burp, Nmap, Metasploit, Shodan, browsers, serial, YubiKey, ...) |
|
|
16
16
|
| `PWN::SAST::*` | **48** | Static-analysis rules across C/Java/Go/Python/Ruby/Scala/PHP/TS |
|
|
17
|
-
| `PWN::AWS::*` | **
|
|
17
|
+
| `PWN::AWS::*` | **85** | One module per AWS service for cloud enumeration |
|
|
18
18
|
| `PWN::WWW::*` | **22** | Site-specific browser automations (HackerOne, BugCrowd, GitHub, Google, LinkedIn, ...) |
|
|
19
19
|
| `PWN::SDR::*` | **6** (+ **21** protocol decoders + Base/DSP) | GQRX, FlipperZero, RFIDler, SonMicro, band tables, `Decoder::{ADSB,POCSAG,RDS,LoRa,...}` |
|
|
20
20
|
| `PWN::FFI::*` | **11** | Native bindings (including DSPNative, Capstone and Keystone): Volk · Liquid · FFTW · RTLSdr · HackRF · AdalmPluto · SoapySDR · Stdio |
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(43.2 311.2)">
|
|
10
10
|
<title>PWN_AWS</title>
|
|
11
11
|
<polygon fill="#0f172a" stroke="none" points="-43.2,43.2 -43.2,-311.2 1021.2,-311.2 1021.2,43.2 -43.2,43.2"/>
|
|
12
|
-
<text xml:space="preserve" text-anchor="start" x="253.12" y="-246" font-family="sans-Serif" font-weight="bold" font-size="20.00" fill="#e2e8f0">PWN::AWS - Cloud Security (
|
|
12
|
+
<text xml:space="preserve" text-anchor="start" x="253.12" y="-246" font-family="sans-Serif" font-weight="bold" font-size="20.00" fill="#e2e8f0">PWN::AWS - Cloud Security (85 service wrappers)</text>
|
|
13
13
|
<text xml:space="preserve" text-anchor="start" x="379.12" y="-234.55" font-family="sans-Serif" font-size="11.00" fill="#94a3b8">enumerate → misconfig → escalate → persist</text>
|
|
14
14
|
<g id="clust1" class="cluster">
|
|
15
15
|
<title>cluster_enum</title>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
digraph "PWN_AWS" {
|
|
2
2
|
graph [
|
|
3
|
-
label=<<B>PWN::AWS - Cloud Security (
|
|
3
|
+
label=<<B>PWN::AWS - Cloud Security (85 service wrappers)</B><BR/><FONT POINT-SIZE="11" COLOR="#94a3b8">enumerate → misconfig → escalate → persist</FONT>>,
|
|
4
4
|
labelloc=t, fontsize=20, fontname="Helvetica",
|
|
5
5
|
rankdir=LR, splines=spline, nodesep=0.4, ranksep=1.2,
|
|
6
6
|
bgcolor="#0f172a", fontcolor="#e2e8f0", pad=0.6, newrank=true
|
|
@@ -34,7 +34,7 @@ digraph "PWN_Network" {
|
|
|
34
34
|
subgraph cluster_cloud {
|
|
35
35
|
label="Cloud / CI"; fontcolor="#ddd6fe"; style=rounded;
|
|
36
36
|
color="#6d28d9"; bgcolor="#2e1065";
|
|
37
|
-
AWS [label="PWN::AWS::*\
|
|
37
|
+
AWS [label="PWN::AWS::*\n85 services", fillcolor="#c4b5fd"];
|
|
38
38
|
Jenk [label="Plugins::Jenkins\nvSphere · Vault", fillcolor="#c4b5fd"];
|
|
39
39
|
}
|
|
40
40
|
Report [label="Reports · DefectDojo", fillcolor="#7dd3fc"];
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
<title>AWS</title>
|
|
141
141
|
<path fill="#c4b5fd" stroke="#334155" stroke-width="1.3" d="M872.38,-52C872.38,-52 818.12,-52 818.12,-52 812.12,-52 806.12,-46 806.12,-40 806.12,-40 806.12,-28 806.12,-28 806.12,-22 812.12,-16 818.12,-16 818.12,-16 872.38,-16 872.38,-16 878.38,-16 884.38,-22 884.38,-28 884.38,-28 884.38,-40 884.38,-40 884.38,-46 878.38,-52 872.38,-52"/>
|
|
142
142
|
<text xml:space="preserve" text-anchor="middle" x="845.25" y="-36.5" font-family="sans-Serif" font-size="10.00" fill="#0f172a">PWN::AWS::*</text>
|
|
143
|
-
<text xml:space="preserve" text-anchor="middle" x="845.25" y="-24.5" font-family="sans-Serif" font-size="10.00" fill="#0f172a">
|
|
143
|
+
<text xml:space="preserve" text-anchor="middle" x="845.25" y="-24.5" font-family="sans-Serif" font-size="10.00" fill="#0f172a">85 services</text>
|
|
144
144
|
</g>
|
|
145
145
|
<!-- MSF->AWS -->
|
|
146
146
|
<g id="edge9" class="edge">
|
|
@@ -954,7 +954,7 @@ module PWN
|
|
|
954
954
|
next unless File.file?(backup_path)
|
|
955
955
|
raise IOError, 'Invalid session recovery backup' unless verified_backup?(backup_path, info['sha256'])
|
|
956
956
|
|
|
957
|
-
path = name.end_with?('.meta.json') ? PWN::Sessions.support_path(kind: :metadata, session_id: id) : File.join(PWN::Sessions.sessions_dir, name)
|
|
957
|
+
path = name.end_with?('.meta.json') ? PWN::Sessions.support_path(kind: :metadata, session_id: id, read_only: dry_run) : File.join(PWN::Sessions.sessions_dir(read_only: dry_run), name)
|
|
958
958
|
next if verified_backup?(path, info['sha256'])
|
|
959
959
|
raise IOError, 'Refusing existing recovery destination' if File.exist?(path) || File.symlink?(path)
|
|
960
960
|
next if dry_run
|
|
@@ -1054,7 +1054,7 @@ module PWN
|
|
|
1054
1054
|
end
|
|
1055
1055
|
|
|
1056
1056
|
def self.classify(path, id)
|
|
1057
|
-
return :unknown unless path == File.join(PWN::Sessions
|
|
1057
|
+
return :unknown unless path == File.join(PWN::Sessions::SESSIONS_DIR, "#{id}.jsonl")
|
|
1058
1058
|
|
|
1059
1059
|
PWN::Sessions.title_status(session_id: id)[:classification]
|
|
1060
1060
|
end
|
|
@@ -1139,7 +1139,7 @@ module PWN
|
|
|
1139
1139
|
|
|
1140
1140
|
# Fingerprints include inode identity and nanosecond timestamps, not bodies.
|
|
1141
1141
|
def self.snapshot(path)
|
|
1142
|
-
[path, PWN::Sessions.support_path(kind: :metadata, session_id: File.basename(path, '.jsonl'))].to_h do |file|
|
|
1142
|
+
[path, PWN::Sessions.support_path(kind: :metadata, session_id: File.basename(path, '.jsonl'), read_only: true)].to_h do |file|
|
|
1143
1143
|
raise 'Refusing symlink' if File.symlink?(file)
|
|
1144
1144
|
next [File.basename(file), nil] unless File.exist?(file)
|
|
1145
1145
|
|
|
@@ -1264,28 +1264,11 @@ module PWN
|
|
|
1264
1264
|
end
|
|
1265
1265
|
|
|
1266
1266
|
def self.with_dependency_lock(id, dry_run: false)
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
raise 'Unresolved dependency remediation' unless rows.empty? || remediable?(id)
|
|
1271
|
-
|
|
1272
|
-
# Lock even absent stores: a concurrent writer can introduce the first
|
|
1273
|
-
# reference between the final index and unlink. These inodes are permanent.
|
|
1274
|
-
root = File.join(Dir.home, '.pwn')
|
|
1275
|
-
paths = %w[.learning-write.lock .swarm-continuations.lock memory.json.write.lock mistakes.json.write.lock].map { |name| File.join(root, name) }.sort
|
|
1276
|
-
locks = []
|
|
1277
|
-
begin
|
|
1278
|
-
paths.each do |path|
|
|
1279
|
-
owner = Thread.current[:pwn_learning_write_lock]
|
|
1280
|
-
next if File.basename(path) == '.learning-write.lock' && owner && owner[:pid] == Process.pid && owner[:thread] == Thread.current
|
|
1267
|
+
PWN::Sessions.with_dependency_locks(dry_run: dry_run) do
|
|
1268
|
+
rows = invalid_dependencies(id)
|
|
1269
|
+
raise 'Unresolved dependency remediation' unless rows.empty? || remediable?(id)
|
|
1281
1270
|
|
|
1282
|
-
lock = File.open(path, File::RDWR | File::CREAT | File::NOFOLLOW, 0o600) # rubocop:disable Style/FileOpen -- closed together in ensure
|
|
1283
|
-
locks << lock
|
|
1284
|
-
raise 'Dependency writer active' unless lock.flock(File::LOCK_EX | File::LOCK_NB)
|
|
1285
|
-
end
|
|
1286
1271
|
yield
|
|
1287
|
-
ensure
|
|
1288
|
-
locks.reverse_each(&:close)
|
|
1289
1272
|
end
|
|
1290
1273
|
end
|
|
1291
1274
|
|
|
@@ -1369,6 +1352,22 @@ module PWN
|
|
|
1369
1352
|
(control.respond_to?(:stopping?) && control.stopping?) || (budget && (budget[:remaining] <= 0 || budget[:bytes] <= 0 || Process.clock_gettime(Process::CLOCK_MONOTONIC) >= budget[:deadline]))
|
|
1370
1353
|
end
|
|
1371
1354
|
|
|
1355
|
+
# Child receipts may contain prepared per-file records even if their own
|
|
1356
|
+
# envelope missed the failure. Do not promote any such work to committed.
|
|
1357
|
+
def self.maintenance_incomplete?(value)
|
|
1358
|
+
case value
|
|
1359
|
+
when Hash
|
|
1360
|
+
state = value[:state] || value['state']
|
|
1361
|
+
%w[prepared interrupted blocked].include?(state.to_s) ||
|
|
1362
|
+
%i[incomplete aborted apply_blocked].any? { |key| value[key] == true || value[key.to_s] == true } ||
|
|
1363
|
+
value.any? { |key, child| !%w[usage diagnostics].include?(key.to_s) && maintenance_incomplete?(child) }
|
|
1364
|
+
when Array
|
|
1365
|
+
value.any? { |child| maintenance_incomplete?(child) }
|
|
1366
|
+
else
|
|
1367
|
+
false
|
|
1368
|
+
end
|
|
1369
|
+
end
|
|
1370
|
+
|
|
1372
1371
|
# Fresh schedules use one coordinator. Existing split jobs keep maintain
|
|
1373
1372
|
# until an operator explicitly replaces their schedules after deployment.
|
|
1374
1373
|
# Preserve evidence before retention can remove its last source edge.
|
|
@@ -1383,14 +1382,23 @@ module PWN
|
|
|
1383
1382
|
begin
|
|
1384
1383
|
maintenance = maintain(dry_run: dry_run, current_session_id: current_session_id, proc_root: proc_root)
|
|
1385
1384
|
result[:phases][:maintenance] = maintenance
|
|
1386
|
-
if maintenance[:apply_blocked] || maintenance
|
|
1385
|
+
if maintenance[:apply_blocked] || (!dry_run && maintenance_incomplete?(maintenance)) || stopping?
|
|
1387
1386
|
result[:state] = maintenance[:apply_blocked] ? 'blocked' : 'interrupted'
|
|
1388
1387
|
else
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1388
|
+
phases = {
|
|
1389
|
+
memory_consolidation: -> { dry_run ? { planned: true } : PWN::AI::Agent::Learning.consolidate },
|
|
1390
|
+
learning_retention: -> { PWN::AI::Agent::Learning.prune_outcomes!(dry_run: dry_run) },
|
|
1391
|
+
# The legacy Mistakes preview acquires a creating writer lock.
|
|
1392
|
+
mistakes_retention: -> { dry_run ? { planned: true } : PWN::AI::Agent::Mistakes.lean!(dry_run: false) },
|
|
1393
|
+
policy_retention: -> { PWN::AI::Agent::Policy.lean!(dry_run: dry_run) }
|
|
1394
|
+
}
|
|
1395
|
+
phases.each do |name, operation|
|
|
1396
|
+
break if stopping? || (!dry_run && maintenance_incomplete?(result[:phases]))
|
|
1397
|
+
|
|
1398
|
+
result[:phases][name] = operation.call
|
|
1399
|
+
end
|
|
1393
1400
|
result[:state] = dry_run ? 'planned' : 'committed'
|
|
1401
|
+
result[:state] = 'interrupted' if stopping? || (!dry_run && maintenance_incomplete?(result[:phases]))
|
|
1394
1402
|
end
|
|
1395
1403
|
result[:transaction_ledger] = ledger if ledger
|
|
1396
1404
|
publish(ledger, JSON.generate(result)) if ledger
|
|
@@ -1417,18 +1425,23 @@ module PWN
|
|
|
1417
1425
|
end
|
|
1418
1426
|
begin
|
|
1419
1427
|
result = maintenance_transaction(dry_run: dry_run, current_session_id: current_session_id, proc_root: proc_root)
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1428
|
+
phases = {
|
|
1429
|
+
storage: -> { clean_disposables(dry_run: dry_run) },
|
|
1430
|
+
quarantine: -> { prune_quarantine(dry_run: dry_run) },
|
|
1431
|
+
atomic_temps: -> { recover_atomic_temps(dry_run: dry_run, expired_only: true) },
|
|
1432
|
+
legacy_backups: -> { prune_legacy_backups(dry_run: dry_run) },
|
|
1433
|
+
migration_backups: -> { PWN::Migrate.prune_backups(dry_run: dry_run, admission: method(:admit?)) }
|
|
1434
|
+
}
|
|
1435
|
+
phases.each do |name, operation|
|
|
1436
|
+
break if stopping? || (!dry_run && maintenance_incomplete?(result))
|
|
1437
|
+
|
|
1438
|
+
result[name] = operation.call
|
|
1425
1439
|
end
|
|
1426
|
-
result[:migration_backups] = PWN::Migrate.prune_backups(dry_run: dry_run || result[:apply_blocked] == true, admission: method(:admit?)) unless stopping?
|
|
1427
1440
|
result[:usage] = status unless stopping?
|
|
1428
|
-
result[:incomplete] = true if stopping? || result[:
|
|
1441
|
+
result[:incomplete] = true if stopping? || (!dry_run && maintenance_incomplete?(result) && !result[:apply_blocked])
|
|
1429
1442
|
result[:state] = if dry_run
|
|
1430
1443
|
'planned'
|
|
1431
|
-
elsif result[:incomplete]
|
|
1444
|
+
elsif result[:incomplete]
|
|
1432
1445
|
'interrupted'
|
|
1433
1446
|
elsif result[:apply_blocked]
|
|
1434
1447
|
'blocked'
|
|
@@ -1479,7 +1492,7 @@ module PWN
|
|
|
1479
1492
|
return preflight.merge(incomplete: true, apply_blocked: true) if stopping?
|
|
1480
1493
|
|
|
1481
1494
|
migration = PWN::AI::Agent::Learning.migrate_evidence(dry_run: dry_run || blocked, max_sessions: policy['batch_size'], stop: method(:stopping?), nonblocking: true)
|
|
1482
|
-
blocked = true if migration[:deferred]
|
|
1495
|
+
blocked = true if migration[:deferred] || (!dry_run && maintenance_incomplete?(migration))
|
|
1483
1496
|
result = if dry_run || blocked
|
|
1484
1497
|
preflight
|
|
1485
1498
|
else
|
|
@@ -1488,11 +1501,15 @@ module PWN
|
|
|
1488
1501
|
result[:dry_run] = dry_run
|
|
1489
1502
|
result[:apply_blocked] = true if blocked
|
|
1490
1503
|
result[:evidence_migration] = migration
|
|
1491
|
-
result[:remaining_sessions] = Dir.glob(File.join(PWN::Sessions
|
|
1504
|
+
result[:remaining_sessions] = Dir.glob(File.join(PWN::Sessions::SESSIONS_DIR, '*.jsonl')).length
|
|
1492
1505
|
result[:visible_sessions] = PWN::Sessions.list.length
|
|
1493
1506
|
if ledger
|
|
1494
1507
|
result[:maintenance_ledger] = ledger
|
|
1495
|
-
publish(ledger, JSON.pretty_generate(state:
|
|
1508
|
+
publish(ledger, JSON.pretty_generate(state: if result[:incomplete]
|
|
1509
|
+
'interrupted'
|
|
1510
|
+
else
|
|
1511
|
+
(blocked ? 'blocked' : 'committed')
|
|
1512
|
+
end, inventory: preflight, result: result))
|
|
1496
1513
|
end
|
|
1497
1514
|
result
|
|
1498
1515
|
end
|
|
@@ -1504,8 +1521,8 @@ module PWN
|
|
|
1504
1521
|
raise ArgumentError, 'All writers and schedulers must be stopped' unless dry_run || writers_stopped
|
|
1505
1522
|
|
|
1506
1523
|
with_maintenance_lock(dry_run: dry_run) do
|
|
1507
|
-
root = PWN::Sessions
|
|
1508
|
-
plan = Dir.children(root).sort.filter_map do |name|
|
|
1524
|
+
root = PWN::Sessions::SESSIONS_DIR
|
|
1525
|
+
plan = (File.directory?(root) ? Dir.children(root) : []).sort.filter_map do |name|
|
|
1509
1526
|
target = case name
|
|
1510
1527
|
when /\A\d{8}_\d{6}_[a-f0-9]{8}\.meta\.json\z/ then File.join('support', 'metadata', name)
|
|
1511
1528
|
when /\A\..+\.cleanup\.lock\z/ then File.join('support', 'leases', name)
|
|
@@ -1624,7 +1641,7 @@ module PWN
|
|
|
1624
1641
|
def self.sweep_transaction(dry_run:, current_session_id:, proc_root:, approved_candidates:)
|
|
1625
1642
|
raise 'Session cleanup requires the updated Sessions activity API; load the updated source or deploy it before running this helper' unless PWN::Sessions.respond_to?(:activate)
|
|
1626
1643
|
|
|
1627
|
-
root = PWN::Sessions
|
|
1644
|
+
root = PWN::Sessions::SESSIONS_DIR
|
|
1628
1645
|
raise 'Refusing symlinked session directory' if File.symlink?(root)
|
|
1629
1646
|
|
|
1630
1647
|
current = current_session_id || (PWN::Env.dig(:ai, :session_id) if defined?(PWN::Env))
|
|
@@ -1641,6 +1658,8 @@ module PWN
|
|
|
1641
1658
|
dependencies = references[:dependencies]
|
|
1642
1659
|
pins = dependencies.keys
|
|
1643
1660
|
Dir.glob(File.join(root, '*.jsonl')).each do |path|
|
|
1661
|
+
break if !dry_run && result[:incomplete]
|
|
1662
|
+
|
|
1644
1663
|
unless admit?
|
|
1645
1664
|
result[:incomplete] = true
|
|
1646
1665
|
break
|
|
@@ -1716,13 +1735,13 @@ module PWN
|
|
|
1716
1735
|
lock_path = PWN::Sessions.support_path(kind: :lease, session_id: id)
|
|
1717
1736
|
raise 'Refusing symlinked cleanup lock' if File.symlink?(lock_path)
|
|
1718
1737
|
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1738
|
+
with_dependency_lock(id) do
|
|
1739
|
+
File.open(lock_path, File::RDWR | File::CREAT | File::NOFOLLOW, 0o600) do |lock|
|
|
1740
|
+
unless lock.flock(File::LOCK_EX | File::LOCK_NB)
|
|
1741
|
+
result[:skipped][:locked] += 1
|
|
1742
|
+
record[:skip] = :locked
|
|
1743
|
+
next
|
|
1744
|
+
end
|
|
1726
1745
|
File.open(path, File::RDONLY | File::NOFOLLOW) do |transcript|
|
|
1727
1746
|
unless transcript.flock(File::LOCK_EX | File::LOCK_NB)
|
|
1728
1747
|
result[:skipped][:locked] += 1
|
|
@@ -1748,15 +1767,29 @@ module PWN
|
|
|
1748
1767
|
remove_invalid_dependencies(id, result)
|
|
1749
1768
|
raise 'Dependencies changed after remediation' unless pins_known? && !referenced_session_ids.include?(id) && invalid_dependencies(id).empty? && snapshot(path) == expected
|
|
1750
1769
|
|
|
1751
|
-
|
|
1770
|
+
progress = lambda do |deletion|
|
|
1771
|
+
deletion[:ledger] = File.join(result[:archive_dir], 'ledger.json')
|
|
1772
|
+
record[:deletion] = deletion
|
|
1773
|
+
result[:deleted_ids] |= [id] if deletion[:deleted_paths].include?(path)
|
|
1774
|
+
if deletion[:state] == 'interrupted'
|
|
1775
|
+
result[:state] = 'interrupted'
|
|
1776
|
+
result[:incomplete] = true
|
|
1777
|
+
end
|
|
1778
|
+
publish(deletion[:ledger], JSON.pretty_generate(result))
|
|
1779
|
+
end
|
|
1780
|
+
PWN::Sessions.delete(session_id: id, current_session_id: current, force: true, cleanup_lock: lock, deletion_progress: progress)
|
|
1752
1781
|
raise 'Deletion did not remove both session records' if File.exist?(path) || File.exist?(PWN::Sessions.support_path(kind: :metadata, session_id: id))
|
|
1753
1782
|
|
|
1754
|
-
result[:deleted_ids]
|
|
1783
|
+
result[:deleted_ids] |= [id]
|
|
1755
1784
|
record[:deleted] = true
|
|
1756
1785
|
publish(File.join(result[:archive_dir], 'ledger.json'), JSON.pretty_generate(result))
|
|
1757
1786
|
end
|
|
1758
1787
|
end
|
|
1759
1788
|
end
|
|
1789
|
+
rescue PWN::Sessions::PartialDeletion => e
|
|
1790
|
+
result[:state] = 'interrupted'
|
|
1791
|
+
result[:incomplete] = true
|
|
1792
|
+
record[:deletion] = e.result
|
|
1760
1793
|
rescue StandardError => e
|
|
1761
1794
|
result[:skipped][:error] += 1
|
|
1762
1795
|
record[:error] = e.class.name if record
|
data/lib/pwn/ai/agent/btc.rb
CHANGED
|
@@ -195,7 +195,7 @@ module PWN
|
|
|
195
195
|
{
|
|
196
196
|
practiced: results.length,
|
|
197
197
|
resolved: results.count { |r| r[:resolved] },
|
|
198
|
-
skipped_cooldown: cool.count { |_, v| v[:fail_nights].to_i >= COOLDOWN_FAIL_NIGHTS },
|
|
198
|
+
skipped_cooldown: cool.count { |_, v| (v[:fail_nights] || v['fail_nights']).to_i >= COOLDOWN_FAIL_NIGHTS },
|
|
199
199
|
skipped_parked: (defined?(Mistakes) && Mistakes.respond_to?(:operator_inbox) ? Mistakes.operator_inbox[:count] : 0),
|
|
200
200
|
operator_inbox: (defined?(Mistakes) && Mistakes.respond_to?(:operator_inbox) ? Mistakes.operator_inbox[:items] : []),
|
|
201
201
|
results: results,
|
|
@@ -971,7 +971,7 @@ module PWN
|
|
|
971
971
|
|
|
972
972
|
cool = opts[:cooldown] || {}
|
|
973
973
|
entry = cool[m[:signature].to_s] || cool[m[:signature].to_sym]
|
|
974
|
-
return true if entry && entry[:fail_nights].to_i >= COOLDOWN_FAIL_NIGHTS && (entry[:parked] || entry['parked'])
|
|
974
|
+
return true if entry && (entry[:fail_nights] || entry['fail_nights']).to_i >= COOLDOWN_FAIL_NIGHTS && (entry[:parked] || entry['parked'])
|
|
975
975
|
|
|
976
976
|
false
|
|
977
977
|
end
|
|
@@ -145,6 +145,7 @@ module PWN
|
|
|
145
145
|
raise
|
|
146
146
|
end
|
|
147
147
|
telemetry = finish_budget(budget: budget, result: result, elapsed: Process.clock_gettime(Process::CLOCK_MONOTONIC) - started)
|
|
148
|
+
eval_outcome = result.slice(:execution_success, :application_status) if entry.name == 'pwn_eval' && result.is_a?(Hash)
|
|
148
149
|
result = Result.page(value: result, entry: entry, session_id: opts[:session_id])
|
|
149
150
|
result = ToolGuard.quarantine_output(text: result) if defined?(ToolGuard) && result.is_a?(String) && ToolGuard.respond_to?(:quarantine_output)
|
|
150
151
|
note_taint(text: result)
|
|
@@ -159,12 +160,14 @@ module PWN
|
|
|
159
160
|
error: 'Vault redaction failed; result withheld. The tool already executed; verify its effects before retrying.')
|
|
160
161
|
end
|
|
161
162
|
response = { success: true, result: result, effect: effect(name: entry.name, args: args) }
|
|
163
|
+
response.merge!(eval_outcome) if eval_outcome
|
|
162
164
|
response[:success] = false if result.is_a?(Hash) && (result[:error] || result['error'] || result[:success] == false || result['success'] == false || result[:ok] == false || result['ok'] == false || (result.key?(:exit) && result[:exit] != 0) || (result.key?('exit') && result['exit'] != 0))
|
|
163
165
|
response[:budget] = telemetry if telemetry
|
|
164
166
|
if telemetry && telemetry[:remaining_s].zero?
|
|
165
167
|
response[:success] = false
|
|
166
168
|
response[:error] = 'budget_exhausted'
|
|
167
169
|
end
|
|
170
|
+
response[:informational_exit] = true if entry.name == 'shell' && Reward.semantic_ok(name: entry.name, raw: JSON.generate(Result.utf8_value(value: response)), args: args)[:benign]
|
|
168
171
|
JSON.generate(PWN::AI::Agent::Result.utf8_value(value: response))
|
|
169
172
|
rescue StandardError => e
|
|
170
173
|
JSON.generate(
|