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,105 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
# Offline audit coverage: no terminal drawing, input, providers or devices.
|
|
6
|
+
describe PWN::Banner do
|
|
7
|
+
it 'returns finite, valid strings from every static banner and its metadata' do
|
|
8
|
+
modules = %i[Anon Bubble Cheshire CodeCave DontPanic ForkBomb FSociety JmpEsp Matrix Ninja OffTheAir Pirate Radare2 Radare2AI WhiteRabbit]
|
|
9
|
+
expect do
|
|
10
|
+
modules.each do |name|
|
|
11
|
+
banner = described_class.const_get(name)
|
|
12
|
+
text = banner.get
|
|
13
|
+
expect(text).to be_a(String)
|
|
14
|
+
expect(text.valid_encoding?).to be(true)
|
|
15
|
+
expect(text.length).to be_between(1, 100_000)
|
|
16
|
+
expect(banner.authors).to include('AUTHOR(S):')
|
|
17
|
+
end
|
|
18
|
+
end.to output('').to_stdout.and output('').to_stderr
|
|
19
|
+
modules.each do |name|
|
|
20
|
+
banner = described_class.const_get(name)
|
|
21
|
+
expect { expect(banner.help).to eq(banner.constants.sort) }.to output(/#{Regexp.escape(banner.name)}\.get/).to_stdout
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'keeps zero, negative and tiny canvases bounded without constructing a replay' do
|
|
26
|
+
expect(described_class).not_to receive(:mini_replay)
|
|
27
|
+
(described_class.mini_names + [:pong]).product(%i[mini_frame mini_cells], [true, false]).each do |name, method, branding|
|
|
28
|
+
[-100, 0].each do |size|
|
|
29
|
+
expect(described_class.public_send(method, name: name, width: size, height: 8, branding: branding)).to eq([])
|
|
30
|
+
expect(described_class.public_send(method, name: name, width: 8, height: size, branding: branding)).to eq([])
|
|
31
|
+
end
|
|
32
|
+
[1, 2, 4].product([1, 3, 4]).each do |width, height|
|
|
33
|
+
rows = described_class.public_send(method, name: name, width: width, height: height, branding: branding)
|
|
34
|
+
expect(rows.length).to eq(height)
|
|
35
|
+
expect(rows.map(&:length)).to all(eq(width))
|
|
36
|
+
text = method == :mini_cells ? rows.flatten.map { |cell| cell[:glyph] }.join : rows.join
|
|
37
|
+
expect(text).to eq(' ' * width * height) unless branding
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'rejects unknown animations consistently before rendering or stepping' do
|
|
43
|
+
%i[mini_frame mini_cells mini_frame_seconds].each do |method|
|
|
44
|
+
expect { described_class.public_send(method, name: :unknown) }.to raise_error(ArgumentError, /Unknown mini-banner/)
|
|
45
|
+
end
|
|
46
|
+
expect { described_class::MiniGame.new(name: :unknown, width: 8, height: 8) }.to raise_error(ArgumentError, /Unknown mini-banner/)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
describe PWN::Banner::MiniGame do
|
|
51
|
+
it 'retains safe minimum and maximum dimensions for zero, negative and oversized playable panes' do
|
|
52
|
+
(PWN::Banner.mini_names + [:pong]).product([-10, 0, 10**20]).each do |name, size|
|
|
53
|
+
game = described_class.new(name: name, width: size, height: size)
|
|
54
|
+
cells = game.cells(game.step)
|
|
55
|
+
limit = %i[falling_blocks pacman galaga frogger].include?(name) ? 64 : 16
|
|
56
|
+
expected = size.clamp(5, limit)
|
|
57
|
+
expect(cells.length).to eq(expected)
|
|
58
|
+
expect(cells.map(&:length)).to all(eq(expected))
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it 'bounds and drains pending controls without retaining an unbounded key history' do
|
|
63
|
+
game = described_class.new(name: :snake, width: 5, height: 5)
|
|
64
|
+
1000.times { |index| game.key(index.even? ? :up : :right) }
|
|
65
|
+
expect(game.controls).to eq(Array.new(8) { %i[up right] }.flatten)
|
|
66
|
+
expect(game.controls).to eq([])
|
|
67
|
+
game.key(:left)
|
|
68
|
+
expect(game.controls).to eq([:left])
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'yields beyond a replay lifetime without starting threads or accumulating frames' do
|
|
72
|
+
expect(Thread).not_to receive(:new)
|
|
73
|
+
expect(PWN::Banner).not_to receive(:sleep)
|
|
74
|
+
expect(PWN::Banner).not_to receive(:mini_replay)
|
|
75
|
+
expect do
|
|
76
|
+
(PWN::Banner.mini_names + [:pong]).product([false, true]).each do |name, demo|
|
|
77
|
+
game = described_class.new(name: name, width: 5, height: 5, seed: 3, demo: demo)
|
|
78
|
+
frame = nil
|
|
79
|
+
1801.times { frame = game.step }
|
|
80
|
+
expect(frame).to include(:event, :state, :rows)
|
|
81
|
+
expect(game.length).to eq(0)
|
|
82
|
+
cells = game.cells(frame)
|
|
83
|
+
expect(cells.length).to eq(5)
|
|
84
|
+
expect(cells.map(&:length)).to all(eq(5))
|
|
85
|
+
cells.first.first[:glyph].replace('?')
|
|
86
|
+
expect(game.cells(frame).first.first[:glyph]).not_to eq('?')
|
|
87
|
+
end
|
|
88
|
+
end.to output('').to_stdout.and output('').to_stderr
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
describe PWN::Banner::Matrix do
|
|
93
|
+
it 'returns one fixed-size matrix without running the interactive loop' do
|
|
94
|
+
text = described_class.get.uncolorize
|
|
95
|
+
expect(text.lines.length).to eq(33)
|
|
96
|
+
expect(text.lines).to all(satisfy { |row| row.strip.split.length == 33 })
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
it 'propagates cancellation from a single intercepted animation tick' do
|
|
100
|
+
allow(described_class).to receive(:print)
|
|
101
|
+
allow(described_class).to receive(:puts)
|
|
102
|
+
expect(described_class).to receive(:sleep).with(0.09).once.and_raise(Interrupt)
|
|
103
|
+
expect { described_class.you? }.to raise_error(Interrupt)
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -4,6 +4,23 @@ require 'spec_helper'
|
|
|
4
4
|
require 'tmpdir'
|
|
5
5
|
|
|
6
6
|
RSpec.describe PWN::Bounty::LifecycleAuthzReplay do
|
|
7
|
+
it 'reloads its normalized YAML without losing nesting or scalar values' do
|
|
8
|
+
Dir.mktmpdir('lifecycle-yaml-audit-') do |dir|
|
|
9
|
+
plan = {
|
|
10
|
+
campaign: { id: 'fixture', notes: "first\n :nested: literal\nlast" },
|
|
11
|
+
actors: [{ id: 'reader', metadata: { enabled: false, retries: 2, label: '001' } }],
|
|
12
|
+
surfaces: [{ id: 'page', metadata: { flags: [true, nil, 'false'] } }],
|
|
13
|
+
checkpoints: %w[pre_change post_change_t0],
|
|
14
|
+
metadata: { 'nested-key' => { value: 'a:b' } }
|
|
15
|
+
}
|
|
16
|
+
original = Marshal.dump(plan)
|
|
17
|
+
run = described_class.start_run(plan: plan, output_dir: dir, run_id: 'fixture-run')
|
|
18
|
+
reloaded = described_class.load_plan(yaml_path: File.join(run[:run_root], 'plan.normalized.yaml'))
|
|
19
|
+
expect(reloaded).to eq(run[:plan])
|
|
20
|
+
expect(Marshal.dump(plan)).to eq(original)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
7
24
|
it 'builds a normalized evidence bundle and flags stale access' do
|
|
8
25
|
Dir.mktmpdir('lifecycle-authz-replay-spec-') do |tmp_dir|
|
|
9
26
|
run_obj = described_class.start_run(
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe 'PWN::Config recursive redaction' do
|
|
6
|
+
it 'rejects cyclic configuration safely without exposing secret contents' do
|
|
7
|
+
config = { password: 'synthetic fixture only' }
|
|
8
|
+
config[:cycle] = config
|
|
9
|
+
expect do
|
|
10
|
+
PWN::Config.redact_sensitive_artifacts(config: config)
|
|
11
|
+
end.to raise_error(JSON::NestingError, /configuration nesting limit/)
|
|
12
|
+
expect(config[:cycle]).to equal(config)
|
|
13
|
+
expect(config[:password]).to eq('synthetic fixture only')
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'redacts both occurrences of shared acyclic branches without changing the caller' do
|
|
17
|
+
shared = { password: 'synthetic fixture only' }.freeze
|
|
18
|
+
config = { first: shared, second: [shared].freeze }.freeze
|
|
19
|
+
result = PWN::Config.redact_sensitive_artifacts(config: config)
|
|
20
|
+
expect(result[:first][:password]).to include('REDACTED')
|
|
21
|
+
expect(result[:second].first).to eq(result[:first])
|
|
22
|
+
expect(shared[:password]).to eq('synthetic fixture only')
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe 'PWN::Config skill loading failures' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
before { stub_const('PWN::Skills', {}) }
|
|
9
|
+
|
|
10
|
+
it 'reads CRLF frontmatter without changing the skill body' do
|
|
11
|
+
body = "# Fixture\r\n\r\nKeep this body.\r\n"
|
|
12
|
+
parsed = PWN::Config.parse_skill_frontmatter(content: "---\r\nname: fixture\r\ndescription: Fixture instructions\r\n---\r\n#{body}")
|
|
13
|
+
expect(parsed[:frontmatter]).to include('name' => 'fixture', 'description' => 'Fixture instructions')
|
|
14
|
+
expect(parsed[:body]).to eq(body)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'reports a broken directory skill without aborting the remaining catalog' do
|
|
18
|
+
bad = File.join(@tmp, 'skills', 'broken', 'scripts')
|
|
19
|
+
good = File.join(@tmp, 'skills', 'healthy')
|
|
20
|
+
FileUtils.mkdir_p([bad, good])
|
|
21
|
+
File.write(File.join(File.dirname(bad), 'SKILL.md'), "# Broken\nFixture skill\n")
|
|
22
|
+
File.write(File.join(bad, 'missing_dependency.rb'), "require 'pwn_fixture_dependency_that_does_not_exist'\n")
|
|
23
|
+
File.write(File.join(good, 'SKILL.md'), "# Healthy\nFixture skill\n")
|
|
24
|
+
skills = PWN::Config.load_skills(pwn_skills_path: File.join(@tmp, 'skills'))
|
|
25
|
+
expect(skills[:broken]).to include(loaded: false)
|
|
26
|
+
expect(skills[:broken][:error]).to include('pwn_fixture_dependency_that_does_not_exist')
|
|
27
|
+
expect(skills).to have_key(:healthy)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'reports legacy Ruby syntax failures without aborting the catalog' do
|
|
31
|
+
File.write(File.join(@tmp, 'broken.rb'), "def fixture(\n")
|
|
32
|
+
File.write(File.join(@tmp, 'healthy.md'), "# Healthy\nFixture skill\n")
|
|
33
|
+
skills = PWN::Config.load_skills(pwn_skills_path: @tmp)
|
|
34
|
+
expect(skills[:broken]).to include(loaded: false)
|
|
35
|
+
expect(skills[:broken][:error]).not_to be_empty
|
|
36
|
+
expect(skills).to have_key(:healthy)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe 'PWN::Corpus P1 publication recovery' do
|
|
6
|
+
before do
|
|
7
|
+
@corpus_dir = Dir.mktmpdir('pwn-corpus-recovery-')
|
|
8
|
+
stub_const('PWN::Corpus::ROOT', @corpus_dir)
|
|
9
|
+
allow(Net::HTTP).to receive(:get).and_return("old fixture\n", "new fixture\n")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
after do
|
|
13
|
+
FileUtils.remove_entry(@corpus_dir)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
%i[data checksum].product(%i[before after]).each do |file, timing|
|
|
17
|
+
it "restores the readable pair when publication raises #{timing} replacing #{file}" do
|
|
18
|
+
path = PWN::Corpus.get(name: :subdomains_top1m)
|
|
19
|
+
old_data = File.binread(path)
|
|
20
|
+
old_checksum = File.binread("#{path}.sha256")
|
|
21
|
+
before = Dir.children(PWN::Corpus::ROOT).sort
|
|
22
|
+
target = file == :data ? path : "#{path}.sha256"
|
|
23
|
+
allow(FileUtils).to receive(:mv).and_wrap_original do |original, source, destination|
|
|
24
|
+
raise Errno::EACCES, 'synthetic publication failure' if destination == target && timing == :before
|
|
25
|
+
|
|
26
|
+
result = original.call(source, destination)
|
|
27
|
+
raise Errno::EACCES, 'synthetic publication failure' if destination == target && timing == :after
|
|
28
|
+
|
|
29
|
+
result
|
|
30
|
+
end
|
|
31
|
+
expect { PWN::Corpus.update(name: :subdomains_top1m) }.to raise_error(Errno::EACCES, /synthetic publication failure/)
|
|
32
|
+
expect(PWN::Corpus.get(name: :subdomains_top1m, offline: true)).to eq(path)
|
|
33
|
+
expect(File.binread(path)).to eq(old_data)
|
|
34
|
+
expect(File.binread("#{path}.sha256")).to eq(old_checksum)
|
|
35
|
+
expect(Dir.children(PWN::Corpus::ROOT).sort).to eq(before)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'removes partial new publication on an initial update failure' do
|
|
40
|
+
allow(FileUtils).to receive(:mv).and_wrap_original do |original, source, destination|
|
|
41
|
+
raise Errno::EACCES, 'synthetic checksum failure' if destination.end_with?('.sha256')
|
|
42
|
+
|
|
43
|
+
original.call(source, destination)
|
|
44
|
+
end
|
|
45
|
+
expect { PWN::Corpus.update(name: :subdomains_top1m) }.to raise_error(Errno::EACCES)
|
|
46
|
+
expect(Dir.children(PWN::Corpus::ROOT)).to be_empty
|
|
47
|
+
expect { PWN::Corpus.get(name: :subdomains_top1m, offline: true) }.to raise_error(IOError, /cache miss/)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'preserves unowned legacy temporary paths on successful publication' do
|
|
51
|
+
path = PWN::Corpus.get(name: :subdomains_top1m)
|
|
52
|
+
File.write("#{path}.tmp", 'unowned data')
|
|
53
|
+
File.write("#{path}.tmp.sha256", 'unowned checksum')
|
|
54
|
+
before = Dir.children(PWN::Corpus::ROOT).sort
|
|
55
|
+
expect(PWN::Corpus.update(name: :subdomains_top1m)).to eq(path)
|
|
56
|
+
expect(PWN::Corpus.get(name: :subdomains_top1m, offline: true)).to eq(path)
|
|
57
|
+
expect(File.binread(path)).to eq("new fixture\n")
|
|
58
|
+
expect(File.binread("#{path}.tmp")).to eq('unowned data')
|
|
59
|
+
expect(File.binread("#{path}.tmp.sha256")).to eq('unowned checksum')
|
|
60
|
+
expect(Dir.children(PWN::Corpus::ROOT).sort).to eq(before)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'retains recovery copies if rollback itself cannot restore a file' do
|
|
64
|
+
path = PWN::Corpus.get(name: :subdomains_top1m)
|
|
65
|
+
old_checksum = File.binread("#{path}.sha256")
|
|
66
|
+
allow(FileUtils).to receive(:mv).and_wrap_original do |original, source, destination|
|
|
67
|
+
raise Errno::EACCES, 'synthetic checksum failure' if destination.end_with?('.sha256')
|
|
68
|
+
|
|
69
|
+
original.call(source, destination)
|
|
70
|
+
end
|
|
71
|
+
allow(File).to receive(:rename).and_wrap_original do |original, source, destination|
|
|
72
|
+
raise Errno::EIO, 'synthetic rollback failure' if destination == path && File.basename(source) == File.basename(path)
|
|
73
|
+
|
|
74
|
+
original.call(source, destination)
|
|
75
|
+
end
|
|
76
|
+
expect { PWN::Corpus.update(name: :subdomains_top1m) }.to raise_error(Errno::EIO, /synthetic rollback failure/)
|
|
77
|
+
copies = Dir.glob(File.join(PWN::Corpus::ROOT, '.corpus-update-*', File.basename(path)))
|
|
78
|
+
expect(copies.length).to eq(1)
|
|
79
|
+
expect(File.binread(copies.first)).to eq("old fixture\n")
|
|
80
|
+
expect(File.binread("#{copies.first}.sha256")).to eq(old_checksum)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it 'cleans its staged files when preparing the checksum raises' do
|
|
84
|
+
path = PWN::Corpus.get(name: :subdomains_top1m)
|
|
85
|
+
before = Dir.children(PWN::Corpus::ROOT).sort
|
|
86
|
+
allow(File).to receive(:write).and_wrap_original do |original, target, body|
|
|
87
|
+
raise Errno::ENOSPC, 'synthetic staging failure' if target.end_with?('.tmp.sha256')
|
|
88
|
+
|
|
89
|
+
original.call(target, body)
|
|
90
|
+
end
|
|
91
|
+
expect { PWN::Corpus.update(name: :subdomains_top1m) }.to raise_error(Errno::ENOSPC)
|
|
92
|
+
expect(PWN::Corpus.get(name: :subdomains_top1m, offline: true)).to eq(path)
|
|
93
|
+
expect(File.binread(path)).to eq("old fixture\n")
|
|
94
|
+
expect(Dir.children(PWN::Corpus::ROOT).sort).to eq(before)
|
|
95
|
+
end
|
|
96
|
+
end
|
data/spec/lib/pwn/corpus_spec.rb
CHANGED
|
@@ -12,6 +12,19 @@ describe PWN::Corpus do
|
|
|
12
12
|
expect(described_class).to respond_to :help
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
+
it 'keeps a refreshed corpus readable by offline callers with its new checksum' do
|
|
16
|
+
Dir.mktmpdir('corpus-refresh-') do |dir|
|
|
17
|
+
stub_const('PWN::Corpus::ROOT', dir)
|
|
18
|
+
allow(Net::HTTP).to receive(:get).and_return("old fixture\n", "new fixture\n")
|
|
19
|
+
path = described_class.get(name: :subdomains_top1m)
|
|
20
|
+
expect(described_class.update(name: :subdomains_top1m)).to eq(path)
|
|
21
|
+
expect(described_class.get(name: :subdomains_top1m, offline: true)).to eq(path)
|
|
22
|
+
expect(File.read(path)).to eq("new fixture\n")
|
|
23
|
+
expect(File.read("#{path}.sha256")).to eq(Digest::SHA256.file(path).hexdigest)
|
|
24
|
+
expect(Dir.glob(File.join(dir, '*.tmp*'))).to be_empty
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
15
28
|
it 'resolves a named builtin corpus from cache' do
|
|
16
29
|
Dir.mktmpdir('corpus') do |dir|
|
|
17
30
|
stub_const('PWN::Corpus::ROOT', dir)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe 'PWN::Cron core review regressions' do
|
|
6
|
+
describe 'C2 executes literal script paths' do
|
|
7
|
+
include_context 'pwn tmp sandbox'
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
allow(PWN::Cron).to receive(:sync_one_job)
|
|
11
|
+
allow(PWN::Cron).to receive(:native_execution?).and_return(false)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'preserves the no-script result for an empty path rather than executing cwd' do
|
|
15
|
+
job = PWN::Cron.create(script: '', sync_native: false)
|
|
16
|
+
expect(Open3).not_to receive(:capture2e)
|
|
17
|
+
expect(PWN::Cron.run(id: job[:id])).to include(status: 'success', result: 'No prompt/ruby/script defined')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'executes the checked cwd script instead of a PATH namesake' do
|
|
21
|
+
bin = File.join(@tmp, 'bin')
|
|
22
|
+
cwd = File.join(@tmp, 'working')
|
|
23
|
+
FileUtils.mkdir_p([bin, cwd])
|
|
24
|
+
[[bin, 'path namesake'], [cwd, 'literal cwd script']].each do |dir, text|
|
|
25
|
+
path = File.join(dir, 'relative-fixture')
|
|
26
|
+
File.write(path, "#!/bin/sh\nprintf '#{text}\\n'\n")
|
|
27
|
+
File.chmod(0o700, path)
|
|
28
|
+
end
|
|
29
|
+
previous = ENV.fetch('PATH')
|
|
30
|
+
begin
|
|
31
|
+
ENV['PATH'] = bin
|
|
32
|
+
Dir.chdir(cwd) do
|
|
33
|
+
job = PWN::Cron.create(script: 'relative-fixture', sync_native: false)
|
|
34
|
+
expect(PWN::Cron.run(id: job[:id])).to include(status: 'success', result: "literal cwd script\n")
|
|
35
|
+
expect(PWN::Cron.list[job[:id]][:last_status]).to eq('success')
|
|
36
|
+
File.unlink('relative-fixture')
|
|
37
|
+
expect(PWN::Cron.run(id: job[:id])[:result]).to eq('No prompt/ruby/script defined')
|
|
38
|
+
end
|
|
39
|
+
ensure
|
|
40
|
+
ENV['PATH'] = previous
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
describe 'C1 validates every field before calendar matching' do
|
|
46
|
+
let(:now) { Time.local(2026, 6, 1, 5) }
|
|
47
|
+
|
|
48
|
+
it 'rejects invalid day fields even when the other restricted day matches', :aggregate_failures do
|
|
49
|
+
['0 5 99 * 1', '0 5 1 * 99', '0 5 nope * 1', '0 5 1 * 1-0', '0 5 */0 * 1'].each do |schedule|
|
|
50
|
+
expect(PWN::Cron.due?(schedule: schedule, last_run: now - 60, now: now)).to be(false), schedule
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it 'rejects invalid grammar, bounds, ranges and steps anywhere in a list', :aggregate_failures do
|
|
55
|
+
fields = %w[0 5 1 6 1]
|
|
56
|
+
bounds = [[0, 59], [0, 23], [1, 31], [1, 12], [0, 7]]
|
|
57
|
+
bounds.each_with_index do |(min, max), index|
|
|
58
|
+
bad_atoms = ['nope', '+1', '-1', '0x1', '1_0', '1/2', '*/0', '*/-2', '*/x', '*/1/2', '1-2/0', '1-2/-1', '1-2/1/2', '2-1', (max + 1).to_s, "#{min}-#{max + 1}", "#{min}-#{max + 1}/2"]
|
|
59
|
+
bad_atoms += ['0', '0-2', '0-2/1'] if min.positive?
|
|
60
|
+
bad_fields = bad_atoms.flat_map { |atom| [atom, "#{fields[index]},#{atom}", "#{atom},#{fields[index]}"] }
|
|
61
|
+
bad_fields += ["#{fields[index]},", ",#{fields[index]}", "#{fields[index]},,#{fields[index]}", ',']
|
|
62
|
+
bad_fields.each do |field|
|
|
63
|
+
schedule = fields.dup.tap { |parts| parts[index] = field }.join(' ')
|
|
64
|
+
expect(PWN::Cron.due?(schedule: schedule, last_run: now - 60, now: now)).to be(false), schedule
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it 'retains valid wildcards, lists, steps and restricted day OR matching', :aggregate_failures do
|
|
70
|
+
['* * * * *', '*/15 1-9/2 * * *', '0,15 5 1 6 2', '0 5 2 6 1', '0 5 */2 6 1', '0 5 * 6 1', '0 5 1 6 *', '0 5 1-31/2 6 2', '*/100 5 * * *'].each do |schedule|
|
|
71
|
+
expect(PWN::Cron.due?(schedule: schedule, last_run: now - 60, now: now)).to be(true), schedule
|
|
72
|
+
end
|
|
73
|
+
['0 5 * 6 2', '0 5 2 6 *', '0 5 */2 6 2', '0 5 2 6 */2'].each do |schedule|
|
|
74
|
+
expect(PWN::Cron.due?(schedule: schedule, last_run: now - 60, now: now)).to be(false), schedule
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it 'matches Sunday zero and seven in literals, lists and stepped ranges', :aggregate_failures do
|
|
79
|
+
sunday = Time.local(2026, 6, 7, 5)
|
|
80
|
+
%w[0 7 1,7 0-7 5-7 5-7/2 */7].each do |field|
|
|
81
|
+
expect(PWN::Cron.due?(schedule: "0 5 * * #{field}", last_run: sunday - 60, now: sunday)).to be(true), field
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it 'reads zero-padded decimal fields without Ruby integer-prefix semantics' do
|
|
86
|
+
instant = Time.local(2026, 8, 9, 8, 9)
|
|
87
|
+
expect(PWN::Cron.due?(schedule: '09 08 09 08 *', last_run: instant - 60, now: instant)).to be(true)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it 'retains leap-day catch-up and does not invent impossible dates' do
|
|
91
|
+
expect(PWN::Cron.due?(schedule: '0 5 29 2 *', last_run: Time.local(2024, 2, 1), now: Time.local(2024, 3, 1))).to be(true)
|
|
92
|
+
expect(PWN::Cron.due?(schedule: '0 5 30 2 *', last_run: Time.local(2024, 2, 1), now: Time.local(2024, 3, 1))).to be(false)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe 'PWN::Cron execution outcomes' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
allow(PWN::Cron).to receive(:sync_one_job)
|
|
10
|
+
allow(PWN::Cron).to receive(:native_execution?).and_return(false)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'reports a failed script as an error rather than a successful job' do
|
|
14
|
+
path = File.join(@tmp, 'failed-script')
|
|
15
|
+
File.write(path, "#!/bin/sh\nprintf 'fixture failure\\n'\nexit 23\n")
|
|
16
|
+
File.chmod(0o700, path)
|
|
17
|
+
job = PWN::Cron.create(script: path, sync_native: false)
|
|
18
|
+
result = PWN::Cron.run(id: job[:id])
|
|
19
|
+
expect(result).to include(status: 'error', result: "fixture failure\n")
|
|
20
|
+
expect(PWN::Cron.list[job[:id]][:last_status]).to eq('error')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'executes a literal script path containing spaces and shell metacharacters' do
|
|
24
|
+
path = File.join(@tmp, 'fixture ; false')
|
|
25
|
+
File.write(path, "#!/bin/sh\nprintf 'literal fixture\\n'\n")
|
|
26
|
+
File.chmod(0o700, path)
|
|
27
|
+
job = PWN::Cron.create(script: path, sync_native: false)
|
|
28
|
+
expect(PWN::Cron.run(id: job[:id])).to include(status: 'success', result: "literal fixture\n")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'routes prompt jobs to the configured Open WebUI provider' do
|
|
32
|
+
PWN::Env[:ai][:active] = :openwebui
|
|
33
|
+
allow(PWN::AI::OpenWebUI).to receive(:chat).with(request: 'fixture prompt', spinner: false).and_return(choices: [{ content: 'fixture response' }])
|
|
34
|
+
job = PWN::Cron.create(prompt: 'fixture prompt', sync_native: false)
|
|
35
|
+
expect(PWN::Cron.run(id: job[:id])).to include(status: 'success', result: 'fixture response')
|
|
36
|
+
expect(PWN::AI::OpenWebUI).to have_received(:chat).once
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'catches a monthly slot after more than a week of downtime' do
|
|
40
|
+
expect(PWN::Cron.due?(schedule: '0 5 15 * *', last_run: Time.local(2026, 5, 1), now: Time.local(2026, 5, 20))).to be(true)
|
|
41
|
+
expect(PWN::Cron.due?(schedule: '0 5 15 * *', last_run: Time.local(2026, 5, 15, 5), now: Time.local(2026, 5, 20))).to be(false)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'matches either day field when both cron day-of-month and weekday are restricted' do
|
|
45
|
+
# 2026-05-18 is a Monday, but it is not the first of the month.
|
|
46
|
+
now = Time.local(2026, 5, 18, 5)
|
|
47
|
+
expect(PWN::Cron.due?(schedule: '0 5 1 * 1', last_run: now - 60, now: now)).to be(true)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'matches Sunday represented by seven inside cron ranges' do
|
|
51
|
+
now = Time.local(2026, 5, 17, 5)
|
|
52
|
+
expect(now.wday).to eq(0)
|
|
53
|
+
expect(PWN::Cron.due?(schedule: '0 5 * * 5-7', last_run: now - 60, now: now)).to be(true)
|
|
54
|
+
expect(PWN::Cron.due?(schedule: '0 5 * * 5-7/2', last_run: now - 60, now: now)).to be(true)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'uses the same instant regardless of the supplied current-time offset' do
|
|
58
|
+
[Time.local(2026, 5, 18, 4, 59), Time.local(2026, 5, 18, 5)].each do |now|
|
|
59
|
+
shifted = now.getlocal(now.utc_offset.zero? ? '+01:00' : '+00:00')
|
|
60
|
+
expected = now.hour == 5
|
|
61
|
+
expect(PWN::Cron.due?(schedule: '0 5 18 5 *', last_run: now - 60, now: now)).to be(expected)
|
|
62
|
+
expect(PWN::Cron.due?(schedule: '0 5 18 5 *', last_run: now - 60, now: shifted)).to be(expected)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'does not report startup success when the child PID is no longer alive' do
|
|
67
|
+
allow(PWN::Cron).to receive(:worker_status).and_return(running: false)
|
|
68
|
+
allow(PWN::Cron).to receive(:read_pid).and_return(12_345)
|
|
69
|
+
allow(PWN::Cron).to receive(:process_alive?).with(pid: 12_345).and_return(false)
|
|
70
|
+
allow(PWN::Cron).to receive(:sleep)
|
|
71
|
+
allow(Process).to receive(:spawn).and_return(12_345)
|
|
72
|
+
allow(Process).to receive(:detach)
|
|
73
|
+
expect(PWN::Cron.start_worker(restart: false)).to include(started: false)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'open3'
|
|
5
|
+
require 'rbconfig'
|
|
6
|
+
|
|
7
|
+
RSpec.describe 'PWN::Driver D1 help banner regression' do
|
|
8
|
+
it 'preserves a banner installed by the OptionParser initializer block' do
|
|
9
|
+
parser = PWN::Driver::Parser.new { |options| options.banner = "fixture usage\nfixture purpose\n" }
|
|
10
|
+
expect(parser.banner).to eq("fixture usage\nfixture purpose\n")
|
|
11
|
+
expect(parser.to_s).to include('--pwn_env=PATH', '--pwn_dec=PATH', '--version')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'prints customized local automatic help without invoking an executable' do
|
|
15
|
+
parser = PWN::Driver::Parser.new { |options| options.banner = "fixture usage\n" }
|
|
16
|
+
parser.opts = { pwn_env_path: nil, pwn_dec_path: nil }
|
|
17
|
+
stub_const('ARGV', [])
|
|
18
|
+
allow(PWN::Config).to receive(:refresh_env)
|
|
19
|
+
expect(parser).not_to receive(:`)
|
|
20
|
+
expect do
|
|
21
|
+
expect { parser.parse! }.to raise_error(SystemExit) { |error| expect(error.status).to eq(1) }
|
|
22
|
+
end.to output(a_string_starting_with("fixture usage\n")).to_stdout
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'preserves the purpose and default-action banner in real pwn_setup --help' do
|
|
26
|
+
Dir.mktmpdir('pwn-setup-help-') do |home|
|
|
27
|
+
root = File.expand_path('../../..', __dir__)
|
|
28
|
+
out, err, status = Open3.capture3(
|
|
29
|
+
{ 'HOME' => home, 'PWN_CRON_DIR' => File.join(home, 'cron') },
|
|
30
|
+
RbConfig.ruby, '-I', File.join(root, 'lib'), File.join(root, 'bin', 'pwn_setup'), '--help'
|
|
31
|
+
)
|
|
32
|
+
expect(status.exitstatus).to eq(0), err
|
|
33
|
+
expect(out).to include('USAGE: pwn_setup [opts]', 'Post-install doctor & capability provisioner for the PWN gem.', 'With no options, runs a read-only capability check.', '--profile=NAME', '--pwn_env=PATH')
|
|
34
|
+
expect(err).to be_empty
|
|
35
|
+
expect(Dir.children(home)).to be_empty
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
data/spec/lib/pwn/driver_spec.rb
CHANGED
|
@@ -12,4 +12,17 @@ describe PWN::Driver do
|
|
|
12
12
|
help_response = PWN::Driver
|
|
13
13
|
expect(help_response).to respond_to :help
|
|
14
14
|
end
|
|
15
|
+
|
|
16
|
+
it 'uses its own parser help when no driver-specific options were supplied' do
|
|
17
|
+
parser = PWN::Driver::Parser.new
|
|
18
|
+
parser.opts = { pwn_env_path: nil, pwn_dec_path: nil }
|
|
19
|
+
stub_const('ARGV', [])
|
|
20
|
+
allow(PWN::Config).to receive(:refresh_env)
|
|
21
|
+
allow(parser).to receive(:`).and_return('external help must not be used')
|
|
22
|
+
expect(parser.banner).to eq("USAGE: #{File.basename($PROGRAM_NAME)} [opts]\n")
|
|
23
|
+
expect do
|
|
24
|
+
expect { parser.parse! }.to raise_error(SystemExit) { |error| expect(error.status).to eq(1) }
|
|
25
|
+
end.to output(parser.to_s).to_stdout
|
|
26
|
+
expect(parser).not_to have_received(:`)
|
|
27
|
+
end
|
|
15
28
|
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe 'PWN::Engagement core review regressions' 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
|
+
end
|
|
13
|
+
|
|
14
|
+
describe 'E2 enumerates literal engagement scan directories' do
|
|
15
|
+
it 'does not use missing wildcard names to enumerate other engagements' do
|
|
16
|
+
PWN::Engagement.record_scan(name: 'other', hosts: [{ host: '192.0.2.2' }], at: Time.utc(2026, 1, 1))
|
|
17
|
+
expect(PWN::Engagement.scans(name: '*')).to be_empty
|
|
18
|
+
expect(PWN::Engagement.scans(name: '?ther')).to be_empty
|
|
19
|
+
expect(PWN::Engagement.scans(name: '{other,absent}')).to be_empty
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'round trips bracket and wildcard components without changing their spelling', :aggregate_failures do
|
|
23
|
+
PWN::Engagement.record_scan(name: 'other', hosts: [{ host: '192.0.2.2' }], at: Time.utc(2026, 1, 1))
|
|
24
|
+
['fixture[1]', '*', '?', '{other,fixture}'].each do |name|
|
|
25
|
+
later = PWN::Engagement.record_scan(name: name, hosts: [{ host: '192.0.2.1' }], at: Time.utc(2026, 1, 2))
|
|
26
|
+
earlier = PWN::Engagement.record_scan(name: name, hosts: [], at: Time.utc(2026, 1, 1))
|
|
27
|
+
expect(PWN::Engagement.scans(name: name)).to eq([earlier, later]), name
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe 'E1 separates storage fallback from scope selection' do
|
|
33
|
+
it 'persists the real no-active Nmap XML import in default host storage' do
|
|
34
|
+
xml = File.join(@tmp, 'inventory.xml')
|
|
35
|
+
File.write(xml, '<nmaprun><host><status state="up"/><address addr="192.0.2.1" addrtype="ipv4"/><ports><port protocol="tcp" portid="443"><state state="open"/><service name="https"/></port></ports></host></nmaprun>')
|
|
36
|
+
expect(PWN::AI::Agent::Engagement.current_name).to be_nil
|
|
37
|
+
expect(PWN::Engagement.in_scope?(host: '192.0.2.1')).to be(true)
|
|
38
|
+
expect(PWN::Plugins::NmapIt).not_to receive(:port_scan)
|
|
39
|
+
result = PWN::Plugins::NmapIt.scan(targets: ['192.0.2.1'], xml_file: xml)
|
|
40
|
+
expect(result[:hosts].first[:host]).to eq('192.0.2.1')
|
|
41
|
+
expect(PWN::Engagement.hosts[:'192.0.2.1']).to include(host: '192.0.2.1', services: ['https'])
|
|
42
|
+
path = File.join(PWN::AI::Agent::Engagement::ROOT, 'default', 'hosts.json')
|
|
43
|
+
expect(JSON.parse(File.read(path)).keys).to eq(['192.0.2.1'])
|
|
44
|
+
expect(PWN::Engagement.scans.length).to eq(1)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it 'does not silently activate a stored default scope after it is closed' do
|
|
48
|
+
PWN::Engagement.open(name: 'default', scope_domains: ['default.invalid'])
|
|
49
|
+
PWN::Engagement.close
|
|
50
|
+
expect(PWN::Engagement.record_host(host: '192.0.2.1')).to include(host: '192.0.2.1')
|
|
51
|
+
expect(PWN::Engagement.record_host(name: 'default', host: '192.0.2.2')).to include(ok: false, recorded: false)
|
|
52
|
+
expect(PWN::Engagement.hosts.keys).to eq([:'192.0.2.1'])
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'still rejects explicitly missing and dangling-active engagements' do
|
|
56
|
+
%i[name engagement].each do |key|
|
|
57
|
+
expect(PWN::Engagement.record_host(key => 'default', :host => '192.0.2.1')).to include(ok: false, recorded: false)
|
|
58
|
+
end
|
|
59
|
+
FileUtils.mkdir_p(PWN::AI::Agent::Engagement::ROOT)
|
|
60
|
+
File.write(PWN::AI::Agent::Engagement::ACTIVE_FILE, 'missing')
|
|
61
|
+
expect(PWN::Engagement.record_host(host: '192.0.2.1')).to include(ok: false, recorded: false)
|
|
62
|
+
expect(File).not_to exist(File.join(PWN::AI::Agent::Engagement::ROOT, 'default'))
|
|
63
|
+
expect(File).not_to exist(File.join(PWN::AI::Agent::Engagement::ROOT, 'missing'))
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'preserves active scope and literal override without alias bypasses' do
|
|
67
|
+
PWN::Engagement.open(name: 'selected', scope_domains: ['selected.invalid'])
|
|
68
|
+
PWN::Engagement.open(name: 'active-scope', scope_domains: ['active.invalid'])
|
|
69
|
+
expect(PWN::Engagement.record_host(host: 'selected.invalid')).to include(ok: false, recorded: false)
|
|
70
|
+
expect(PWN::Engagement.record_host(name: 'selected', engagement: 'selected', host: 'active.invalid')).to include(ok: false, recorded: false)
|
|
71
|
+
expect(PWN::Engagement.record_host(name: 'selected', host: 'active.invalid', override: 'true')).to include(ok: false, recorded: false)
|
|
72
|
+
expect(PWN::Engagement.record_host(engagement: 'selected', host: 'selected.invalid')).to include(host: 'selected.invalid')
|
|
73
|
+
expect(PWN::Engagement.record_host(name: 'selected', host: 'active.invalid', override: true)).to include(host: 'active.invalid')
|
|
74
|
+
expect(PWN::Engagement.hosts(name: 'active-scope')).to be_empty
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it 'rejects conflicting aliases before host or scan storage operations', :aggregate_failures do
|
|
78
|
+
PWN::Engagement.open(name: 'selected', scope_domains: ['selected.invalid'])
|
|
79
|
+
PWN::Engagement.open(name: 'other', scope_domains: ['other.invalid'])
|
|
80
|
+
opts = { name: 'other', engagement: 'selected', host: 'selected.invalid', hosts: [{ host: 'selected.invalid', port: 443 }] }
|
|
81
|
+
%i[record_host merge_scan record_scan hosts scans].each do |method|
|
|
82
|
+
expect { PWN::Engagement.public_send(method, opts) }.to raise_error(ArgumentError, /conflicting engagement/i), method.to_s
|
|
83
|
+
end
|
|
84
|
+
expect(PWN::Engagement.hosts(name: 'selected')).to be_empty
|
|
85
|
+
expect(PWN::Engagement.scans(name: 'selected')).to be_empty
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|