pwn 0.5.795 → 0.5.798
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 +8 -8
- 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/Mission-Cancellation.md +6 -4
- data/documentation/Operability.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/etc/default_skills/pwn/ai/agent/mission_namespace/SKILL.md +6 -4
- 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 +16 -11
- data/lib/pwn/ai/agent/metrics.rb +1 -1
- data/lib/pwn/ai/agent/mission.rb +6 -3
- data/lib/pwn/ai/agent/mission_namespace.rb +70 -14
- 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/pwn_logger.rb +37 -1
- data/lib/pwn/plugins/repl/ai.rb +1 -0
- data/lib/pwn/plugins/repl/ai_console.rb +18 -6
- data/lib/pwn/plugins/repl/mesh.rb +51 -28
- 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 +310 -41
- 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/lib/pwn.rb +11 -0
- data/pwn.gemspec +4 -0
- data/spec/conventions_spec.rb +43 -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/harness_evaluation_spec.rb +22 -31
- data/spec/integration/harness_live_spec.rb +8 -18
- 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 +218 -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_schemer_regexp_parser_spec.rb +12 -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/module_skills_spec.rb +11 -1
- 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/pwn_logger_spec.rb +30 -0
- data/spec/lib/pwn/plugins/repl/ai_console_spec.rb +127 -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/repl_mesh_rx_errors_spec.rb +18 -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 +35 -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_concurrency_spec.rb +21 -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/spec_helper.rb +34 -5
- data/spec/support/namespace_controller_observability_fixture.rb +141 -0
- data/spec/support/sandbox.rb +8 -5
- data/third_party/pwn_rdoc.jsonl +83 -32
- metadata +7690 -7386
- 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
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'open3'
|
|
5
|
+
|
|
6
|
+
RSpec.describe 'EUI-LOGIC-001 acceptance through CLI, DAG, Dispatch, Registry and Mission' do
|
|
7
|
+
include_context 'pwn tmp sandbox'
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
allow(Dir).to receive(:home).and_return(@tmp)
|
|
11
|
+
stub_const('PWN::AI::Agent::TaskDAG::ROOT', File.join(@tmp, 'runs'))
|
|
12
|
+
stub_const('PWN::Plugins::ArtifactRegistry::ROOT', File.join(@tmp, 'artifacts'))
|
|
13
|
+
allow(PWN::Config).to receive(:refresh_env).and_return(PWN::Env)
|
|
14
|
+
@saved_runtime = Thread.current[:pwn_request_runtime]
|
|
15
|
+
Thread.current[:pwn_request_runtime] = nil
|
|
16
|
+
@agent_cfg[:artifact_max_tokens] = 1024
|
|
17
|
+
PWN::AI::Agent::Registry.discover
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
after do
|
|
21
|
+
Thread.current[:pwn_request_runtime] = @saved_runtime
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def approved_plan(path, paged)
|
|
25
|
+
checks = [{ type: 'file_grep', path: path, pattern: '\\Aaccepted\\z' }] * (paged ? 64 : 1)
|
|
26
|
+
steps = [
|
|
27
|
+
{ id: 'acceptance', tool: 'verify', args: { checks: checks } },
|
|
28
|
+
{ id: 'dependent', tool: 'verify', args: { checks: [{ type: 'file_exists', path: __FILE__ }] }, dependencies: ['acceptance'] }
|
|
29
|
+
]
|
|
30
|
+
dag = PWN::AI::Agent::TaskDAG.plan(request: 'Require this report before completion', steps: steps)
|
|
31
|
+
approval = File.join(@tmp, 'approved.yaml')
|
|
32
|
+
File.write(approval, YAML.dump(JSON.parse(JSON.generate(dag))))
|
|
33
|
+
PWN::AI::Agent::Mission.begin!(id: 'acceptance', request: dag[:request])
|
|
34
|
+
approval
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def cli_report(*arguments)
|
|
38
|
+
output = StringIO.new
|
|
39
|
+
status = PWN::AI::CLI.run(argv: [*arguments, '--mission', 'acceptance'], output: output)
|
|
40
|
+
[status, JSON.parse(output.string, symbolize_names: true)]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def checkpoints(report)
|
|
44
|
+
File.readlines(File.join(report[:dir], 'checkpoints.jsonl')).map { |line| JSON.parse(line, symbolize_names: true) }
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def acceptance_result(report, paged)
|
|
48
|
+
result = report[:results].first[:result]
|
|
49
|
+
if paged
|
|
50
|
+
artifact = result.fetch(:artifact)
|
|
51
|
+
bytes = File.binread(artifact[:path])
|
|
52
|
+
expect(Digest::SHA256.hexdigest(bytes)).to eq(artifact[:sha256])
|
|
53
|
+
expect(bytes.bytesize).to eq(artifact[:bytes])
|
|
54
|
+
full = JSON.parse(bytes, symbolize_names: true)
|
|
55
|
+
expect(result[:success]).to eq(full[:passed])
|
|
56
|
+
full
|
|
57
|
+
else
|
|
58
|
+
expect(result).not_to have_key(:artifact)
|
|
59
|
+
result
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
[false, true].each do |paged|
|
|
64
|
+
%w[missing mismatched].each do |condition|
|
|
65
|
+
it "blocks a #{condition} required check, retries and resumes after repair (paged=#{paged})" do
|
|
66
|
+
path = File.join(@tmp, 'required-report.txt')
|
|
67
|
+
File.write(path, 'not accepted') if condition == 'mismatched'
|
|
68
|
+
approval = approved_plan(path, paged)
|
|
69
|
+
status, report = cli_report('--execute', approval)
|
|
70
|
+
aggregate_failures do
|
|
71
|
+
expect(status).to eq(1)
|
|
72
|
+
expect(report[:ok]).to be(false)
|
|
73
|
+
expect(report[:results].map { |row| row[:id] }).to eq(['acceptance'])
|
|
74
|
+
expect(acceptance_result(report, paged)[:passed]).to be(false)
|
|
75
|
+
expect(checkpoints(report).map { |row| row[:status] }).to eq(['failed'])
|
|
76
|
+
expect(PWN::AI::Agent::Mission.complete!(id: 'acceptance')).to include(ok: false, reason: 'checkpoints')
|
|
77
|
+
expect(PWN::AI::Agent::Mission.done?(id: 'acceptance')).to be(false)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
retry_status, retry_report = cli_report('--resume', report[:run_id])
|
|
81
|
+
expect(retry_status).to eq(1)
|
|
82
|
+
expect(retry_report[:results].map { |row| row[:id] }).to eq(['acceptance'])
|
|
83
|
+
resumed = PWN::AI::Agent::Mission.resume_run(id: 'acceptance')
|
|
84
|
+
expect(resumed).to include(ok: false, resumed: true)
|
|
85
|
+
expect(resumed[:text]).to include('Failed steps: acceptance')
|
|
86
|
+
expect(resumed[:text]).not_to include('Completed steps: acceptance')
|
|
87
|
+
expect(PWN::AI::Agent::Mission.current(id: 'acceptance')[:last_completed_step]).to be_nil
|
|
88
|
+
expect(PWN::AI::Agent::Mission.done?(id: 'acceptance')).to be(false)
|
|
89
|
+
expect(checkpoints(report).map { |row| row[:status] }).to eq(%w[failed failed failed])
|
|
90
|
+
|
|
91
|
+
File.write(path, 'accepted')
|
|
92
|
+
fixed_status, fixed = cli_report('--resume', report[:run_id])
|
|
93
|
+
expect(fixed_status).to eq(0)
|
|
94
|
+
expect(fixed[:ok]).to be(true)
|
|
95
|
+
expect(fixed[:results].map { |row| row[:id] }).to eq(%w[acceptance dependent])
|
|
96
|
+
expect(acceptance_result(fixed, paged)[:passed]).to be(true)
|
|
97
|
+
expect(checkpoints(report).map { |row| row[:status] }).to eq(%w[failed failed failed completed completed])
|
|
98
|
+
completed = PWN::AI::Agent::Mission.resume_run(id: 'acceptance')
|
|
99
|
+
expect(completed).to include(ok: true, results: [])
|
|
100
|
+
expect(PWN::AI::Agent::Mission.done?(id: 'acceptance')).to be(true)
|
|
101
|
+
expect(checkpoints(report).map { |row| row[:status] }).to eq(%w[failed failed failed completed completed])
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it "completes a passing required check through the same entry point (paged=#{paged})" do
|
|
106
|
+
path = File.join(@tmp, 'required-report.txt')
|
|
107
|
+
File.write(path, 'accepted')
|
|
108
|
+
status, report = cli_report('--execute', approved_plan(path, paged))
|
|
109
|
+
expect(status).to eq(0)
|
|
110
|
+
expect(report[:ok]).to be(true)
|
|
111
|
+
expect(report[:results].map { |row| row[:id] }).to eq(%w[acceptance dependent])
|
|
112
|
+
expect(acceptance_result(report, paged)).to include(success: true, passed: true)
|
|
113
|
+
expect(checkpoints(report).map { |row| row[:status] }).to eq(%w[completed completed])
|
|
114
|
+
expect(PWN::AI::Agent::Mission.resume_run(id: 'acceptance')).to include(ok: true, results: [])
|
|
115
|
+
expect(PWN::AI::Agent::Mission.done?(id: 'acceptance')).to be(true)
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
it 'returns actual executable exit 1 on failed acceptance and exit 0 after a passing resume' do
|
|
120
|
+
stub_const('PWN::AI::Agent::Mission::ROOT', File.join(@tmp, '.pwn', 'missions'))
|
|
121
|
+
path = File.join(@tmp, 'required-report.txt')
|
|
122
|
+
approval = approved_plan(path, true)
|
|
123
|
+
preload = File.join(@tmp, 'offline-config.rb')
|
|
124
|
+
File.write(preload, <<~RUBY)
|
|
125
|
+
require 'pwn'
|
|
126
|
+
PWN::Config.define_singleton_method(:refresh_env) { |_opts = {}| PWN::Env }
|
|
127
|
+
PWN::Env[:ai] = { active: :ollama, module_reflection: false, agent: { artifact_max_tokens: 1024 } }
|
|
128
|
+
RUBY
|
|
129
|
+
command = [RbConfig.ruby, '-I', File.expand_path('../../lib', __dir__), '-r', preload, File.expand_path('../../bin/pwn-ai', __dir__)]
|
|
130
|
+
stdout, stderr, status = Open3.capture3({ 'HOME' => @tmp }, *command, '--execute', approval, '--mission', 'acceptance', chdir: @tmp)
|
|
131
|
+
expect(stderr).to be_empty
|
|
132
|
+
expect(status.exitstatus).to eq(1)
|
|
133
|
+
report = JSON.parse(stdout, symbolize_names: true)
|
|
134
|
+
expect(report[:ok]).to be(false)
|
|
135
|
+
expect(acceptance_result(report, true)).to include(success: false, passed: false)
|
|
136
|
+
expect(checkpoints(report).map { |row| row[:status] }).to eq(['failed'])
|
|
137
|
+
expect(PWN::AI::Agent::Mission.resume_run(id: 'acceptance')).to include(ok: false)
|
|
138
|
+
expect(PWN::AI::Agent::Mission.done?(id: 'acceptance')).to be(false)
|
|
139
|
+
|
|
140
|
+
File.write(path, 'accepted')
|
|
141
|
+
stdout, stderr, status = Open3.capture3({ 'HOME' => @tmp }, *command, '--resume', report[:run_id], '--mission', 'acceptance', chdir: @tmp)
|
|
142
|
+
expect(stderr).to be_empty
|
|
143
|
+
expect(status.exitstatus).to eq(0)
|
|
144
|
+
resumed = JSON.parse(stdout, symbolize_names: true)
|
|
145
|
+
expect(resumed[:results].map { |row| row[:id] }).to eq(%w[acceptance dependent])
|
|
146
|
+
expect(acceptance_result(resumed, true)).to include(success: true, passed: true)
|
|
147
|
+
expect(PWN::AI::Agent::Mission.resume_run(id: 'acceptance')).to include(ok: true, results: [])
|
|
148
|
+
expect(PWN::AI::Agent::Mission.done?(id: 'acceptance')).to be(true)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
it 'does not reinterpret an arbitrary tools passed field as the execution contract' do
|
|
152
|
+
registry = PWN::AI::Agent::Registry
|
|
153
|
+
entries = registry.instance_variable_get(:@entries).dup
|
|
154
|
+
registry.register(name: 'eui_domain_data', toolset: 'test', schema: { parameters: { type: 'object' } },
|
|
155
|
+
handler: ->(_args) { { passed: false, description: 'domain data, not an acceptance verdict' } })
|
|
156
|
+
response = JSON.parse(PWN::AI::Agent::Dispatch.call(tool_call: { function: { name: 'eui_domain_data', arguments: '{}' } }), symbolize_names: true)
|
|
157
|
+
expect(response).to include(success: true)
|
|
158
|
+
expect(response[:result]).to include(passed: false)
|
|
159
|
+
ensure
|
|
160
|
+
registry.instance_variable_set(:@entries, entries)
|
|
161
|
+
end
|
|
162
|
+
end
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'uri'
|
|
5
|
+
require 'net/http'
|
|
6
|
+
|
|
7
|
+
RSpec.describe 'web cache CLI lifecycle closure' do
|
|
8
|
+
include_context 'pwn tmp sandbox'
|
|
9
|
+
|
|
10
|
+
let(:script) { File.expand_path('../../bin/pwn_web_cache_deception', __dir__) }
|
|
11
|
+
let(:browser) { double('offline browser', goto: nil, html: '<html>fixture</html>') }
|
|
12
|
+
let(:handle) { { browser: browser } }
|
|
13
|
+
let(:password_field) { double('password field', set: nil) }
|
|
14
|
+
let(:args) do
|
|
15
|
+
['--target-url=https://example.invalid/path#section', "--output-results=#{File.join(@tmp, 'results.txt')}",
|
|
16
|
+
'--pwn-www-mod=GitHub', '--password= synthetic password ']
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
before do
|
|
20
|
+
allow(Dir).to receive(:home).and_return(@tmp)
|
|
21
|
+
stub_const('ARGV', args.dup)
|
|
22
|
+
allow(PWN::Env).to receive(:[]).and_call_original
|
|
23
|
+
allow(PWN::Env).to receive(:[]).with(:driver_opts).and_return({})
|
|
24
|
+
allow(PWN::Config).to receive(:refresh_env)
|
|
25
|
+
allow(PWN::Plugins::TransparentBrowser).to receive(:open).and_return(handle)
|
|
26
|
+
allow(PWN::Plugins::TransparentBrowser).to receive(:close).and_return(nil)
|
|
27
|
+
allow(PWN::Plugins::AuthenticationHelper).to receive(:mask_password).and_raise('unexpected credential prompt')
|
|
28
|
+
allow(password_field).to receive(:wait_until).and_return(password_field)
|
|
29
|
+
username = double('username field', set: nil)
|
|
30
|
+
allow(username).to receive(:wait_until).and_return(username)
|
|
31
|
+
button = double('submit button', exist?: true, click!: nil)
|
|
32
|
+
allow(button).to receive(:wait_until).and_return(button)
|
|
33
|
+
allow(browser).to receive(:text_field).with(name: 'login').and_return(username)
|
|
34
|
+
allow(browser).to receive(:text_field).with(name: 'password').and_return(password_field)
|
|
35
|
+
allow(browser).to receive(:input).with(name: 'commit').and_return(button)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
%w[target-url output-results].each do |flag|
|
|
39
|
+
it "R09 rejects missing #{flag} before opening or prompting" do
|
|
40
|
+
ARGV.reject! { |arg| arg.start_with?("--#{flag}=", '--password=') }
|
|
41
|
+
expect { load script, true }.to raise_error(ArgumentError, /required/i)
|
|
42
|
+
expect(PWN::Plugins::TransparentBrowser).not_to have_received(:open)
|
|
43
|
+
expect(PWN::Plugins::AuthenticationHelper).not_to have_received(:mask_password)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
['file:///etc/passwd', '/relative', 'https:///missing-host', 'ftp://example.invalid'].each do |url|
|
|
48
|
+
it "R09 rejects unsupported URL #{url} before opening" do
|
|
49
|
+
ARGV[0] = "--target-url=#{url}"
|
|
50
|
+
expect { load script, true }.to raise_error(ArgumentError, /URL/)
|
|
51
|
+
expect(PWN::Plugins::TransparentBrowser).not_to have_received(:open)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'R09 validates the authentication adapter before requesting a password' do
|
|
56
|
+
ARGV.reject! { |arg| arg.start_with?('--password=') }
|
|
57
|
+
ARGV.map! { |arg| arg == '--pwn-www-mod=GitHub' ? '--pwn-www-mod=MissingFixtureAdapter' : arg }
|
|
58
|
+
expect { load script, true }.to raise_error(ArgumentError, /Invalid module/)
|
|
59
|
+
expect(PWN::Plugins::AuthenticationHelper).not_to have_received(:mask_password)
|
|
60
|
+
expect(PWN::Plugins::TransparentBrowser).not_to have_received(:open)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'R09 rejects an unusable output parent before prompting or opening' do
|
|
64
|
+
ARGV[1] = "--output-results=#{File.join(@tmp, 'absent', 'results')}"
|
|
65
|
+
ARGV.reject! { |arg| arg.start_with?('--password=') }
|
|
66
|
+
expect { load script, true }.to raise_error(ArgumentError, /output/)
|
|
67
|
+
expect(PWN::Plugins::TransparentBrowser).not_to have_received(:open)
|
|
68
|
+
expect(PWN::Plugins::AuthenticationHelper).not_to have_received(:mask_password)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'R08 closes its opened handle even when real adapter login and logout both fail' do
|
|
72
|
+
allow(browser).to receive(:goto).with('https://github.com/login').and_raise(IOError, 'primary login failure')
|
|
73
|
+
allow(browser).to receive(:goto).with('https://github.com/logout').and_raise(IOError, 'secondary logout failure')
|
|
74
|
+
expect { load script, true }.to raise_error(IOError, 'primary login failure')
|
|
75
|
+
expect(PWN::Plugins::TransparentBrowser).to have_received(:close).with(browser_obj: handle)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it 'R08 closes its original handle when login returns nil' do
|
|
79
|
+
allow(PWN::WWW::GitHub).to receive(:login).and_return(nil)
|
|
80
|
+
expect { load script, true }.to raise_error(NoMethodError)
|
|
81
|
+
expect(PWN::Plugins::TransparentBrowser).to have_received(:close).with(browser_obj: handle)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it 'R07 preserves explicit password characters through the actual GitHub adapter' do
|
|
85
|
+
load script, true
|
|
86
|
+
expect(password_field).to have_received(:set).with(' synthetic password ')
|
|
87
|
+
expect(browser).to have_received(:goto).with('https://example.invalid/path/wcd.aif#section')
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe 'pwn_web_cache_deception lifecycle audit' do
|
|
6
|
+
let(:script) { File.expand_path('../../bin/pwn_web_cache_deception', __dir__) }
|
|
7
|
+
let(:browser) { double('offline browser', goto: nil, html: '<html>fixture</html>') }
|
|
8
|
+
let(:browser_obj) { { browser: browser } }
|
|
9
|
+
let(:provider) { double('offline WWW provider', open: browser_obj, login: browser_obj, logout: browser_obj, close: nil) }
|
|
10
|
+
let(:driver_opts) { {} }
|
|
11
|
+
let(:args) do
|
|
12
|
+
['--target-url=https://example.invalid/path', "--output-results=#{File.join(@directory, 'results.txt')}",
|
|
13
|
+
'--pwn-www-mod=GitHub', '-pfixture-password']
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
around do |example|
|
|
17
|
+
Dir.mktmpdir('pwn-wcd-audit-') do |directory|
|
|
18
|
+
@directory = directory
|
|
19
|
+
example.run
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
before do
|
|
24
|
+
stub_const('ARGV', args.dup)
|
|
25
|
+
allow(PWN::Env).to receive(:[]).and_call_original
|
|
26
|
+
allow(PWN::Env).to receive(:[]).with(:driver_opts).and_return(driver_opts)
|
|
27
|
+
allow(PWN::Config).to receive(:refresh_env)
|
|
28
|
+
stub_const('PWN::WWW::GitHub', provider)
|
|
29
|
+
stub_const('PWN::Plugins::TransparentBrowser', double('offline browser boundary', open: browser_obj, close: nil))
|
|
30
|
+
allow(PWN::Plugins::AuthenticationHelper).to receive(:mask_password).and_raise('unexpected password prompt')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'does not request a password for unauthenticated scans' do
|
|
34
|
+
ARGV.reject! { |arg| arg.start_with?('--pwn-www-mod=', '-pfixture') }
|
|
35
|
+
expect(PWN::Plugins::AuthenticationHelper).not_to receive(:mask_password)
|
|
36
|
+
load script, true
|
|
37
|
+
expect(File.read(File.join(@directory, 'results.txt'))).to include('Potential Candidate')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'reports an invalid authentication module rather than resolving NAME_ERROR' do
|
|
41
|
+
ARGV.map! { |arg| arg == '--pwn-www-mod=GitHub' ? '--pwn-www-mod=MissingFixtureModule' : arg }
|
|
42
|
+
expect { load script, true }.to raise_error(ArgumentError, /Invalid module/)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'reports an invalid authentication module without a secondary NameError or browser close' do
|
|
46
|
+
ARGV.map! { |arg| arg == '--pwn-www-mod=GitHub' ? '--pwn-www-mod=MissingFixtureModule' : arg }
|
|
47
|
+
expect(PWN::Plugins::TransparentBrowser).not_to receive(:close)
|
|
48
|
+
expect { load script, true }.to raise_error(ArgumentError, /Invalid module/)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it 'rejects an authentication adapter without a close operation before opening it' do
|
|
52
|
+
incomplete = double('incomplete adapter', open: browser_obj, login: browser_obj, logout: browser_obj)
|
|
53
|
+
stub_const('PWN::WWW::GitHub', incomplete)
|
|
54
|
+
expect(incomplete).not_to receive(:open)
|
|
55
|
+
expect { load script, true }.to raise_error(ArgumentError, /close/)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it 'appends the payload to the URL path rather than its fragment' do
|
|
59
|
+
ARGV.map! { |arg| arg.start_with?('--target-url=') ? '--target-url=https://example.invalid/path#section' : arg }
|
|
60
|
+
load script, true
|
|
61
|
+
expect(browser).to have_received(:goto).with('https://example.invalid/path/wcd.aif#section')
|
|
62
|
+
expect(browser).not_to have_received(:goto).with('https://example.invalid/path#section/wcd.aif')
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'parses the advertised short password option without treating it as a proxy' do
|
|
66
|
+
expect(provider).to receive(:login).with(hash_including(password: 'fixture-password')).and_return(browser_obj)
|
|
67
|
+
expect(provider).to receive(:open).with(browser_type: :chrome).and_return(browser_obj)
|
|
68
|
+
load script, true
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe 'domain analysis error propagation' do
|
|
6
|
+
{
|
|
7
|
+
PWN::AI::Agent::Assembly => { type: :asm_to_opcodes, arch: :x64, endian: :little },
|
|
8
|
+
PWN::AI::Agent::BTC => {},
|
|
9
|
+
PWN::AI::Agent::BurpSuite => {},
|
|
10
|
+
PWN::AI::Agent::GQRX => { location: 'offline fixture' },
|
|
11
|
+
PWN::AI::Agent::HackerOne => { type: :scope_details },
|
|
12
|
+
PWN::AI::Agent::SAST => {},
|
|
13
|
+
PWN::AI::Agent::TransparentBrowser => { source_to_review: 'const value = 1;' }
|
|
14
|
+
}.each do |agent, options|
|
|
15
|
+
context agent.to_s do
|
|
16
|
+
it 'preserves validation errors before reflection' do
|
|
17
|
+
expect(PWN::AI::Agent::Reflect).not_to receive(:on)
|
|
18
|
+
expect { agent.analyze(options) }.to raise_error(RuntimeError, 'ERROR: request parameter is required')
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'preserves the provider exception and its original backtrace' do
|
|
22
|
+
failure = IOError.new('offline provider failure')
|
|
23
|
+
failure.set_backtrace(['fixture_provider.rb:12:in `chat`'])
|
|
24
|
+
allow(PWN::AI::Agent::Reflect).to receive(:on).and_raise(failure)
|
|
25
|
+
|
|
26
|
+
expect { agent.analyze(options.merge(request: 'fixture input')) }.to raise_error do |error|
|
|
27
|
+
expect(error).to equal(failure)
|
|
28
|
+
expect(error.backtrace).to eq(['fixture_provider.rb:12:in `chat`'])
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe PWN::AI::Agent::Curriculum, 'persisted cooldown' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
it 'does not self-play a signature already parked in the JSON cooldown ledger' do
|
|
9
|
+
FileUtils.mkdir_p(described_class::CURRICULUM_DIR)
|
|
10
|
+
stub_const('PWN::AI::Agent::Curriculum::COOLDOWN_FILE', File.join(described_class::CURRICULUM_DIR, 'cooldown.json'))
|
|
11
|
+
stub_const('PWN::AI::Agent::Curriculum::KPI_FILE', File.join(@tmp, 'kpi.jsonl'))
|
|
12
|
+
File.write(described_class::COOLDOWN_FILE, JSON.generate('fixture' => { fail_nights: 3, parked: true }))
|
|
13
|
+
allow(PWN::AI::Agent::Mistakes).to receive(:top).and_return([{ signature: 'fixture', tool: 'shell', count: 4 }])
|
|
14
|
+
expect(described_class).not_to receive(:self_play)
|
|
15
|
+
allow(described_class).to receive(:generate_reproducers).and_return(['offline fixture'])
|
|
16
|
+
result = described_class.practice(limit: 1, dry_run: true)
|
|
17
|
+
expect(result).to include(practiced: 0, skipped_cooldown: 1)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -4,6 +4,8 @@ require 'spec_helper'
|
|
|
4
4
|
require 'tmpdir'
|
|
5
5
|
|
|
6
6
|
describe PWN::AI::Agent::Curriculum do
|
|
7
|
+
include_context 'pwn tmp sandbox'
|
|
8
|
+
|
|
7
9
|
it 'should display information for authors' do
|
|
8
10
|
authors_response = PWN::AI::Agent::Curriculum
|
|
9
11
|
expect(authors_response).to respond_to :authors
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe PWN::AI::Agent::Engagement, 'persistence boundaries' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
allow(Dir).to receive(:home).and_return(@tmp)
|
|
10
|
+
stub_const('PWN::AI::Agent::Engagement::ROOT', File.join(@tmp, 'engagements'))
|
|
11
|
+
stub_const('PWN::AI::Agent::Engagement::ACTIVE_FILE', File.join(described_class::ROOT, 'active'))
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'rejects escaping names before writing either the document or pointer' do
|
|
15
|
+
expect { described_class.open(name: '../outside') }.to raise_error(ArgumentError, /engagement name/i)
|
|
16
|
+
expect(File).not_to exist(File.join(@tmp, 'outside.json'))
|
|
17
|
+
expect(File).not_to exist(described_class::ACTIVE_FILE)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'rejects escaping explicit and persisted names before reading a document' do
|
|
21
|
+
FileUtils.mkdir_p(described_class::ROOT)
|
|
22
|
+
File.write(File.join(@tmp, 'outside.json'), '{"scope_domains": ["outside.example"]}')
|
|
23
|
+
expect { described_class.status(name: '../outside') }.to raise_error(ArgumentError, /engagement name/i)
|
|
24
|
+
File.write(described_class::ACTIVE_FILE, '../outside')
|
|
25
|
+
expect { described_class.status }.to raise_error(ArgumentError, /engagement name/i)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'validates a name without changing its spelling' do
|
|
29
|
+
expect(described_class.validate_name(name: 'Lab_2026.v1')).to eq('Lab_2026.v1')
|
|
30
|
+
['.', '..', '/absolute', 'nested/name', 'nested\\name', "bad\0name", ''].each do |name|
|
|
31
|
+
expect { described_class.validate_name(name: name) }.to raise_error(ArgumentError, /engagement name/i)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'reserves the active pointer and metadata suffix before creating an engagement' do
|
|
36
|
+
['active', 'existing.json'].each do |name|
|
|
37
|
+
expect { described_class.open(name: name) }.to raise_error(ArgumentError, /engagement name/i)
|
|
38
|
+
end
|
|
39
|
+
expect(File).not_to exist(described_class::ACTIVE_FILE)
|
|
40
|
+
expect(File).not_to exist(described_class::ROOT)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::AI::Agent::Engagement, 'reviewed dispatch scope' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
allow(Dir).to receive(:home).and_return(@tmp)
|
|
10
|
+
stub_const('PWN::AI::Agent::Engagement::ROOT', File.join(@tmp, 'engagements'))
|
|
11
|
+
stub_const('PWN::AI::Agent::Engagement::ACTIVE_FILE', File.join(@tmp, 'engagements', 'active'))
|
|
12
|
+
@calls = []
|
|
13
|
+
@registry_entries = PWN::AI::Agent::Registry.instance_variable_get(:@entries).dup
|
|
14
|
+
PWN::AI::Agent::Registry.register(
|
|
15
|
+
name: 'fixture_scope', toolset: 'fixture',
|
|
16
|
+
schema: { name: 'fixture_scope', parameters: { type: 'object', properties: {} } },
|
|
17
|
+
handler: lambda { |args|
|
|
18
|
+
@calls << args
|
|
19
|
+
{ observation: 'offline fixture' }
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
after do
|
|
25
|
+
PWN::AI::Agent::Registry.instance_variable_set(:@entries, @registry_entries)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def dispatch(args)
|
|
29
|
+
JSON.parse(PWN::AI::Agent::Dispatch.call(tool_call: { id: 'scope-fixture', function: { name: 'fixture_scope', arguments: JSON.generate(args) } }))
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
[
|
|
33
|
+
{ host: '2001:db8:2::42' },
|
|
34
|
+
{ url: 'https://[2001:db8:2::42]:8443/path' },
|
|
35
|
+
{ command: 'probe [2001:db8:2::42]:443' },
|
|
36
|
+
{ code: "probe(host: '2001:db8:2::42')" },
|
|
37
|
+
{ targets: [{ ip: '2001:db8:2::42' }] }
|
|
38
|
+
].each do |args|
|
|
39
|
+
it "blocks the out-of-scope IPv6 target before executing #{args.keys.first}" do
|
|
40
|
+
described_class.open(name: 'v6', scope_cidrs: ['2001:db8:1::/48'])
|
|
41
|
+
expect(dispatch(args)).to include('success' => false, 'code' => 'SCOPE_DENY')
|
|
42
|
+
expect(@calls).to be_empty
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
[['192.0.2.0/24', '192.0.2.12', '198.51.100.12'], ['2001:db8:2::/48', '2001:db8:2::42', '2001:db8:1::42']].each do |cidr, denied, allowed|
|
|
47
|
+
it "honors CIDR denies through Dispatch for #{cidr}" do
|
|
48
|
+
FileUtils.mkdir_p(File.join(@tmp, '.pwn'))
|
|
49
|
+
File.write(File.join(@tmp, '.pwn', 'roe.yaml'), YAML.dump('targets_deny' => [cidr]))
|
|
50
|
+
expect(dispatch(host: denied)).to include('success' => false)
|
|
51
|
+
expect(@calls).to be_empty
|
|
52
|
+
expect(dispatch(host: allowed)).to include('success' => true)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it 'preserves literal accepted names in the active pointer' do
|
|
57
|
+
described_class.open(name: 'lab', scope_domains: ['first.example'])
|
|
58
|
+
row = described_class.open(name: ' lab ', scope_domains: ['second.example'])
|
|
59
|
+
expect(described_class.current_name).to eq(row[:name])
|
|
60
|
+
expect(dispatch(host: 'first.example')).to include('success' => false)
|
|
61
|
+
expect(dispatch(host: 'second.example')).to include('success' => true)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it 'rejects explicit empty selectors instead of opting out of the active scope' do
|
|
65
|
+
described_class.open(name: 'lab', scope_domains: ['allowed.example'])
|
|
66
|
+
expect { described_class.in_scope?(name: '', host: 'outside.example') }.to raise_error(ArgumentError, /engagement name/)
|
|
67
|
+
expect { described_class.status(engagement: '') }.to raise_error(ArgumentError, /engagement name/)
|
|
68
|
+
expect(described_class.in_scope?(host: 'outside.example')).to be(false)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'resolves the engagement alias to the same document through the root wrapper' do
|
|
72
|
+
described_class.open(name: 'first', scope_domains: ['first.example'])
|
|
73
|
+
described_class.open(name: 'second', scope_domains: ['second.example'])
|
|
74
|
+
expect(PWN::Engagement.status(engagement: 'first')).to include(name: 'first', scope_domains: ['first.example'])
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it 'allows in-scope IPv6 URLs without interpreting the path as a separate host' do
|
|
78
|
+
described_class.open(name: 'v6', scope_cidrs: ['2001:db8:1::/48'])
|
|
79
|
+
expect(dispatch(url: 'https://[2001:db8:1::42]/notes.txt')).to include('success' => true)
|
|
80
|
+
expect(@calls.length).to eq(1)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe PWN::AI::Agent::Engagement, 'RoE parse failures' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
allow(Dir).to receive(:home).and_return(@tmp)
|
|
10
|
+
FileUtils.mkdir_p(File.join(@tmp, '.pwn'))
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'keeps an absent RoE policy optional' do
|
|
14
|
+
expect(described_class.load_roe).to include(present: false)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
['targets_allow: [unfinished', '- not a policy mapping', 'false'].each do |document|
|
|
18
|
+
it "does not silently disable enforcement for #{document.inspect}" do
|
|
19
|
+
File.write(File.join(@tmp, '.pwn', 'roe.yaml'), document)
|
|
20
|
+
expect { described_class.load_roe }.to raise_error(ArgumentError, /Invalid RoE policy/)
|
|
21
|
+
expect { described_class.in_scope?(host: 'outside.example') }.to raise_error(ArgumentError, /Invalid RoE policy/)
|
|
22
|
+
expect { described_class.deny_if_out_of_scope(command: 'scan outside.example') }.to raise_error(ArgumentError, /Invalid RoE policy/)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe PWN::AI::Agent::Engagement, 'explicit and IPv6 scope' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
allow(Dir).to receive(:home).and_return(@tmp)
|
|
10
|
+
stub_const('PWN::AI::Agent::Engagement::ROOT', File.join(@tmp, 'engagements'))
|
|
11
|
+
stub_const('PWN::AI::Agent::Engagement::ACTIVE_FILE', File.join(described_class::ROOT, 'active'))
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'matches IPv6 addresses and bracketed URL hosts without truncating the address' do
|
|
15
|
+
described_class.open(name: 'v6', scope_cidrs: ['2001:db8:1::/48'])
|
|
16
|
+
['2001:db8:1::42', 'https://[2001:db8:1::42]:8443/report'].each do |target|
|
|
17
|
+
expect(described_class.in_scope?(target: target)).to be(true)
|
|
18
|
+
end
|
|
19
|
+
expect(described_class.in_scope?(ip: '2001:db8:2::42')).to be(false)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'selects the named scope without switching the active engagement' do
|
|
23
|
+
described_class.open(name: 'first', scope_domains: ['first.example'])
|
|
24
|
+
described_class.open(name: 'second', scope_domains: ['second.example'])
|
|
25
|
+
expect(described_class.in_scope?(name: 'first', host: 'first.example')).to be(true)
|
|
26
|
+
expect(described_class.in_scope?(engagement: 'first', host: 'second.example')).to be(false)
|
|
27
|
+
expect(described_class.current_name).to eq('second')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'keeps no active scope optional but rejects an explicitly missing engagement' do
|
|
31
|
+
expect(described_class.in_scope?(host: 'fixture.example')).to be(true)
|
|
32
|
+
expect(described_class.in_scope?(name: 'missing', host: 'fixture.example')).to be(false)
|
|
33
|
+
described_class.open(name: 'deleted', scope_domains: ['fixture.example'])
|
|
34
|
+
File.unlink(File.join(described_class::ROOT, 'deleted.json'))
|
|
35
|
+
expect(described_class.in_scope?(host: 'fixture.example')).to be(false)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
require 'spec_helper'
|
|
4
4
|
|
|
5
5
|
describe 'PWN::AI::Agent::Extrospection (osint/bridges)' do
|
|
6
|
+
before do
|
|
7
|
+
allow(PWN::AI::Agent::Extrospection).to receive(:bridge_bin).and_return(nil)
|
|
8
|
+
end
|
|
9
|
+
|
|
6
10
|
it 'should expose BRIDGE_FEEDS for local passive OSINT tools' do
|
|
7
11
|
e = PWN::AI::Agent::Extrospection
|
|
8
12
|
expect(e.const_get(:BRIDGE_FEEDS)).to eq(%i[theharvester spiderfoot amass reconng])
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe PWN::AI::Agent::Extrospection, 'OSINT input boundaries' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
allow(described_class).to receive(:osint_api_keys).and_return({})
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it 'extracts NANP groups from this phone number rather than the previous regexp match' do
|
|
13
|
+
result = described_class.osint(query: '+12025550123', feeds: [:phone], record: false)
|
|
14
|
+
expect(result.dig(:feeds, :phone, :nanp)).to eq(area_code: '202', nxx: '555', station: '0123')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'rejects resource-command injection before invoking a recon-ng process' do
|
|
18
|
+
allow(described_class).to receive(:bridge_bin).and_return('/offline/recon-ng')
|
|
19
|
+
allow(described_class).to receive(:sh).and_return('')
|
|
20
|
+
result = described_class.osint(query: "example.test\nshell unexpected-command", feeds: [:reconng], record: false)
|
|
21
|
+
expect(result.dig(:feeds, :reconng, :error)).to include('domain')
|
|
22
|
+
expect(described_class).not_to have_received(:sh)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'retains valid email-to-domain bridge queries' do
|
|
26
|
+
allow(described_class).to receive(:bridge_bin).and_return('/offline/recon-ng')
|
|
27
|
+
allow(described_class).to receive(:sh).and_return('service.example.test')
|
|
28
|
+
result = described_class.osint(query: 'analyst@example.test', feeds: [:reconng], record: false)
|
|
29
|
+
expect(result.dig(:feeds, :reconng)).to include(domain: 'example.test', hosts: ['service.example.test'])
|
|
30
|
+
end
|
|
31
|
+
end
|