pwn 0.5.795 → 0.5.796
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/bin/pwn_autoinc_version +4 -5
- data/bin/pwn_web_cache_deception +40 -29
- data/documentation/AWS.md +15 -5
- data/documentation/Diagrams.md +1 -1
- data/documentation/Home.md +2 -2
- data/documentation/How-PWN-Works.md +1 -1
- data/documentation/What-is-PWN.md +1 -1
- data/documentation/diagrams/aws-cloud-security.svg +1 -1
- data/documentation/diagrams/dot/aws-cloud-security.dot +1 -1
- data/documentation/diagrams/dot/network-infra-testing.dot +1 -1
- data/documentation/diagrams/network-infra-testing.svg +1 -1
- data/etc/default_cron/session_cleanup.rb +84 -51
- data/lib/pwn/ai/agent/assembly.rb +0 -2
- data/lib/pwn/ai/agent/btc.rb +0 -2
- data/lib/pwn/ai/agent/burp_suite.rb +0 -2
- data/lib/pwn/ai/agent/curriculum.rb +2 -2
- data/lib/pwn/ai/agent/dispatch.rb +3 -0
- data/lib/pwn/ai/agent/engagement.rb +96 -41
- data/lib/pwn/ai/agent/extrospection/osint/bridges.rb +2 -0
- data/lib/pwn/ai/agent/extrospection.rb +50 -13
- data/lib/pwn/ai/agent/gqrx.rb +0 -2
- data/lib/pwn/ai/agent/hacker_one.rb +0 -2
- data/lib/pwn/ai/agent/learning.rb +45 -13
- data/lib/pwn/ai/agent/loop.rb +12 -11
- data/lib/pwn/ai/agent/metrics.rb +1 -1
- data/lib/pwn/ai/agent/mission.rb +6 -3
- data/lib/pwn/ai/agent/policy.rb +1 -1
- data/lib/pwn/ai/agent/policy_evaluation.rb +2 -2
- data/lib/pwn/ai/agent/reflect.rb +1 -0
- data/lib/pwn/ai/agent/request_runtime.rb +1 -1
- data/lib/pwn/ai/agent/reward.rb +155 -53
- data/lib/pwn/ai/agent/sast.rb +0 -2
- data/lib/pwn/ai/agent/task_dag.rb +5 -3
- data/lib/pwn/ai/agent/task_summarizer.rb +21 -11
- data/lib/pwn/ai/agent/tool_guard.rb +19 -0
- data/lib/pwn/ai/agent/tools/ruby_eval.rb +1 -1
- data/lib/pwn/ai/agent/tools/verify.rb +7 -3
- data/lib/pwn/ai/agent/transparent_browser.rb +0 -2
- data/lib/pwn/ai/agent/turn_finalizer.rb +3 -0
- data/lib/pwn/ai/anthropic.rb +3 -3
- data/lib/pwn/ai/context.rb +2 -1
- data/lib/pwn/ai/gemini.rb +7 -5
- data/lib/pwn/ai/grok.rb +37 -18
- data/lib/pwn/ai/mcp.rb +17 -5
- data/lib/pwn/ai/ollama.rb +76 -35
- data/lib/pwn/ai/open_ai.rb +7 -19
- data/lib/pwn/ai/open_web_ui.rb +76 -40
- data/lib/pwn/aws/cloud_search_domain.rb +6 -0
- data/lib/pwn/aws/iam.rb +2 -2
- data/lib/pwn/aws/workspaces.rb +2 -2
- data/lib/pwn/aws.rb +0 -5
- data/lib/pwn/bounty/lifecycle_authz_replay.rb +1 -1
- data/lib/pwn/config.rb +17 -10
- data/lib/pwn/corpus.rb +33 -5
- data/lib/pwn/cron.rb +60 -17
- data/lib/pwn/driver.rb +2 -3
- data/lib/pwn/engagement.rb +28 -10
- data/lib/pwn/ffi/capstone.rb +3 -2
- data/lib/pwn/ffi/fftw.rb +8 -6
- data/lib/pwn/ffi/keystone.rb +3 -2
- data/lib/pwn/ffi/soapy_sdr.rb +10 -6
- data/lib/pwn/json_text.rb +25 -13
- data/lib/pwn/memory_index.rb +6 -4
- data/lib/pwn/module_skills.rb +3 -1
- data/lib/pwn/plugins/aflplusplus.rb +1 -0
- data/lib/pwn/plugins/ai_sandbox.rb +42 -10
- data/lib/pwn/plugins/android.rb +429 -466
- data/lib/pwn/plugins/artifact_registry.rb +12 -2
- data/lib/pwn/plugins/assembly.rb +9 -42
- data/lib/pwn/plugins/authentication_helper.rb +4 -3
- data/lib/pwn/plugins/baresip.rb +70 -28
- data/lib/pwn/plugins/binary_analysis.rb +14 -5
- data/lib/pwn/plugins/binary_parser.rb +42 -7
- data/lib/pwn/plugins/black_duck_binary_analysis.rb +3 -3
- data/lib/pwn/plugins/burp_suite.rb +15 -12
- data/lib/pwn/plugins/bus_pirate.rb +3 -7
- data/lib/pwn/plugins/char.rb +9 -3
- data/lib/pwn/plugins/credit_card.rb +7 -0
- data/lib/pwn/plugins/dao_ldap.rb +2 -2
- data/lib/pwn/plugins/dao_mongo.rb +1 -1
- data/lib/pwn/plugins/debugger.rb +1 -1
- data/lib/pwn/plugins/defect_dojo.rb +7 -3
- data/lib/pwn/plugins/detect_os.rb +1 -1
- data/lib/pwn/plugins/detonate.rb +9 -19
- data/lib/pwn/plugins/exploit_db.rb +1 -1
- data/lib/pwn/plugins/file_fu.rb +4 -1
- data/lib/pwn/plugins/findings.rb +76 -2
- data/lib/pwn/plugins/fuzz.rb +12 -3
- data/lib/pwn/plugins/gdb.rb +7 -2
- data/lib/pwn/plugins/gdbmi.rb +10 -6
- data/lib/pwn/plugins/git.rb +18 -13
- data/lib/pwn/plugins/github.rb +11 -6
- data/lib/pwn/plugins/google_workspace.rb +11 -3
- data/lib/pwn/plugins/hacker_one.rb +5 -1
- data/lib/pwn/plugins/httpx.rb +24 -8
- data/lib/pwn/plugins/ip_info.rb +11 -8
- data/lib/pwn/plugins/irc.rb +73 -45
- data/lib/pwn/plugins/jenkins.rb +2 -2
- data/lib/pwn/plugins/jira_data_center.rb +13 -6
- data/lib/pwn/plugins/jobs.rb +62 -4
- data/lib/pwn/plugins/log.rb +1 -1
- data/lib/pwn/plugins/monkey_patch.rb +1 -1
- data/lib/pwn/plugins/msr206.rb +157 -182
- data/lib/pwn/plugins/nessus_cloud.rb +2 -2
- data/lib/pwn/plugins/nexpose_vuln_scan.rb +44 -33
- data/lib/pwn/plugins/nuclei.rb +24 -8
- data/lib/pwn/plugins/ocr.rb +3 -1
- data/lib/pwn/plugins/open_api.rb +0 -4
- data/lib/pwn/plugins/openvas.rb +31 -43
- data/lib/pwn/plugins/packet.rb +40 -25
- data/lib/pwn/plugins/pony.rb +2 -2
- data/lib/pwn/plugins/preflight_checker.rb +1 -1
- data/lib/pwn/plugins/process_tube.rb +17 -2
- data/lib/pwn/plugins/ps.rb +6 -1
- data/lib/pwn/plugins/repl/ai.rb +1 -0
- data/lib/pwn/plugins/repl/ai_console.rb +12 -5
- data/lib/pwn/plugins/repl/mesh.rb +10 -2
- data/lib/pwn/plugins/sbom.rb +59 -27
- data/lib/pwn/plugins/scannable_codes.rb +3 -1
- data/lib/pwn/plugins/serial.rb +102 -44
- data/lib/pwn/plugins/shodan.rb +4 -10
- data/lib/pwn/plugins/sock.rb +16 -11
- data/lib/pwn/plugins/ssn.rb +3 -1
- data/lib/pwn/plugins/transparent_browser.rb +43 -3
- data/lib/pwn/plugins/vault.rb +92 -30
- data/lib/pwn/plugins/vin.rb +2 -1
- data/lib/pwn/plugins/vsphere.rb +2 -1
- data/lib/pwn/plugins/xxd.rb +3 -5
- data/lib/pwn/plugins/yubikey/security_domain/scp.rb +4 -0
- data/lib/pwn/plugins/yubikey/transport.rb +42 -11
- data/lib/pwn/plugins/yubikey.rb +21 -6
- data/lib/pwn/plugins/zaproxy.rb +3 -4
- data/lib/pwn/reports/ai_red_team.rb +4 -4
- data/lib/pwn/reports/pdf.rb +9 -5
- data/lib/pwn/reports/sast.rb +4 -4
- data/lib/pwn/sast/keystore.rb +2 -2
- data/lib/pwn/sast/logger.rb +1 -1
- data/lib/pwn/sast/php_type_juggling.rb +3 -6
- data/lib/pwn/sast/pom_version.rb +12 -6
- data/lib/pwn/sast/port.rb +1 -1
- data/lib/pwn/sast/sql.rb +3 -7
- data/lib/pwn/sast/test_case_engine.rb +62 -16
- data/lib/pwn/sast/type_script_type_juggling.rb +3 -6
- data/lib/pwn/sdr/decoder/base.rb +8 -0
- data/lib/pwn/sdr/decoder/lora.rb +1 -1
- data/lib/pwn/sdr/flipper_zero.rb +4 -7
- data/lib/pwn/sdr/gqrx.rb +35 -16
- data/lib/pwn/sdr/son_micro_rfid.rb +44 -26
- data/lib/pwn/sdr.rb +1 -1
- data/lib/pwn/session_trace.rb +7 -2
- data/lib/pwn/sessions.rb +307 -39
- data/lib/pwn/setup.rb +4 -3
- data/lib/pwn/version.rb +1 -1
- data/lib/pwn/www/app_cobalt_io.rb +14 -2
- data/lib/pwn/www/bing.rb +13 -1
- data/lib/pwn/www/bug_crowd.rb +14 -2
- data/lib/pwn/www/checkip.rb +13 -1
- data/lib/pwn/www/coinbase_pro.rb +14 -2
- data/lib/pwn/www/duckduckgo.rb +13 -1
- data/lib/pwn/www/facebook.rb +14 -2
- data/lib/pwn/www/github.rb +14 -2
- data/lib/pwn/www/google.rb +13 -1
- data/lib/pwn/www/hacker_one.rb +117 -33
- data/lib/pwn/www/linkedin.rb +14 -2
- data/lib/pwn/www/pandora.rb +14 -2
- data/lib/pwn/www/pastebin.rb +13 -1
- data/lib/pwn/www/paypal.rb +16 -4
- data/lib/pwn/www/synack.rb +14 -2
- data/lib/pwn/www/torch.rb +17 -3
- data/lib/pwn/www/trading_view.rb +14 -2
- data/lib/pwn/www/twitter.rb +14 -2
- data/lib/pwn/www/uber.rb +14 -2
- data/lib/pwn/www/upwork.rb +14 -2
- data/lib/pwn/www/wayback_machine.rb +16 -2
- data/lib/pwn/www/youtube.rb +13 -1
- data/pwn.gemspec +4 -0
- data/spec/integration/authentication_helper_oath_spec.rb +1 -1
- data/spec/integration/autoinc_lifecycle_supplement_spec.rb +47 -0
- data/spec/integration/gemspec_deleted_files_spec.rb +43 -0
- data/spec/integration/spec_curriculum_isolation_spec.rb +41 -0
- data/spec/integration/verify_acceptance_eui_regression_spec.rb +162 -0
- data/spec/integration/web_cache_lifecycle_closure_spec.rb +89 -0
- data/spec/integration/web_cache_lifecycle_supplement_spec.rb +70 -0
- data/spec/lib/pwn/ai/agent/analysis_errors_regression_spec.rb +33 -0
- data/spec/lib/pwn/ai/agent/curriculum_cooldown_regression_spec.rb +19 -0
- data/spec/lib/pwn/ai/agent/curriculum_spec.rb +2 -0
- data/spec/lib/pwn/ai/agent/engagement_boundary_regression_spec.rb +42 -0
- data/spec/lib/pwn/ai/agent/engagement_dispatch_review_spec.rb +82 -0
- data/spec/lib/pwn/ai/agent/engagement_roe_regression_spec.rb +25 -0
- data/spec/lib/pwn/ai/agent/engagement_scope_regression_spec.rb +37 -0
- data/spec/lib/pwn/ai/agent/extrospection/osint/bridges_spec.rb +4 -0
- data/spec/lib/pwn/ai/agent/extrospection_input_regression_spec.rb +31 -0
- data/spec/lib/pwn/ai/agent/extrospection_review_spec.rb +61 -0
- data/spec/lib/pwn/ai/agent/extrospection_serial_review_spec.rb +42 -0
- data/spec/lib/pwn/ai/agent/extrospection_spec.rb +9 -0
- data/spec/lib/pwn/ai/agent/extrospection_verification_regression_spec.rb +39 -0
- data/spec/lib/pwn/ai/agent/learning_last_answer_regression_spec.rb +32 -0
- data/spec/lib/pwn/ai/agent/learning_lifecycle_closure_spec.rb +84 -0
- data/spec/lib/pwn/ai/agent/learning_prune_regression_spec.rb +17 -0
- data/spec/lib/pwn/ai/agent/learning_spec.rb +2 -1
- data/spec/lib/pwn/ai/agent/loop_execution_audit_spec.rb +30 -0
- data/spec/lib/pwn/ai/agent/metrics_usage_regression_spec.rb +20 -0
- data/spec/lib/pwn/ai/agent/mission_execution_audit_spec.rb +27 -0
- data/spec/lib/pwn/ai/agent/mission_namespace_spec.rb +210 -18
- data/spec/lib/pwn/ai/agent/policy_confidence_regression_spec.rb +16 -0
- data/spec/lib/pwn/ai/agent/policy_evaluation_spec.rb +1 -1
- data/spec/lib/pwn/ai/agent/policy_evaluation_tmp_regression_spec.rb +36 -0
- data/spec/lib/pwn/ai/agent/reflect_model_regression_spec.rb +15 -0
- data/spec/lib/pwn/ai/agent/request_runtime_execution_audit_spec.rb +43 -0
- data/spec/lib/pwn/ai/agent/reward_binding_review_spec.rb +129 -0
- data/spec/lib/pwn/ai/agent/reward_dispatch_review_spec.rb +154 -0
- data/spec/lib/pwn/ai/agent/reward_envelope_regression_spec.rb +45 -0
- data/spec/lib/pwn/ai/agent/reward_turn_regression_spec.rb +40 -0
- data/spec/lib/pwn/ai/agent/swarm_spec.rb +2 -2
- data/spec/lib/pwn/ai/agent/task_dag_execution_audit_spec.rb +45 -0
- data/spec/lib/pwn/ai/agent/task_summarizer_failure_regression_spec.rb +26 -0
- data/spec/lib/pwn/ai/agent/tools/verify_execution_audit_spec.rb +33 -0
- data/spec/lib/pwn/ai/context_range_audit_spec.rb +24 -0
- data/spec/lib/pwn/ai/gemini_roundtrip_audit_spec.rb +33 -0
- data/spec/lib/pwn/ai/grok_reasoning_effort_spec.rb +43 -0
- data/spec/lib/pwn/ai/mcp_session_audit_spec.rb +36 -0
- data/spec/lib/pwn/ai/ollama_spec.rb +6 -11
- data/spec/lib/pwn/ai/open_web_ui_spec.rb +6 -11
- data/spec/lib/pwn/ai/provider_history_audit_spec.rb +44 -0
- data/spec/lib/pwn/ai/provider_operations_audit_spec.rb +53 -0
- data/spec/lib/pwn/ai/provider_review_history_stream_regression_spec.rb +143 -0
- data/spec/lib/pwn/ai/provider_review_tls_regression_spec.rb +62 -0
- data/spec/lib/pwn/ai/provider_stream_audit_spec.rb +49 -0
- data/spec/lib/pwn/aws/iam_decoding_regression_spec.rb +23 -0
- data/spec/lib/pwn/aws/services_runtime_regression_spec.rb +51 -0
- data/spec/lib/pwn/aws_spec.rb +6 -0
- data/spec/lib/pwn/banner_operational_audit_spec.rb +105 -0
- data/spec/lib/pwn/bounty/lifecycle_authz_replay_spec.rb +17 -0
- data/spec/lib/pwn/config_redaction_regression_spec.rb +24 -0
- data/spec/lib/pwn/config_skills_regression_spec.rb +38 -0
- data/spec/lib/pwn/corpus_core_review_regression_spec.rb +96 -0
- data/spec/lib/pwn/corpus_spec.rb +13 -0
- data/spec/lib/pwn/cron_core_review_regression_spec.rb +95 -0
- data/spec/lib/pwn/cron_execution_spec.rb +75 -0
- data/spec/lib/pwn/driver_core_review_regression_spec.rb +38 -0
- data/spec/lib/pwn/driver_spec.rb +13 -0
- data/spec/lib/pwn/engagement_core_review_regression_spec.rb +88 -0
- data/spec/lib/pwn/engagement_storage_regression_spec.rb +44 -0
- data/spec/lib/pwn/ffi/capstone_spec.rb +19 -0
- data/spec/lib/pwn/ffi/fftw_spec.rb +19 -0
- data/spec/lib/pwn/ffi/keystone_spec.rb +13 -0
- data/spec/lib/pwn/ffi/soapy_sdr_spec.rb +13 -0
- data/spec/lib/pwn/json_text_spec.rb +25 -0
- data/spec/lib/pwn/memory_index_spec.rb +23 -0
- data/spec/lib/pwn/module_skills_parsing_regression_spec.rb +34 -0
- data/spec/lib/pwn/plugins/ai_sandbox_boundary_review_spec.rb +57 -0
- data/spec/lib/pwn/plugins/ai_sandbox_spec.rb +10 -18
- data/spec/lib/pwn/plugins/android_review_fixes_spec.rb +121 -0
- data/spec/lib/pwn/plugins/android_transport_audit_spec.rb +64 -0
- data/spec/lib/pwn/plugins/api_import_namespace_audit_spec.rb +49 -0
- data/spec/lib/pwn/plugins/artifact_registry_namespace_audit_spec.rb +20 -0
- data/spec/lib/pwn/plugins/artifact_registry_review_fixes_spec.rb +63 -0
- data/spec/lib/pwn/plugins/assembly_namespace_audit_spec.rb +16 -0
- data/spec/lib/pwn/plugins/assembly_review_fixes_spec.rb +33 -0
- data/spec/lib/pwn/plugins/authentication_helper_spec.rb +14 -0
- data/spec/lib/pwn/plugins/baresip_review_fixes_spec.rb +127 -0
- data/spec/lib/pwn/plugins/baresip_transport_audit_spec.rb +59 -0
- data/spec/lib/pwn/plugins/binary_analysis_process_review_spec.rb +57 -0
- data/spec/lib/pwn/plugins/black_duck_namespace_audit_spec.rb +25 -0
- data/spec/lib/pwn/plugins/burp_suite_har_review_fixes_spec.rb +60 -0
- data/spec/lib/pwn/plugins/burp_suite_import_review_fixes_spec.rb +62 -0
- data/spec/lib/pwn/plugins/burp_suite_namespace_audit_spec.rb +37 -0
- data/spec/lib/pwn/plugins/bus_pirate_transport_audit_spec.rb +19 -0
- data/spec/lib/pwn/plugins/file_fu_namespace_audit_spec.rb +17 -0
- data/spec/lib/pwn/plugins/findings_structured_spec.rb +1 -1
- data/spec/lib/pwn/plugins/gdbmi_namespace_audit_spec.rb +28 -0
- data/spec/lib/pwn/plugins/gdbmi_review_fixes_spec.rb +73 -0
- data/spec/lib/pwn/plugins/github_argv_review_spec.rb +49 -0
- data/spec/lib/pwn/plugins/google_workspace_provider_review_oauth_spec.rb +80 -0
- data/spec/lib/pwn/plugins/irc_review_fixes_spec.rb +92 -0
- data/spec/lib/pwn/plugins/irc_transport_audit_spec.rb +37 -0
- data/spec/lib/pwn/plugins/jenkins_namespace_audit_spec.rb +12 -0
- data/spec/lib/pwn/plugins/jira_data_center_namespace_audit_spec.rb +44 -0
- data/spec/lib/pwn/plugins/jira_data_center_review_fixes_spec.rb +81 -0
- data/spec/lib/pwn/plugins/jsonl_elf_review_fixes_spec.rb +59 -0
- data/spec/lib/pwn/plugins/log_spec.rb +36 -20
- data/spec/lib/pwn/plugins/monkey_patch_spec.rb +16 -0
- data/spec/lib/pwn/plugins/msr206_readback_review_fixes_spec.rb +119 -0
- data/spec/lib/pwn/plugins/msr206_review_fixes_spec.rb +50 -0
- data/spec/lib/pwn/plugins/msr206_transport_audit_spec.rb +64 -0
- data/spec/lib/pwn/plugins/nessus_cloud_namespace_audit_spec.rb +14 -0
- data/spec/lib/pwn/plugins/nexpose_review_fixes_spec.rb +55 -0
- data/spec/lib/pwn/plugins/open_api_namespace_audit_spec.rb +22 -0
- data/spec/lib/pwn/plugins/packet_transport_audit_spec.rb +47 -0
- data/spec/lib/pwn/plugins/plugins_b_operational_regression_spec.rb +600 -0
- data/spec/lib/pwn/plugins/pony_namespace_audit_spec.rb +17 -0
- data/spec/lib/pwn/plugins/pony_review_fixes_spec.rb +33 -0
- data/spec/lib/pwn/plugins/process_tube_namespace_audit_spec.rb +19 -0
- data/spec/lib/pwn/plugins/ps_namespace_audit_spec.rb +12 -0
- data/spec/lib/pwn/plugins/repl/ai_console_spec.rb +111 -0
- data/spec/lib/pwn/plugins/repl/ai_spec.rb +38 -0
- data/spec/lib/pwn/plugins/repl/mesh_spec.rb +52 -0
- data/spec/lib/pwn/plugins/sandbox_spec.rb +9 -7
- data/spec/lib/pwn/plugins/sbom_review_fixes_spec.rb +43 -0
- data/spec/lib/pwn/plugins/scannable_codes_namespace_audit_spec.rb +15 -0
- data/spec/lib/pwn/plugins/serial_review_fixes_spec.rb +76 -0
- data/spec/lib/pwn/plugins/serial_transport_audit_spec.rb +102 -0
- data/spec/lib/pwn/plugins/shodan_namespace_audit_spec.rb +10 -0
- data/spec/lib/pwn/plugins/sock_transport_audit_spec.rb +55 -0
- data/spec/lib/pwn/plugins/transparent_browser_navigation_review_spec.rb +21 -0
- data/spec/lib/pwn/plugins/vault_master_key_eui_regression_spec.rb +242 -0
- data/spec/lib/pwn/plugins/vault_spec.rb +58 -0
- data/spec/lib/pwn/plugins/vault_store_safety_spec.rb +1 -1
- data/spec/lib/pwn/plugins/xxd_namespace_audit_spec.rb +34 -0
- data/spec/lib/pwn/plugins/yubikey_hid_cleanup_review_fixes_spec.rb +52 -0
- data/spec/lib/pwn/plugins/yubikey_lifecycle_audit_spec.rb +65 -0
- data/spec/lib/pwn/plugins/yubikey_options_audit_spec.rb +30 -0
- data/spec/lib/pwn/plugins/yubikey_selector_audit_spec.rb +26 -0
- data/spec/lib/pwn/plugins/yubikey_spec.rb +1 -1
- data/spec/lib/pwn/plugins/zaproxy_namespace_audit_spec.rb +30 -0
- data/spec/lib/pwn/reports/empty_report_audit_spec.rb +18 -0
- data/spec/lib/pwn/reports/pdf_spec.rb +25 -0
- data/spec/lib/pwn/reports/provider_review_encoding_regression_spec.rb +45 -0
- data/spec/lib/pwn/sast/engine_runtime_regression_spec.rb +91 -0
- data/spec/lib/pwn/sast/filter_edge_regression_spec.rb +39 -0
- data/spec/lib/pwn/sast/formatter_review_fixes_spec.rb +178 -0
- data/spec/lib/pwn/sast/path_review_fixes_spec.rb +60 -0
- data/spec/lib/pwn/sast/pom_runtime_regression_spec.rb +37 -0
- data/spec/lib/pwn/sast/rules_runtime_regression_spec.rb +78 -0
- data/spec/lib/pwn/sast/sql_review_fixes_spec.rb +38 -0
- data/spec/lib/pwn/sdr/decoder/base_iq_spec.rb +21 -18
- data/spec/lib/pwn/sdr/decoder/base_review_fixes_spec.rb +49 -0
- data/spec/lib/pwn/sdr/decoder/base_validation_spec.rb +78 -0
- data/spec/lib/pwn/sdr/decoder/lora_spec.rb +9 -0
- data/spec/lib/pwn/sdr/flipper_zero_review_fixes_spec.rb +34 -0
- data/spec/lib/pwn/sdr/gqrx_operational_spec.rb +83 -0
- data/spec/lib/pwn/sdr/gqrx_review_fixes_spec.rb +22 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_review_fixes_spec.rb +113 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_serial_review_fixes_spec.rb +76 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_spec.rb +39 -0
- data/spec/lib/pwn/sdr_spec.rb +5 -0
- data/spec/lib/pwn/session_cleanup_default_spec.rb +1 -1
- data/spec/lib/pwn/session_cleanup_lifecycle_supplement_spec.rb +39 -0
- data/spec/lib/pwn/session_cleanup_payload_spec.rb +3 -2
- data/spec/lib/pwn/session_trace_lifecycle_supplement_spec.rb +39 -0
- data/spec/lib/pwn/sessions_archive_closure_spec.rb +126 -0
- data/spec/lib/pwn/sessions_lifecycle_closure_spec.rb +373 -0
- data/spec/lib/pwn/sessions_lifecycle_supplement_spec.rb +204 -0
- data/spec/lib/pwn/setup_operational_regression_spec.rb +36 -0
- data/spec/lib/pwn/www/browser_review_fixes_spec.rb +70 -0
- data/spec/lib/pwn/www/browser_runtime_regression_spec.rb +100 -0
- data/spec/lib/pwn/www/hacker_one_runtime_regression_spec.rb +146 -0
- data/spec/lib/pwn/www/pagination_review_fixes_spec.rb +84 -0
- data/spec/support/namespace_controller_observability_fixture.rb +141 -0
- data/spec/support/sandbox.rb +8 -5
- data/third_party/pwn_rdoc.jsonl +73 -31
- metadata +137 -18
- data/etc/default_skills/pwn/aws/elastic_transcoder/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/lambda_preview/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/ops_works/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/ops_works_cm/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/sms/SKILL.md +0 -48
- data/lib/pwn/aws/elastic_transcoder.rb +0 -95
- data/lib/pwn/aws/lambda_preview.rb +0 -95
- data/lib/pwn/aws/ops_works.rb +0 -95
- data/lib/pwn/aws/ops_works_cm.rb +0 -95
- data/lib/pwn/aws/sms.rb +0 -95
- data/spec/lib/pwn/aws/elastic_transcoder_spec.rb +0 -15
- data/spec/lib/pwn/aws/lambda_preview_spec.rb +0 -15
- data/spec/lib/pwn/aws/ops_works_cm_spec.rb +0 -15
- data/spec/lib/pwn/aws/ops_works_spec.rb +0 -15
- data/spec/lib/pwn/aws/sms_spec.rb +0 -15
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::Plugins::MSR206 do
|
|
6
|
+
before do
|
|
7
|
+
@commands = []
|
|
8
|
+
@log = StringIO.new
|
|
9
|
+
allow(described_class).to receive(:logger).and_return(Logger.new(@log))
|
|
10
|
+
allow(PWN::Plugins::Serial).to receive(:flush_session_data)
|
|
11
|
+
allow(PWN::Plugins::Serial).to receive(:request) { |options| @commands << options[:payload].dup }
|
|
12
|
+
allow(PWN::Plugins::Serial).to receive(:response) do
|
|
13
|
+
case @commands.last&.first
|
|
14
|
+
when 0x26 then ['3E']
|
|
15
|
+
when 0x51, 0x71, 0x55 then ['41 41 41']
|
|
16
|
+
when 0x52, 0x72, 0x56 then ['42 42 42']
|
|
17
|
+
when 0x53, 0x73, 0x57 then ['43 43 43']
|
|
18
|
+
else ['5E']
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
{ iso: [[], [], []], iso_alt: [[0x31], [0x32], [0x33]], raw: [[0x5f, 0x35], [0x34], [0x37]] }.each do |encoding, formats|
|
|
24
|
+
it "verifies actual #{encoding} command parsing using exactly the written per-track formats" do
|
|
25
|
+
tracks = %w[AAA BBB CCC].each_with_index.map { |text, i| { decoded: text, track_format: formats[i] } }
|
|
26
|
+
original = Marshal.dump(tracks)
|
|
27
|
+
choice = { iso: 'I', iso_alt: 'A', raw: 'R' }.fetch(encoding)
|
|
28
|
+
allow(described_class).to receive(:gets).and_return("H\n", "H\n", "#{choice}\n")
|
|
29
|
+
result = nil
|
|
30
|
+
expect { result = described_class.write_card(msr206_obj: {}, encoding: encoding, track_data: tracks) }.not_to output(/AAA|BBB|CCC/).to_stdout
|
|
31
|
+
expect(result).to equal(tracks)
|
|
32
|
+
expect(Marshal.dump(tracks)).to eq(original)
|
|
33
|
+
readers = { iso: [0x51, 0x52, 0x53], iso_alt: [0x71, 0x72, 0x73], raw: [0x55, 0x56, 0x57] }.fetch(encoding)
|
|
34
|
+
expect(@commands.select { |cmd| readers.include?(cmd.first) }).to eq(readers.each_with_index.map { |cmd, i| [cmd] + formats[i] })
|
|
35
|
+
expect(@commands.last).to eq([0x7f])
|
|
36
|
+
expect(@commands).to include([encoding == :raw ? 0x40 : 0x5a])
|
|
37
|
+
expect(@log.string).not_to match(/AAA|BBB|CCC|41 41 41|42 42 42|43 43 43/)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "rejects #{encoding} readback mismatches and does not replay or reset" do
|
|
41
|
+
tracks = %w[AAA BBB wrong].each_with_index.map { |text, i| { decoded: text, track_format: formats[i] } }
|
|
42
|
+
choice = { iso: 'I', iso_alt: 'A', raw: 'R' }.fetch(encoding)
|
|
43
|
+
allow(described_class).to receive(:gets).and_return("H\n", "H\n", "#{choice}\n")
|
|
44
|
+
expect { described_class.write_card(msr206_obj: {}, encoding: encoding, track_data: tracks) }.to raise_error(IOError, /readback mismatch/)
|
|
45
|
+
expect(@commands).not_to include([0x7f])
|
|
46
|
+
expect(@commands.count { |cmd| [0x41, 0x61, 0x45].include?(cmd.first) }).to eq(1)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
%i[iso_alt raw].each do |encoding|
|
|
51
|
+
it "accepts actual #{encoding} backup candidates only with explicit format selections" do
|
|
52
|
+
choice = encoding == :iso_alt ? 'A' : 'R'
|
|
53
|
+
allow(described_class).to receive(:gets).and_return("#{choice}\n")
|
|
54
|
+
tracks = described_class.read_card(msr206_obj: {})
|
|
55
|
+
expect(tracks.length).to eq(encoding == :iso_alt ? 9 : 30)
|
|
56
|
+
@commands.clear
|
|
57
|
+
formats = encoding == :iso_alt ? [[0x31], [0x32], [0x33]] : [[0x33], [0x5f, 0x34], [0x37]]
|
|
58
|
+
allow(described_class).to receive(:gets).and_return("H\n", "H\n", "#{choice}\n")
|
|
59
|
+
expect(described_class.write_card(msr206_obj: {}, encoding: encoding, track_data: tracks, track_formats: formats)).to eq(tracks)
|
|
60
|
+
expect(@commands.last).to eq([0x7f])
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it 'uses explicit format selections for three manual tracks without per-row format metadata' do
|
|
65
|
+
tracks = %w[AAA BBB CCC].map { |text| { decoded: text } }
|
|
66
|
+
formats = [[0x32], [0x31], [0x33]]
|
|
67
|
+
allow(described_class).to receive(:gets).and_return("H\n")
|
|
68
|
+
expect(described_class.write_card(msr206_obj: {}, encoding: :iso_alt, track_data: tracks, track_formats: formats)).to eq(tracks)
|
|
69
|
+
expect(@commands.select { |cmd| [0x71, 0x72, 0x73].include?(cmd.first) }).to eq([[0x71, 0x32], [0x72, 0x31], [0x73, 0x33]])
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
%i[clone_card load_card_from_file].each do |operation|
|
|
73
|
+
it "forwards explicit candidate formats through real #{operation} orchestration" do
|
|
74
|
+
Dir.mktmpdir('msr-backup-') do |root|
|
|
75
|
+
backup = File.join(root, 'synthetic.json')
|
|
76
|
+
allow(described_class).to receive(:gets).and_return("A\n", "#{backup}\n")
|
|
77
|
+
described_class.backup_card(msr206_obj: {}) if operation == :load_card_from_file
|
|
78
|
+
answers = operation == :clone_card ? ["A\n", "#{backup}\n", "H\n", "H\n"] : ["#{backup}\n", "H\n", "H\n"]
|
|
79
|
+
allow(described_class).to receive(:gets).and_return(*answers)
|
|
80
|
+
result = described_class.public_send(operation, msr206_obj: {}, track_formats: [[0x31], [0x32], [0x33]])
|
|
81
|
+
expect(result.length).to eq(9)
|
|
82
|
+
expect(@commands.last).to eq([0x7f])
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it 'does not confuse command acknowledgments with track readback' do
|
|
88
|
+
allow(PWN::Plugins::Serial).to receive(:response).and_return(['5E'])
|
|
89
|
+
allow(described_class).to receive(:gets).and_return("H\n", "H\n", "I\n")
|
|
90
|
+
tracks = Array.new(3) { { decoded: '^' } }
|
|
91
|
+
expect { described_class.write_card(msr206_obj: {}, encoding: :iso, track_data: tracks) }.to raise_error(IOError, /readback/)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it 'does not disclose synthetic track bodies in the public update prompts' do
|
|
95
|
+
Dir.mktmpdir('msr-update-') do |root|
|
|
96
|
+
allow(described_class).to receive(:gets).and_return("I\n", "#{File.join(root, 'synthetic.json')}\n", "\n", "\n", "\n", "N\n")
|
|
97
|
+
result = nil
|
|
98
|
+
expect { result = described_class.update_card(msr206_obj: {}) }.not_to output(/AAA|BBB|CCC/).to_stdout
|
|
99
|
+
expect(result.map { |track| track[:decoded] }).to eq(%w[AAA BBB CCC])
|
|
100
|
+
expect(@log.string).not_to match(/AAA|BBB|CCC/)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
it 'uses the prevalidated immutable batch even if the caller changes its source during prompts' do
|
|
105
|
+
tracks = %w[AAA BBB CCC].map { |text| { decoded: text } }
|
|
106
|
+
allow(described_class).to receive(:gets) do
|
|
107
|
+
tracks[0][:decoded] = 'changed'
|
|
108
|
+
"H\n"
|
|
109
|
+
end
|
|
110
|
+
# Old read_card prompts indefinitely on H; fail that old path without hardware.
|
|
111
|
+
allow(described_class).to receive(:read_card).and_wrap_original do |original, options|
|
|
112
|
+
raise IOError, 'readback was not format-correlated' unless options[:encoding]
|
|
113
|
+
|
|
114
|
+
original.call(options)
|
|
115
|
+
end
|
|
116
|
+
expect(described_class.write_card(msr206_obj: {}, encoding: :iso, track_data: tracks)).to eq(tracks)
|
|
117
|
+
expect(@commands).to include([0x41, 0x41, 0x41, 0x41, 0x04])
|
|
118
|
+
end
|
|
119
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::Plugins::MSR206 do
|
|
6
|
+
before do
|
|
7
|
+
@commands = []
|
|
8
|
+
@log = StringIO.new
|
|
9
|
+
allow(described_class).to receive(:logger).and_return(Logger.new(@log))
|
|
10
|
+
allow(PWN::Plugins::Serial).to receive(:request) { |options| @commands << options[:payload].dup }
|
|
11
|
+
allow(PWN::Plugins::Serial).to receive(:response).and_return(['5E'])
|
|
12
|
+
allow(PWN::Plugins::Serial).to receive(:flush_session_data)
|
|
13
|
+
allow(described_class).to receive(:gets).and_return("H\n")
|
|
14
|
+
allow(described_class).to receive(:read_card).and_return([{ decoded: 'A' }, { decoded: 'B' }, { decoded: 'C' }])
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
[nil, false].each do |selector|
|
|
18
|
+
it "rejects explicit #{selector.inspect} MSR selectors without substituting a device" do
|
|
19
|
+
allow(File).to receive(:exist?).and_call_original
|
|
20
|
+
allow(File).to receive(:exist?).with('/dev/ttyUSB0').and_return(true)
|
|
21
|
+
expect(UART).not_to receive(:open)
|
|
22
|
+
expect { described_class.connect(block_dev: selector) }.to raise_error(ArgumentError)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
%i[iso_alt raw].each do |encoding|
|
|
27
|
+
[nil, false, 'invalid', [], [256], [0x5f], [0x31, 0x32]].each do |format|
|
|
28
|
+
it "prevalidates all #{encoding} formats including later malformed #{format.inspect}" do
|
|
29
|
+
tracks = [{ decoded: 'A' }, { decoded: 'B', track_format: format }, { decoded: 'C' }]
|
|
30
|
+
expect { described_class.write_card(msr206_obj: {}, encoding: encoding, track_data: tracks) }.to raise_error(ArgumentError)
|
|
31
|
+
expect(@commands).to be_empty
|
|
32
|
+
expect(described_class).not_to have_received(:gets)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
%i[iso iso_alt raw].each do |encoding|
|
|
38
|
+
["synthetic\x04", "synthetic\0", "synthetic\n", "synthetic\u00e9", 'A' * 1024].each do |payload|
|
|
39
|
+
it "rejects unencodable #{encoding} payloads before prompting or device commands" do
|
|
40
|
+
tracks = [{ decoded: 'A' }, { decoded: 'B' }, { decoded: payload }]
|
|
41
|
+
# The existing implementation can reach readback: keep that old path bounded.
|
|
42
|
+
allow(described_class).to receive(:read_card).and_return(tracks)
|
|
43
|
+
expect { described_class.write_card(msr206_obj: {}, encoding: encoding, track_data: tracks) }.to raise_error(ArgumentError)
|
|
44
|
+
expect(@commands).to be_empty
|
|
45
|
+
expect(described_class).not_to have_received(:gets)
|
|
46
|
+
expect(@log.string).not_to include(payload)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::Plugins::MSR206 do
|
|
6
|
+
let(:track_data) { [{ decoded: 'fixture-one' }, { decoded: 'fixture-two' }, { decoded: 'fixture-three' }] }
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
@log = StringIO.new
|
|
10
|
+
allow(described_class).to receive(:logger).and_return(Logger.new(@log))
|
|
11
|
+
allow(PWN::Plugins::Serial).to receive(:flush_session_data)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'compares the readback to the requested track data, not write acknowledgments' do
|
|
15
|
+
allow(described_class).to receive(:gets).and_return("H\n")
|
|
16
|
+
allow(described_class).to receive(:exec).and_return(msg: :ack_command_completed)
|
|
17
|
+
allow(described_class).to receive(:wait_for_swipe).and_return([{ decoded: '^' }])
|
|
18
|
+
readback = track_data.each_with_index.map do |track, index|
|
|
19
|
+
track.merge(msg: :response, cmd: :"tx_iso_std_data_track#{index + 1}", encoding: :iso, track_format: [])
|
|
20
|
+
end
|
|
21
|
+
allow(described_class).to receive(:read_card).and_return(readback)
|
|
22
|
+
expect(described_class.write_card(msr206_obj: {}, encoding: :iso, track_data: track_data)).to eq(track_data)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'fails on a mismatching readback instead of returning apparent write success' do
|
|
26
|
+
allow(described_class).to receive(:gets).and_return("H\n")
|
|
27
|
+
allow(described_class).to receive(:exec).and_return(msg: :ack_command_completed)
|
|
28
|
+
allow(described_class).to receive(:wait_for_swipe).and_return([{ decoded: '^' }])
|
|
29
|
+
allow(described_class).to receive(:read_card).and_return([{ decoded: 'different' }])
|
|
30
|
+
expect { described_class.write_card(msr206_obj: {}, encoding: :iso, track_data: track_data) }.to raise_error(IOError, /readback/)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'validates the whole write batch before changing density or writing the first track' do
|
|
34
|
+
allow(described_class).to receive(:gets).and_return("H\n")
|
|
35
|
+
allow(described_class).to receive(:exec).and_raise('fixture guard: device write before validation')
|
|
36
|
+
expect { described_class.write_card(msr206_obj: {}, encoding: :iso, track_data: [{ decoded: 'partial' }]) }.to raise_error(ArgumentError, /three tracks/)
|
|
37
|
+
expect(described_class).not_to have_received(:exec)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'keeps command bytes and track responses out of diagnostic logs' do
|
|
41
|
+
allow(PWN::Plugins::Serial).to receive(:request)
|
|
42
|
+
allow(described_class).to receive(:parse_responses).and_return(decoded: 'fixture-private-track', hex: ['73 65 63 72 65 74'])
|
|
43
|
+
described_class.exec(msr206_obj: {}, cmd: :load_iso_std_data_for_writing_track1, params: [115, 101, 99, 114, 101, 116])
|
|
44
|
+
expect(@log.string).not_to include('fixture-private-track', '73 65 63 72 65 74', '[115, 101, 99, 114, 101, 116]')
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
%i[arm_to_read arm_to_write_no_raw].each do |type|
|
|
48
|
+
%i[iso iso_alt raw].each do |encoding|
|
|
49
|
+
it "keeps #{type} #{encoding} track payloads off diagnostic stdout" do
|
|
50
|
+
allow(described_class).to receive(:exec).and_return(msg: :ack_command_completed, decoded: 'fixture-private-track')
|
|
51
|
+
allow(described_class).to receive(:parse_responses).and_return(msg: :ack_command_completed)
|
|
52
|
+
expect do
|
|
53
|
+
described_class.send(:wait_for_swipe, msr206_obj: {}, type: type, encoding: encoding, track_data: track_data)
|
|
54
|
+
end.not_to output(/fixture-private-track|102, 105, 120, 116/).to_stdout
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'rejects unknown protocol selectors rather than sending USI1' do
|
|
60
|
+
allow(described_class).to receive(:exec)
|
|
61
|
+
expect { described_class.set_protocol(msr206_obj: {}, protocol: :typo) }.to raise_error(ArgumentError, /protocol/)
|
|
62
|
+
expect(described_class).not_to have_received(:exec)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'rest-client'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PWN::Plugins::NessusCloud, 'credential defaults regression' do
|
|
7
|
+
it 'selects the documented Host SSH defaults when no filters are passed' do
|
|
8
|
+
allow(described_class).to receive(:sleep)
|
|
9
|
+
allow(PWN::Plugins::TransparentBrowser).to receive(:open).and_return(browser: RestClient)
|
|
10
|
+
response = double('response', body: { credentials: [{ category: 'Host', types: [{ name: 'SSH', id: 'ssh' }] }] }.to_json)
|
|
11
|
+
allow(RestClient::Request).to receive(:execute).and_return(response)
|
|
12
|
+
expect(described_class.get_credential_types(nessus_obj: {})).to eq(name: 'SSH', id: 'ssh')
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::Plugins::NexposeVulnScan do
|
|
6
|
+
let(:client) { double('nexpose') }
|
|
7
|
+
let(:logger) { described_class.class_variable_get(:@@logger) }
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
allow(client).to receive(:list_sites).and_return([double('site', name: 'fixture', id: 7)])
|
|
11
|
+
allow(client).to receive(:scan_site).with(7).and_return(41)
|
|
12
|
+
allow(logger).to receive(:info)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it '[PBR-05] does not call an aborted activity row completed' do
|
|
16
|
+
allow(client).to receive(:scan_activity).and_return([double('scan', site_id: 7, status: 'aborted')])
|
|
17
|
+
expect(described_class.scan_site_by_name(nsc_obj: client, site_name: 'fixture', poll_interval: 0)).to be_nil
|
|
18
|
+
expect(logger).not_to have_received(:info).with(/Completed/)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it '[PBR-05] polls the launched site through active states to explicit success' do
|
|
22
|
+
foreign = double('foreign', site_id: 7, scan_id: 40, status: 'finished')
|
|
23
|
+
allow(client).to receive(:scan_activity).and_return(
|
|
24
|
+
[foreign, double('scan', site_id: 7, scan_id: 41, status: 'dispatched')],
|
|
25
|
+
[foreign, double('scan', site_id: 7, scan_id: 41, status: 'paused')],
|
|
26
|
+
[foreign, double('scan', site_id: 7, scan_id: 41, status: 'integrating')],
|
|
27
|
+
[foreign, double('scan', site_id: 7, scan_id: 41, status: 'finished')]
|
|
28
|
+
)
|
|
29
|
+
expect(described_class.scan_site_by_name(nsc_obj: client, site_name: 'fixture', poll_interval: 0)).to equal(client)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it '[PBR-05] bounds persistent active states and reports unknown, not success' do
|
|
33
|
+
allow(client).to receive(:scan_activity).and_return([double('scan', site_id: 7, scan_id: 41, status: 'running')])
|
|
34
|
+
expect { described_class.scan_site_by_name(nsc_obj: client, site_name: 'fixture', poll_interval: 0, max_polls: 2) }.to raise_error(IOError, /unknown.*poll limit/)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it '[PBR-05] bounds a blocked activity request' do
|
|
38
|
+
allow(client).to receive(:scan_activity) { sleep 1 }
|
|
39
|
+
expect { described_class.scan_site_by_name(nsc_obj: client, site_name: 'fixture', timeout: 0.01) }.to raise_error(IOError, /unknown.*deadline/)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
[nil, 'unknown', 'SYNTHETIC-PRIVATE-STATUS'].each do |status|
|
|
43
|
+
it "[PBR-05] treats #{status.inspect} status as incomplete without echoing it" do
|
|
44
|
+
allow(client).to receive(:scan_activity).and_return([double('scan', site_id: 7, scan_id: 41, status: status)])
|
|
45
|
+
expect(described_class.scan_site_by_name(nsc_obj: client, site_name: 'fixture', poll_interval: 0)).to be_nil
|
|
46
|
+
expect(logger).not_to have_received(:info).with(/SYNTHETIC-PRIVATE-STATUS|Completed/)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it '[PBR-05] refuses a missing launch identity rather than polling unrelated activity' do
|
|
51
|
+
allow(client).to receive(:scan_site).and_return(nil)
|
|
52
|
+
expect(client).not_to receive(:scan_activity)
|
|
53
|
+
expect { described_class.scan_site_by_name(nsc_obj: client, site_name: 'fixture') }.to raise_error(IOError, /unknown.*identity/)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'tmpdir'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PWN::Plugins::OpenAPI, 'root path regression' do
|
|
7
|
+
it 'retains a root endpoint when normalizing server path prefixes' do
|
|
8
|
+
Dir.mktmpdir('openapi-audit') do |dir|
|
|
9
|
+
source = File.join(dir, 'input.json')
|
|
10
|
+
output = File.join(dir, 'output.json')
|
|
11
|
+
File.write(source, JSON.generate(openapi: '3.0.3', info: { title: 'Fixture', version: '1' }, paths: { '/' => { get: { responses: { '200' => { description: 'OK' } } } } }))
|
|
12
|
+
allow(RestClient).to receive(:get).and_return('{"type":"object"}')
|
|
13
|
+
previous_dir = Dir.pwd
|
|
14
|
+
begin
|
|
15
|
+
described_class.generate_spec(spec_paths: [source], base_url: 'https://example.invalid', output_json_path: output)
|
|
16
|
+
expect(JSON.parse(File.read(output))['paths']).to have_key('/')
|
|
17
|
+
ensure
|
|
18
|
+
Dir.chdir(previous_dir)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::Plugins::Packet, 'offline constructors' do
|
|
6
|
+
let(:options) do
|
|
7
|
+
{ ip_saddr: '192.0.2.1', ip_daddr: '192.0.2.2', ipv6_saddr: '2001:db8::1', ipv6_daddr: '2001:db8::2',
|
|
8
|
+
eth_src: '00:11:22:33:44:55', eth_dst: '00:11:22:33:44:66', arp_src_mac: '00:11:22:33:44:55', arp_dst_mac: '00:11:22:33:44:66' }
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
before do
|
|
12
|
+
# Never let a constructor discover interfaces or send PacketFu's ARP probe.
|
|
13
|
+
allow(PacketFu::Utils).to receive(:whoami?).and_return({})
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
%i[arp eth hsrp icmp icmpv6 ip ipv6 tcp udp].each do |protocol|
|
|
17
|
+
it "constructs #{protocol} without network discovery" do
|
|
18
|
+
packet = described_class.public_send(:"construct_#{protocol}", options)
|
|
19
|
+
expect(packet.to_s).not_to be_empty
|
|
20
|
+
expect(PacketFu::Utils).not_to have_received(:whoami?)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'preserves distinct HSRP state and hello-time values' do
|
|
25
|
+
packet = described_class.construct_hsrp(options.merge(hsrp_state: 16, hsrp_hellotime: 7))
|
|
26
|
+
expect(packet.hsrp_state).to eq(16)
|
|
27
|
+
expect(packet.hsrp_hellotime).to eq(7)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'encodes IPv6 traffic class, flow label, next header and hop limit' do
|
|
31
|
+
packet = described_class.construct_ipv6(options.merge(ipv6_class: 42, ipv6_label: 1234, ipv6_next: 59, ipv6_hop: 7))
|
|
32
|
+
expect(packet.to_s.byteslice(14, 8).unpack('NnCC')).to eq([0x62a004d2, 0, 59, 7])
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'uses the ICMPv6 packet class and caller checksum rather than IPv4 fields' do
|
|
36
|
+
packet = described_class.construct_icmpv6(options.merge(icmpv6_type: 129, icmpv6_sum: 0x1234))
|
|
37
|
+
expect(packet).to be_a(PacketFu::ICMPv6Packet)
|
|
38
|
+
expect(packet.to_s.byteslice(54, 4).unpack('CCn')).to eq([129, 0, 0x1234])
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'forwards TCP flags and options into the serialized packet' do
|
|
42
|
+
flags = PacketFu::TcpFlags.new(syn: 1)
|
|
43
|
+
packet = described_class.construct_tcp(options.merge(tcp_flags: flags, tcp_opts: "\x01\x01\x01\x01".b))
|
|
44
|
+
expect(packet.tcp_flags.syn).to eq(1)
|
|
45
|
+
expect(packet.tcp_opts).to eq("\x01\x01\x01\x01".b)
|
|
46
|
+
end
|
|
47
|
+
end
|