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,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'timeout'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PWN::Plugins::GDBMI, 'review execution outcome regressions' do
|
|
7
|
+
def with_mi_peer(execution)
|
|
8
|
+
request_r, request_w = IO.pipe
|
|
9
|
+
response_r, response_w = IO.pipe
|
|
10
|
+
commands = []
|
|
11
|
+
peer = Thread.new do
|
|
12
|
+
response_w.write("(gdb)\n")
|
|
13
|
+
while (line = request_r.gets)
|
|
14
|
+
command = line.strip
|
|
15
|
+
commands << command
|
|
16
|
+
break if command == '-gdb-exit'
|
|
17
|
+
|
|
18
|
+
response_w.write(command == '-exec-run' ? "#{execution}\n(gdb)\n" : "^done\n(gdb)\n")
|
|
19
|
+
end
|
|
20
|
+
ensure
|
|
21
|
+
response_w.close unless response_w.closed?
|
|
22
|
+
request_r.close unless request_r.closed?
|
|
23
|
+
end
|
|
24
|
+
allow(Open3).to receive(:popen2).and_return([request_w, response_r, peer])
|
|
25
|
+
allow(PWN::Plugins::PreflightChecker).to receive(:bin?).with(name: 'gdb').and_return(true)
|
|
26
|
+
Timeout.timeout(2) { yield commands }
|
|
27
|
+
expect(peer.join(1)).to eq(peer)
|
|
28
|
+
expect(commands.last).to eq('-gdb-exit')
|
|
29
|
+
expect(request_w).to be_closed
|
|
30
|
+
expect(response_r).to be_closed
|
|
31
|
+
ensure
|
|
32
|
+
request_w&.close unless request_w&.closed?
|
|
33
|
+
peer&.join(1)
|
|
34
|
+
peer&.kill&.join if peer&.alive?
|
|
35
|
+
[request_r, response_r, response_w].compact.each { |io| io.close unless io.closed? }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
['^error,msg="fixture could not execute"', "^running\n^error,msg=\"fixture could not execute\""].each do |execution|
|
|
39
|
+
it "PSR-L05 propagates failed execution including actionable MI details #{execution.inspect}" do
|
|
40
|
+
with_mi_peer(execution) do |commands|
|
|
41
|
+
expect { described_class.run_to_crash(binary: '/fixture/offline') }
|
|
42
|
+
.to raise_error(IOError, /fixture could not execute/)
|
|
43
|
+
expect(commands).not_to include('-data-list-register-values x')
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
['^running', "^running\n*stopped,reason=\"breakpoint-hit\",frame={addr=\"0x1000\"}",
|
|
49
|
+
"^running\n*stopped,reason=\"signal-received\""].each do |execution|
|
|
50
|
+
it "PSR-L05 classifies an unconfirmed outcome as unknown #{execution.inspect}" do
|
|
51
|
+
with_mi_peer(execution) do
|
|
52
|
+
result = described_class.run_to_crash(binary: '/fixture/offline')
|
|
53
|
+
expect(result).to include(signal: nil, exploitability: 'unknown')
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
%w[exited-normally exited].each do |reason|
|
|
59
|
+
it "preserves confirmed #{reason} as a no-crash outcome" do
|
|
60
|
+
with_mi_peer("^running\n*stopped,reason=\"#{reason}\"") do
|
|
61
|
+
result = described_class.run_to_crash(binary: '/fixture/offline')
|
|
62
|
+
expect(result).to include(signal: nil, exploitability: 'none', interpreter: 'mi3')
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it 'preserves the crash hash for an actual parsed signal stop' do
|
|
68
|
+
with_mi_peer("^running\n*stopped,reason=\"signal-received\",signal-name=\"SIGABRT\",frame={addr=\"0x1000\"}") do
|
|
69
|
+
result = described_class.run_to_crash(binary: '/fixture/offline')
|
|
70
|
+
expect(result).to include(signal: 'SIGABRT', pc: '0x1000', exploitability: 'abort')
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'tmpdir'
|
|
5
|
+
require 'shellwords'
|
|
6
|
+
|
|
7
|
+
RSpec.describe PWN::Plugins::Github, 'literal gh boundary' do
|
|
8
|
+
around do |example|
|
|
9
|
+
Dir.mktmpdir('gh-argv-') do |dir|
|
|
10
|
+
@dir = dir
|
|
11
|
+
@old_path = ENV.fetch('PATH', '')
|
|
12
|
+
# A space in the executable path also must not become shell syntax.
|
|
13
|
+
bin = File.join(dir, 'fake tools')
|
|
14
|
+
FileUtils.mkdir_p(bin)
|
|
15
|
+
File.write(File.join(bin, 'gh'), <<~RUBY)
|
|
16
|
+
#!#{RbConfig.ruby}
|
|
17
|
+
require 'json'
|
|
18
|
+
puts JSON.generate(argv: ARGV, token: ENV['GH_TOKEN'], prompt: ENV['GH_PROMPT_DISABLED'], color: ENV['NO_COLOR'])
|
|
19
|
+
warn 'fixture stderr'
|
|
20
|
+
exit 7
|
|
21
|
+
RUBY
|
|
22
|
+
File.chmod(0o700, File.join(bin, 'gh'))
|
|
23
|
+
ENV['PATH'] = "#{bin}:#{@old_path}"
|
|
24
|
+
example.run
|
|
25
|
+
ensure
|
|
26
|
+
ENV['PATH'] = @old_path
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it '[PBR-15] runs the exact executable with literal string arguments and preserves status' do
|
|
31
|
+
marker = File.join(@dir, 'marker')
|
|
32
|
+
cmd = "api 'repos/example/a b' ; printf bad > #{marker} $(printf expansion) $HOME *.rb"
|
|
33
|
+
row = described_class.gh(cmd: cmd, token: 'synthetic-token')
|
|
34
|
+
expect(File.exist?(marker)).to be(false)
|
|
35
|
+
expect(row).to include(exit: 7, stderr: "fixture stderr\n")
|
|
36
|
+
expect(JSON.parse(row[:stdout])).to eq('argv' => Shellwords.split(cmd), 'token' => 'synthetic-token', 'prompt' => '1', 'color' => '1')
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it '[PBR-15] accepts argv without changing empty strings, quotes or metacharacters' do
|
|
40
|
+
argv = ['api', 'repos/example/a b', '', "quote'\"", '$HOME', '$(printf bad)', ';', '*']
|
|
41
|
+
row = described_class.gh(cmd: argv, token: 'synthetic-token')
|
|
42
|
+
expect(JSON.parse(row[:stdout])['argv']).to eq(argv)
|
|
43
|
+
expect(row[:exit]).to eq(7)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it '[PBR-15] rejects malformed quoting before starting the executable' do
|
|
47
|
+
expect { described_class.gh(cmd: "api 'unclosed", token: 'synthetic-token') }.to raise_error(ArgumentError)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'tmpdir'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PWN::Plugins::GoogleWorkspace, 'PR-GATE-01 explicit OAuth revocation' do
|
|
7
|
+
before do
|
|
8
|
+
@home = Dir.mktmpdir('pwn-provider-oauth-')
|
|
9
|
+
allow(Dir).to receive(:home).and_return(@home)
|
|
10
|
+
@path = File.join(@home, 'vault')
|
|
11
|
+
@decryptor = File.join(@home, 'decryptor')
|
|
12
|
+
stub_const('PWN::Plugins::GoogleWorkspace::PENDING_FILE', File.join(@home, 'pending'))
|
|
13
|
+
@oauth = { bearer_token: 'fixture-access', refresh_token: 'fixture-refresh', expires_at: 42,
|
|
14
|
+
client_id: 'fixture-client', client_secret: 'fixture-secret', scope: 'fixture-scope' }
|
|
15
|
+
@config = { unrelated: 'keep', plugins: { google_workspace: { oauth: @oauth.dup, other: 'keep' } } }
|
|
16
|
+
stub_const('PWN::Env', Marshal.load(Marshal.dump(@config)).merge(driver_opts: { pwn_env_path: @path, pwn_dec_path: @decryptor }))
|
|
17
|
+
allow(ENV).to receive(:fetch).and_call_original
|
|
18
|
+
allow(ENV).to receive(:fetch).with('PWN_DECRYPTOR_KEY', nil).and_return(nil)
|
|
19
|
+
allow(ENV).to receive(:fetch).with('PWN_DECRYPTOR_IV', nil).and_return(nil)
|
|
20
|
+
@device = double('synthetic hardware boundary')
|
|
21
|
+
stub_const('PWN::Plugins::YubiKey', @device)
|
|
22
|
+
allow(@device).to receive(:challenge_response) do |opts|
|
|
23
|
+
expect(opts).to include(slot: 2, serial: '123456')
|
|
24
|
+
OpenSSL::HMAC.digest('SHA1', 'synthetic-fixture-secret', opts.fetch(:challenge))
|
|
25
|
+
end
|
|
26
|
+
expect(PWN::Plugins::AuthenticationHelper).not_to receive(:mask_password)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
after { FileUtils.remove_entry(@home) }
|
|
30
|
+
|
|
31
|
+
%i[legacy hardware].each do |format|
|
|
32
|
+
context "with #{format} ciphertext" do
|
|
33
|
+
before do
|
|
34
|
+
@access = if format == :legacy
|
|
35
|
+
{ key: Base64.strict_encode64('k' * 32), iv: Base64.strict_encode64('i' * 16) }
|
|
36
|
+
else
|
|
37
|
+
{ yubikey: { slot: 2, serial: '123456' } }
|
|
38
|
+
end
|
|
39
|
+
File.write(@decryptor, YAML.dump(@access)) if format == :legacy
|
|
40
|
+
File.binwrite(@path, PWN::Plugins::Vault.encrypt_data(@access.merge(data: YAML.dump(@config))))
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
[{}, { refresh_token: nil, expires_at: nil, client_secret: nil }].each do |fields|
|
|
44
|
+
it "retains existing values for #{fields.empty? ? 'omitted' : 'nil'} OAuth fields" do
|
|
45
|
+
expect(described_class.send(:persist_oauth_to_vault, oauth: fields.merge(bearer_token: 'fixture-rotated'))).to be(true)
|
|
46
|
+
persisted = PWN::Plugins::Vault.dump(@access.merge(file: @path))
|
|
47
|
+
expect(persisted.dig(:plugins, :google_workspace, :oauth)).to eq(@oauth.merge(bearer_token: 'fixture-rotated'))
|
|
48
|
+
expect(File.binread(@path)).not_to include('fixture-rotated', 'fixture-refresh', 'fixture-secret')
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it 'revokes persisted tokens through the public entrypoint without clearing client metadata' do
|
|
53
|
+
expect(RestClient).to receive(:post).with(described_class::REVOKE_URI, { token: 'fixture-refresh' }, content_type: 'application/x-www-form-urlencoded').and_return('')
|
|
54
|
+
expect(PWN::Plugins::Vault).not_to receive(:decrypt)
|
|
55
|
+
expect(PWN::Plugins::Vault).not_to receive(:encrypt)
|
|
56
|
+
expect(File).not_to receive(:write)
|
|
57
|
+
expect(Tempfile).to receive(:create).and_wrap_original do |create, *args, &block|
|
|
58
|
+
create.call(*args) do |temp|
|
|
59
|
+
expect(temp).to receive(:write).and_wrap_original do |write, bytes|
|
|
60
|
+
plaintext = PWN::Plugins::Vault.decrypt_data(@access.merge(data: bytes))
|
|
61
|
+
expect(YAML.safe_load(plaintext, permitted_classes: [Symbol], symbolize_names: true).dig(:plugins, :google_workspace, :oauth)).to eq(@oauth.merge(bearer_token: '', refresh_token: nil, expires_at: nil))
|
|
62
|
+
expect(bytes).not_to include('fixture-access', 'fixture-refresh', 'fixture-secret')
|
|
63
|
+
write.call(bytes)
|
|
64
|
+
end
|
|
65
|
+
block.call(temp)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
expect(described_class.revoke).to be(true)
|
|
69
|
+
expect(PWN::Env.dig(:plugins, :google_workspace, :oauth)).to eq(@oauth.merge(bearer_token: nil, refresh_token: nil, expires_at: nil))
|
|
70
|
+
persisted = PWN::Plugins::Vault.dump(@access.merge(file: @path))
|
|
71
|
+
expect(persisted.dig(:plugins, :google_workspace, :oauth)).to eq(@oauth.merge(bearer_token: '', refresh_token: nil, expires_at: nil))
|
|
72
|
+
expect(persisted[:unrelated]).to eq('keep')
|
|
73
|
+
expect(persisted.dig(:plugins, :google_workspace, :other)).to eq('keep')
|
|
74
|
+
expect(File.stat(@path).mode & 0o777).to eq(0o600)
|
|
75
|
+
expect(Dir.children(@home)).to match_array(format == :legacy ? %w[vault decryptor] : ['vault'])
|
|
76
|
+
expect(described_class.authenticated?).to be(false)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'socket'
|
|
5
|
+
require 'timeout'
|
|
6
|
+
|
|
7
|
+
RSpec.describe PWN::Plugins::IRC do
|
|
8
|
+
around do |example|
|
|
9
|
+
@local, @peer = UNIXSocket.pair
|
|
10
|
+
example.run
|
|
11
|
+
ensure
|
|
12
|
+
[@local, @peer].each { |io| io.close unless io.closed? }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
["#test\r\nQUIT :synthetic", "#test\0suffix", '#test extra'].each do |channel|
|
|
16
|
+
it "rejects invalid structural channel #{channel.inspect} before writing" do
|
|
17
|
+
expect { described_class.names(irc_obj: @local, chan: channel) }.to raise_error(ArgumentError)
|
|
18
|
+
expect(@peer.wait_readable(0)).to be_nil
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'frames one valid command with CRLF' do
|
|
23
|
+
described_class.ping(irc_obj: @local, message: 'synthetic')
|
|
24
|
+
expect(@peer.read_nonblock(1024)).to eq("PING :synthetic\r\n")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'allows intentional multiline messages without permitting command injection' do
|
|
28
|
+
described_class.privmsg(irc_obj: @local, chan: '#test', message: "one\ntwo")
|
|
29
|
+
expect(@peer.read_nonblock(1024)).to eq("PRIVMSG #test :one\r\nPRIVMSG #test :two\r\n")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
["safe\nunsafe\rQUIT", "safe\ninvalid\0", "safe\n#{'x' * 512}"].each do |message|
|
|
33
|
+
it 'prevalidates every message frame before the first write' do
|
|
34
|
+
expect { described_class.privmsg(irc_obj: @local, chan: '#test', message: message) }.to raise_error(ArgumentError)
|
|
35
|
+
expect(@peer.wait_readable(0)).to be_nil
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'parses complete native socket NAMES replies through the public Sock connection' do
|
|
40
|
+
server = TCPServer.new('127.0.0.1', 0)
|
|
41
|
+
connection = PWN::Plugins::Sock.connect(target: '127.0.0.1', port: server.addr[1])
|
|
42
|
+
peer = server.accept
|
|
43
|
+
peer.write(":host 353 me = #test :@one +two\r\n:host 353 me = #test :three\r\n")
|
|
44
|
+
expect(described_class.names(irc_obj: connection, chan: '#test')).to eq(%w[one two three])
|
|
45
|
+
ensure
|
|
46
|
+
[connection, peer, server].compact.each { |io| io.close unless io.closed? }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it 'retains partial frames across deadlines and isolates connection buffers' do
|
|
50
|
+
@peer.write(':host 353 me = #test :one')
|
|
51
|
+
expect(Timeout.timeout(0.3) { described_class.names(irc_obj: @local, chan: '#test') }).to eq([])
|
|
52
|
+
other, remote = UNIXSocket.pair
|
|
53
|
+
remote.write(":host 353 me = #test :other\r\n")
|
|
54
|
+
expect(described_class.names(irc_obj: other, chan: '#test')).to eq(['other'])
|
|
55
|
+
@peer.write(" two\r\n")
|
|
56
|
+
expect(described_class.names(irc_obj: @local, chan: '#test')).to eq(%w[one two])
|
|
57
|
+
ensure
|
|
58
|
+
[other, remote].compact.each { |io| io.close unless io.closed? }
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it 'bounds a partial frame even when a legacy ready predicate is available' do
|
|
62
|
+
@local.define_singleton_method(:ready?) { true }
|
|
63
|
+
@peer.write(':host 353 me = #test :partial')
|
|
64
|
+
expect(Timeout.timeout(0.3) { described_class.names(irc_obj: @local, chan: '#test') }).to eq([])
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it 'returns complete frames at EOF without spinning' do
|
|
68
|
+
@peer.write(":host 353 me = #test :one\r\n")
|
|
69
|
+
@peer.shutdown(Socket::SHUT_WR)
|
|
70
|
+
expect(Timeout.timeout(0.3) { described_class.names(irc_obj: @local, chan: '#test') }).to eq(['one'])
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it 'rejects oversized incomplete peer frames without unbounded buffering' do
|
|
74
|
+
@peer.write('x' * 513)
|
|
75
|
+
expect { described_class.names(irc_obj: @local, chan: '#test') }.to raise_error(IOError, /frame/)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it 'hands retained command bytes to the native listener' do
|
|
79
|
+
@peer.write('PING :frag')
|
|
80
|
+
described_class.names(irc_obj: @local, chan: '#test')
|
|
81
|
+
@peer.write("ment\r\n")
|
|
82
|
+
@peer.shutdown(Socket::SHUT_WR)
|
|
83
|
+
messages = []
|
|
84
|
+
Timeout.timeout(0.3) { described_class.listen(irc_obj: @local) { |line| messages << line } }
|
|
85
|
+
expect(messages).to eq(["PING :fragment\r\n"])
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it 'rejects registration injection before connecting' do
|
|
89
|
+
expect(PWN::Plugins::Sock).not_to receive(:connect)
|
|
90
|
+
expect { described_class.connect(nick: "test\r\nQUIT", real: 'Synthetic') }.to raise_error(ArgumentError)
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::Plugins::IRC do
|
|
6
|
+
it 'ends the receive loop on EOF without yielding nil or repeatedly reading a dead socket' do
|
|
7
|
+
connection = double('IRC socket', flush: nil, close: nil)
|
|
8
|
+
reads = 0
|
|
9
|
+
allow(connection).to receive(:read_nonblock) do
|
|
10
|
+
reads += 1
|
|
11
|
+
raise IOError, 'read after EOF' if reads > 1
|
|
12
|
+
|
|
13
|
+
nil
|
|
14
|
+
end
|
|
15
|
+
messages = []
|
|
16
|
+
expect { described_class.listen(irc_obj: connection) { |message| messages << message } }.not_to raise_error
|
|
17
|
+
expect(messages).to eq([])
|
|
18
|
+
expect(connection).to have_received(:close).once
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'addresses the join announcement to the selected channel' do
|
|
22
|
+
connection, peer = UNIXSocket.pair
|
|
23
|
+
described_class.join(irc_obj: connection, nick: 'fixture', chan: '#fixture')
|
|
24
|
+
expect(peer.read_nonblock(1024)).to eq("JOIN #fixture\r\nPRIVMSG #fixture :fixture joined.\r\n")
|
|
25
|
+
ensure
|
|
26
|
+
[connection, peer].compact.each { |io| io.close unless io.closed? }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'collects every matching NAMES reply instead of taking an unrelated first line' do
|
|
30
|
+
connection = double('IRC socket')
|
|
31
|
+
allow(described_class).to receive(:irc_cmd).and_return([
|
|
32
|
+
'PING :fixture', ':host 353 me = #fixture :@one +two',
|
|
33
|
+
':host 353 me = #other :outsider', ':host 353 me = #fixture :three', ':host 366 me #fixture :End'
|
|
34
|
+
])
|
|
35
|
+
expect(described_class.names(irc_obj: connection, chan: '#fixture')).to eq(%w[one two three])
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::Plugins::Jenkins, 'connection defaults regression' do
|
|
6
|
+
it 'passes the documented port and TLS defaults to the client' do
|
|
7
|
+
service = instance_double(JenkinsApi::Client::System, wait_for_ready: true)
|
|
8
|
+
client = instance_double(JenkinsApi::Client, system: service)
|
|
9
|
+
expect(JenkinsApi::Client).to receive(:new).with(hash_including(server_ip: 'jenkins.invalid', server_port: 8080, ssl: true)).and_return(client)
|
|
10
|
+
expect(described_class.connect(ip: 'jenkins.invalid')).to eq(client)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'rest-client'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PWN::Plugins::JiraDataCenter, 'namespace audit regressions' do
|
|
7
|
+
before do
|
|
8
|
+
stub_const('PWN::Env', { plugins: { jira_data_center: { base_uri: 'https://jira.invalid/rest/api/2', token: 'fixture-token' } } })
|
|
9
|
+
allow(PWN::Plugins::TransparentBrowser).to receive(:open).and_return(browser: RestClient)
|
|
10
|
+
allow(PWN::Plugins::TTYSpinner).to receive_messages(start: nil, stop: nil)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
%i[delete update].each do |action|
|
|
14
|
+
it "rejects #{action} of a comment without its required identifier" do
|
|
15
|
+
allow(described_class).to receive(:rest_call).and_return({})
|
|
16
|
+
allow(described_class).to receive(:get_issue).and_return({})
|
|
17
|
+
expect { described_class.issue_comment(issue: 'AUDIT-1', comment_action: action) }.to raise_error(RuntimeError, /comment_id/)
|
|
18
|
+
expect(described_class).not_to have_received(:rest_call)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'retries retrieving a newly created issue without creating it twice' do
|
|
23
|
+
allow(described_class).to receive(:get_all_fields).and_return([{ name: 'Epic Name', id: 'customfield_1' }])
|
|
24
|
+
expect(described_class).to receive(:rest_call).once.and_return(key: 'AUDIT-1')
|
|
25
|
+
attempts = 0
|
|
26
|
+
allow(described_class).to receive(:get_issue) do
|
|
27
|
+
attempts += 1
|
|
28
|
+
raise 'not ready yet' if attempts == 1
|
|
29
|
+
|
|
30
|
+
{ key: 'AUDIT-1' }
|
|
31
|
+
end
|
|
32
|
+
allow(described_class).to receive(:sleep)
|
|
33
|
+
expect(described_class.create_issue(project_key: 'AUDIT', summary: 'offline fixture', issue_type: :bug)).to include(key: 'AUDIT-1')
|
|
34
|
+
expect(attempts).to eq(2)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'uses the issue key returned in a successful HTTP 201 creation response' do
|
|
38
|
+
response = RestClient::Response.create('{"key":"AUDIT-1"}', Net::HTTPResponse.new('1.1', '201', 'Created'), RestClient::Request.new(method: :post, url: 'https://jira.invalid/rest/api/2/issue'))
|
|
39
|
+
allow(RestClient::Request).to receive(:execute).and_return(response)
|
|
40
|
+
allow(described_class).to receive(:get_all_fields).and_return([{ name: 'Epic Name', id: 'customfield_1' }])
|
|
41
|
+
expect(described_class).to receive(:get_issue).with(issue: 'AUDIT-1').and_return(key: 'AUDIT-1')
|
|
42
|
+
expect(described_class.create_issue(project_key: 'AUDIT', summary: 'offline fixture', issue_type: :bug)).to include(key: 'AUDIT-1')
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'rest-client'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PWN::Plugins::JiraDataCenter, 'review creation error regressions' do
|
|
7
|
+
def response(body, code = 200)
|
|
8
|
+
RestClient::Response.create(body, Net::HTTPResponse.new('1.1', code.to_s, 'Fixture'),
|
|
9
|
+
RestClient::Request.new(method: :get, url: 'https://jira.invalid/'))
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
before do
|
|
13
|
+
stub_const('PWN::Env', { plugins: { jira_data_center: { base_uri: 'https://jira.invalid/rest/api/2', token: 'fixture' } } })
|
|
14
|
+
allow(PWN::Plugins::TransparentBrowser).to receive(:open).and_return(browser: RestClient)
|
|
15
|
+
allow(PWN::Plugins::TTYSpinner).to receive_messages(start: nil, stop: nil)
|
|
16
|
+
allow(described_class).to receive(:sleep)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
['{"errors":{"summary":"invalid"}}', '{"errorMessages":["forbidden"]}', '[]', '<html>rejected</html>', ''].each do |body|
|
|
20
|
+
it "PSR-L06 propagates the original nonretryable HTTP creation failure #{body.inspect}" do
|
|
21
|
+
error = RestClient::BadRequest.new(response(body, 400))
|
|
22
|
+
creates = 0
|
|
23
|
+
allow(RestClient::Request).to receive(:execute) do |request|
|
|
24
|
+
next response('[{"name":"Epic Name","id":"customfield_1"}]') if request[:url].end_with?('/field')
|
|
25
|
+
|
|
26
|
+
expect(request[:method]).to eq(:post)
|
|
27
|
+
creates += 1
|
|
28
|
+
raise error
|
|
29
|
+
end
|
|
30
|
+
expect do
|
|
31
|
+
described_class.create_issue(project_key: 'AUDIT', summary: 'fixture', issue_type: :bug)
|
|
32
|
+
end.to(raise_error { |raised| expect(raised).to equal(error) })
|
|
33
|
+
expect(creates).to eq(1)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'retains a single HTTP 201 create and retries actual HTTP 404 readback' do
|
|
38
|
+
reads = 0
|
|
39
|
+
creates = 0
|
|
40
|
+
allow(RestClient::Request).to receive(:execute) do |request|
|
|
41
|
+
case request[:url]
|
|
42
|
+
when %r{/field\z}
|
|
43
|
+
response('[{"name":"Epic Name","id":"customfield_1"}]')
|
|
44
|
+
when %r{/issue\z}
|
|
45
|
+
creates += 1
|
|
46
|
+
response('{"key":"AUDIT-1"}', 201)
|
|
47
|
+
when %r{/issue/AUDIT-1\z}
|
|
48
|
+
reads += 1
|
|
49
|
+
raise RestClient::NotFound, response('{"errorMessages":["not visible yet"]}', 404) if reads == 1
|
|
50
|
+
|
|
51
|
+
response('{"key":"AUDIT-1"}')
|
|
52
|
+
else
|
|
53
|
+
raise "Unexpected fixture URL: #{request[:url]}"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
result = described_class.create_issue(project_key: 'AUDIT', summary: 'fixture', issue_type: :bug)
|
|
57
|
+
expect([result, creates, reads]).to eq([{ key: 'AUDIT-1' }, 1, 2])
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it 'retains bounded unlicensed-field recovery through the actual REST helper' do
|
|
61
|
+
creates = []
|
|
62
|
+
allow(RestClient::Request).to receive(:execute) do |request|
|
|
63
|
+
case request[:url]
|
|
64
|
+
when %r{/field\z} then response('[{"name":"Epic Name","id":"customfield_1"}]')
|
|
65
|
+
when %r{/issue/AUDIT-1\z} then response('{"key":"AUDIT-1"}')
|
|
66
|
+
when %r{/issue\z}
|
|
67
|
+
creates << JSON.parse(request[:payload])
|
|
68
|
+
raise RestClient::BadRequest, response('{"errors":{"customfield_2":"unlicensed"}}', 400) if creates.length == 1
|
|
69
|
+
|
|
70
|
+
response('{"key":"AUDIT-1"}', 201)
|
|
71
|
+
else raise "Unexpected fixture URL: #{request[:url]}"
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
result = described_class.create_issue(project_key: 'AUDIT', summary: 'fixture', issue_type: :bug,
|
|
75
|
+
additional_fields: { fields: { 'customfield_2' => 'fixture' } })
|
|
76
|
+
expect(result).to eq(key: 'AUDIT-1')
|
|
77
|
+
expect(creates.length).to eq(2)
|
|
78
|
+
expect(creates.first.fetch('fields')).to include('customfield_2' => 'fixture')
|
|
79
|
+
expect(creates.last.fetch('fields')).not_to have_key('customfield_2')
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'json'
|
|
5
|
+
require 'tmpdir'
|
|
6
|
+
|
|
7
|
+
RSpec.describe 'JSONL rejection and ELF32 dynamic symbols' do
|
|
8
|
+
it '[PBR-07] reports malformed JSONL instead of an empty successful scan' do
|
|
9
|
+
Dir.mktmpdir('jsonl-review-') do |dir|
|
|
10
|
+
missing = File.join(dir, 'absent.jsonl')
|
|
11
|
+
expect(PWN::Plugins::Httpx.probe(jsonl: missing)[:error]).to eq('missing jsonl file')
|
|
12
|
+
expect(PWN::Plugins::Nuclei.scan(jsonl: missing, record: false)[:error]).to eq('missing jsonl file')
|
|
13
|
+
|
|
14
|
+
bad = File.join(dir, 'bad.jsonl')
|
|
15
|
+
File.write(bad, "not-json\n")
|
|
16
|
+
malformed = PWN::Plugins::Httpx.probe(jsonl: bad)
|
|
17
|
+
expect(malformed[:hosts]).to eq([])
|
|
18
|
+
expect(malformed[:rejected]).to eq(1)
|
|
19
|
+
|
|
20
|
+
mixed = File.join(dir, 'mixed.jsonl')
|
|
21
|
+
File.write(mixed, "#{JSON.generate('url' => 'https://kept.example')}\nnot-json\n\n")
|
|
22
|
+
kept = PWN::Plugins::Httpx.probe(jsonl: mixed)
|
|
23
|
+
expect(kept[:hosts].map { |row| row['url'] }).to eq(['https://kept.example'])
|
|
24
|
+
expect(kept[:rejected]).to eq(1)
|
|
25
|
+
|
|
26
|
+
nuclei = PWN::Plugins::Nuclei.scan(jsonl: bad, record: false)
|
|
27
|
+
expect(nuclei[:findings]).to eq([])
|
|
28
|
+
expect(nuclei[:rejected]).to eq(1)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it '[PBR-09] does not use DT_STRSZ as the dynamic symbol-table size' do
|
|
33
|
+
Dir.mktmpdir('elf32-review-') do |dir|
|
|
34
|
+
path = File.join(dir, 'rel32')
|
|
35
|
+
base = 0x8048000
|
|
36
|
+
dynamic_offset = 0x100
|
|
37
|
+
symbol_offset = 0x200
|
|
38
|
+
string_offset = 0x240
|
|
39
|
+
rel_offset = 0x280
|
|
40
|
+
dyn = [[5, base + string_offset], [6, base + symbol_offset], [10, 8], [11, 16],
|
|
41
|
+
[23, base + rel_offset], [2, 8], [20, 17], [0, 0]].map { |row| row.pack('V2') }.join
|
|
42
|
+
data = "\0".b * 0x300
|
|
43
|
+
data[0, 16] = "\x7fELF\x01\x01\x01".b.ljust(16, "\0")
|
|
44
|
+
data[16, 36] = [2, 3, 1, base, 52, 0, 0, 52, 32, 2, 40, 0, 0].pack('vvVVVVVvvvvvv')
|
|
45
|
+
data[52, 32] = [1, 0, base, base, data.bytesize, data.bytesize, 5, 4096].pack('V8')
|
|
46
|
+
data[84, 32] = [2, dynamic_offset, base + dynamic_offset, base + dynamic_offset, dyn.bytesize, dyn.bytesize, 6, 4].pack('V8')
|
|
47
|
+
data[dynamic_offset, dyn.bytesize] = dyn
|
|
48
|
+
data[symbol_offset + 16, 16] = [1, 0, 0, 0x12, 0, 0].pack('VVVCCv')
|
|
49
|
+
data[string_offset, 8] = "\0system\0".b
|
|
50
|
+
data[rel_offset, 8] = [base + 0x2c0, (1 << 8) | 7].pack('V2')
|
|
51
|
+
File.binwrite(path, data)
|
|
52
|
+
|
|
53
|
+
row = PWN::Plugins::BinaryParser.elf_resolve(path: path)
|
|
54
|
+
expect(row[:arch]).to eq('i386')
|
|
55
|
+
expect(row[:got]['system']).to eq(base + 0x2c0)
|
|
56
|
+
expect(row[:symbols]['system']).not_to be_nil
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|