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,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
|
|
@@ -14,6 +14,18 @@ describe PWN::Plugins::Log do
|
|
|
14
14
|
expect(help_response).to respond_to :help
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
describe 'unraised exception logging' do
|
|
18
|
+
include_context 'pwn tmp sandbox'
|
|
19
|
+
|
|
20
|
+
it 'persists an exception whose backtrace has not been populated' do
|
|
21
|
+
allow(Dir).to receive(:home).and_return(@tmp)
|
|
22
|
+
error = IOError.new('fixture unraised failure')
|
|
23
|
+
expect(error.backtrace).to be_nil
|
|
24
|
+
described_class.append(level: :warn, msg: error, which_self: 'fixture')
|
|
25
|
+
expect(File.read(File.join(@tmp, '.pwn', 'logs', 'pwn.log'))).to include('fixture unraised failure')
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
17
29
|
describe 'pwn-ai debug session' do
|
|
18
30
|
include_context 'pwn tmp sandbox'
|
|
19
31
|
|
|
@@ -59,7 +71,7 @@ describe PWN::Plugins::Log do
|
|
|
59
71
|
expect(PWN::Plugins::Log).to respond_to(:quiet_tui!)
|
|
60
72
|
expect(PWN::Plugins::Log).to respond_to(:loud_tui!)
|
|
61
73
|
tee = StringIO.new
|
|
62
|
-
path = PWN::Plugins::Log.start_debug(tee: tee, path: "
|
|
74
|
+
path = PWN::Plugins::Log.start_debug(tee: tee, path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-quiet.log")
|
|
63
75
|
PWN::Plugins::Log.progress(msg: 'before-quiet', which_self: PWN::AI::Agent::Loop)
|
|
64
76
|
PWN::Plugins::Log.quiet_tui!
|
|
65
77
|
PWN::Plugins::Log.progress(msg: 'after-quiet', which_self: PWN::AI::Agent::Loop)
|
|
@@ -75,7 +87,7 @@ describe PWN::Plugins::Log do
|
|
|
75
87
|
tee = StringIO.new
|
|
76
88
|
PWN::Plugins::Log.start_debug(
|
|
77
89
|
tee: tee,
|
|
78
|
-
path: "
|
|
90
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-ansi.log"
|
|
79
91
|
)
|
|
80
92
|
PWN::Plugins::Log.progress(msg: 'stage-line', which_self: PWN::AI::Agent::Loop)
|
|
81
93
|
shown = tee.string
|
|
@@ -88,7 +100,7 @@ describe PWN::Plugins::Log do
|
|
|
88
100
|
it 'writes a multiline final body when keep_newlines is set' do
|
|
89
101
|
path = PWN::Plugins::Log.start_debug(
|
|
90
102
|
tee: StringIO.new,
|
|
91
|
-
path: "
|
|
103
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-finalbody.log"
|
|
92
104
|
)
|
|
93
105
|
PWN::Plugins::Log.progress(
|
|
94
106
|
msg: "final text:\nline-one\nline-two",
|
|
@@ -103,7 +115,7 @@ describe PWN::Plugins::Log do
|
|
|
103
115
|
it 'writes a full tool request/result with no char cap when cap is 0' do
|
|
104
116
|
path = PWN::Plugins::Log.start_debug(
|
|
105
117
|
tee: StringIO.new,
|
|
106
|
-
path: "
|
|
118
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-toolio.log"
|
|
107
119
|
)
|
|
108
120
|
blob = 'x' * 8_000
|
|
109
121
|
PWN::Plugins::Log.progress(
|
|
@@ -123,7 +135,7 @@ describe PWN::Plugins::Log do
|
|
|
123
135
|
expect(PWN::Plugins::Log).to respond_to(:note_interrupt!)
|
|
124
136
|
path = PWN::Plugins::Log.start_debug(
|
|
125
137
|
tee: StringIO.new,
|
|
126
|
-
path: "
|
|
138
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-int.log"
|
|
127
139
|
)
|
|
128
140
|
ok = PWN::Plugins::Log.note_interrupt!(where: 'CTRL+C')
|
|
129
141
|
expect(ok).to eq true
|
|
@@ -136,7 +148,7 @@ describe PWN::Plugins::Log do
|
|
|
136
148
|
it 'still timestamps Interrupt when progress reentrancy is stuck mid-write' do
|
|
137
149
|
path = PWN::Plugins::Log.start_debug(
|
|
138
150
|
tee: StringIO.new,
|
|
139
|
-
path: "
|
|
151
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-int-stuck.log"
|
|
140
152
|
)
|
|
141
153
|
Thread.current[:pwn_log_progress] = true
|
|
142
154
|
ok = PWN::Plugins::Log.note_interrupt!(where: 'CTRL+C')
|
|
@@ -152,7 +164,7 @@ describe PWN::Plugins::Log do
|
|
|
152
164
|
it 'tees stderr Thread IOError dumps into the open request log' do
|
|
153
165
|
path = PWN::Plugins::Log.start_debug(
|
|
154
166
|
tee: StringIO.new,
|
|
155
|
-
path: "
|
|
167
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-ioerr.log"
|
|
156
168
|
)
|
|
157
169
|
$stderr.write("#<Thread:0xabc open3.rb:664 run> terminated with exception (report_on_exception is true):\n")
|
|
158
170
|
$stderr.write("IOError stream closed in another thread\n")
|
|
@@ -166,7 +178,7 @@ describe PWN::Plugins::Log do
|
|
|
166
178
|
it 'does not copy spinner frames from stderr into the request log' do
|
|
167
179
|
path = PWN::Plugins::Log.start_debug(
|
|
168
180
|
tee: StringIO.new,
|
|
169
|
-
path: "
|
|
181
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-spin.log"
|
|
170
182
|
)
|
|
171
183
|
$stderr.write("\r\e[1G⠴")
|
|
172
184
|
$stderr.write("\r⠋")
|
|
@@ -182,7 +194,7 @@ describe PWN::Plugins::Log do
|
|
|
182
194
|
expect(PWN::Plugins::Log).to respond_to(:note_exception!)
|
|
183
195
|
path = PWN::Plugins::Log.start_debug(
|
|
184
196
|
tee: StringIO.new,
|
|
185
|
-
path: "
|
|
197
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-exc.log"
|
|
186
198
|
)
|
|
187
199
|
err = NoMethodError.new("undefined method '+' for nil")
|
|
188
200
|
err.set_backtrace(['/opt/pwn/lib/pwn/ai/grok.rb:470:in grok_rest_call', 'loop.rb:1'])
|
|
@@ -199,7 +211,7 @@ describe PWN::Plugins::Log do
|
|
|
199
211
|
expect(PWN::Plugins::Log).to respond_to(:mirror_tui!)
|
|
200
212
|
path = PWN::Plugins::Log.start_debug(
|
|
201
213
|
tee: StringIO.new,
|
|
202
|
-
path: "
|
|
214
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-tui.log"
|
|
203
215
|
)
|
|
204
216
|
ok = PWN::Plugins::Log.mirror_tui!(
|
|
205
217
|
msg: "\e[33m[ 2026-08-20 11:00:00-0600 → pwn-ai → pwn_eval ]\e[0m\n {\"code\":\"1+1\"}\n"
|
|
@@ -247,7 +259,7 @@ describe PWN::Plugins::Log do
|
|
|
247
259
|
it 'does not TracePoint PWN calls unless trace: true' do
|
|
248
260
|
path = PWN::Plugins::Log.start_debug(
|
|
249
261
|
tee: StringIO.new,
|
|
250
|
-
path: "
|
|
262
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-notrace.log"
|
|
251
263
|
)
|
|
252
264
|
PWN::AI::Agent::OpenGoal.current if defined?(PWN::AI::Agent::OpenGoal)
|
|
253
265
|
body = File.read(path)
|
|
@@ -257,7 +269,7 @@ describe PWN::Plugins::Log do
|
|
|
257
269
|
it 'traces Loop/Dispatch calls and not the rest of PWN::AI when trace: true' do
|
|
258
270
|
path = PWN::Plugins::Log.start_debug(
|
|
259
271
|
tee: StringIO.new,
|
|
260
|
-
path: "
|
|
272
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-#{Time.now.to_i}.log",
|
|
261
273
|
trace: true
|
|
262
274
|
)
|
|
263
275
|
PWN::AI::Agent::Dispatch.effect(name: 'skills_recall', args: {})
|
|
@@ -280,7 +292,7 @@ describe PWN::Plugins::Log do
|
|
|
280
292
|
stub_const('PWN::AI::Agent::Loop::SymNameProbe', probe)
|
|
281
293
|
PWN::Plugins::Log.start_debug(
|
|
282
294
|
tee: StringIO.new,
|
|
283
|
-
path: "
|
|
295
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-sym.log",
|
|
284
296
|
trace: true
|
|
285
297
|
)
|
|
286
298
|
expect { PWN::AI::Agent::Loop::SymNameProbe.ping }.not_to raise_error
|
|
@@ -295,7 +307,7 @@ describe PWN::Plugins::Log do
|
|
|
295
307
|
stub_const('PWN::AI::Agent::Dispatch::ArgProbe', probe)
|
|
296
308
|
path = PWN::Plugins::Log.start_debug(
|
|
297
309
|
tee: StringIO.new,
|
|
298
|
-
path: "
|
|
310
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-args.log",
|
|
299
311
|
trace: true
|
|
300
312
|
)
|
|
301
313
|
PWN::AI::Agent::Dispatch::ArgProbe.echo(
|
|
@@ -320,7 +332,7 @@ describe PWN::Plugins::Log do
|
|
|
320
332
|
stub_const('PWN::AI::Agent::Dispatch::ArgProbe', probe)
|
|
321
333
|
path = PWN::Plugins::Log.start_debug(
|
|
322
334
|
tee: StringIO.new,
|
|
323
|
-
path: "
|
|
335
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-redact.log",
|
|
324
336
|
trace: true
|
|
325
337
|
)
|
|
326
338
|
PWN::AI::Agent::Dispatch::ArgProbe.echo(
|
|
@@ -343,6 +355,10 @@ describe PWN::Plugins::Log do
|
|
|
343
355
|
end
|
|
344
356
|
|
|
345
357
|
describe 'PWN::Plugins::Log toggle-trace step' do
|
|
358
|
+
include_context 'pwn tmp sandbox'
|
|
359
|
+
|
|
360
|
+
before { allow(Dir).to receive(:home).and_return(@tmp) }
|
|
361
|
+
|
|
346
362
|
after do
|
|
347
363
|
PWN::Plugins::Log.stop_debug if PWN::Plugins::Log.respond_to?(:stop_debug)
|
|
348
364
|
end
|
|
@@ -351,7 +367,7 @@ describe 'PWN::Plugins::Log toggle-trace step' do
|
|
|
351
367
|
io = StringIO.new("\n")
|
|
352
368
|
path = PWN::Plugins::Log.start_debug(
|
|
353
369
|
tee: StringIO.new,
|
|
354
|
-
path: "
|
|
370
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-step.log",
|
|
355
371
|
trace: true,
|
|
356
372
|
step_io: io
|
|
357
373
|
)
|
|
@@ -370,7 +386,7 @@ describe 'PWN::Plugins::Log toggle-trace step' do
|
|
|
370
386
|
tee = StringIO.new
|
|
371
387
|
PWN::Plugins::Log.start_debug(
|
|
372
388
|
tee: tee,
|
|
373
|
-
path: "
|
|
389
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-enter-color.log",
|
|
374
390
|
trace: true,
|
|
375
391
|
step_io: io
|
|
376
392
|
)
|
|
@@ -387,7 +403,7 @@ describe 'PWN::Plugins::Log toggle-trace step' do
|
|
|
387
403
|
stub_const('PWN::AI::Agent::Dispatch::CfgProbe', probe)
|
|
388
404
|
path = PWN::Plugins::Log.start_debug(
|
|
389
405
|
tee: StringIO.new,
|
|
390
|
-
path: "
|
|
406
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-oauth.log",
|
|
391
407
|
trace: true
|
|
392
408
|
)
|
|
393
409
|
token = 'bnQe3hs8ZSP2KkHj3LSnwzIeDvDv0fmbTQEzsUx4XXW5g22D4Uu6hva_MYossX-GedInWt_dwTgGzpMxoKQECQ'
|
|
@@ -401,7 +417,7 @@ describe 'PWN::Plugins::Log toggle-trace step' do
|
|
|
401
417
|
io = StringIO.new("\n")
|
|
402
418
|
PWN::Plugins::Log.start_debug(
|
|
403
419
|
tee: StringIO.new,
|
|
404
|
-
path: "
|
|
420
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-nostep.log",
|
|
405
421
|
step_io: io
|
|
406
422
|
)
|
|
407
423
|
expect(PWN::Plugins::Log.trace_enabled?).to eq(false)
|
|
@@ -410,7 +426,7 @@ describe 'PWN::Plugins::Log toggle-trace step' do
|
|
|
410
426
|
PWN::Plugins::Log.stop_debug
|
|
411
427
|
PWN::Plugins::Log.start_debug(
|
|
412
428
|
tee: StringIO.new,
|
|
413
|
-
path: "
|
|
429
|
+
path: "#{@tmp}/pwn-ai-DEBUG-#{Process.pid}-nested.log",
|
|
414
430
|
trace: true,
|
|
415
431
|
step_io: io
|
|
416
432
|
)
|
|
@@ -13,6 +13,22 @@ describe PWN::Plugins::MonkeyPatch do
|
|
|
13
13
|
expect(help_response).to respond_to :help
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
it 'can install twice without replacing the original expression parser with its wrapper' do
|
|
17
|
+
require 'open3'
|
|
18
|
+
program = <<~RUBY
|
|
19
|
+
require 'pwn'
|
|
20
|
+
require 'pry'
|
|
21
|
+
2.times { PWN::Plugins::MonkeyPatch.pry }
|
|
22
|
+
parser = Object.new.extend(MethodSource::CodeHelpers)
|
|
23
|
+
raise 'complete expression rejected' unless parser.complete_expression?('1 + 1')
|
|
24
|
+
raise 'incomplete expression accepted' if parser.complete_expression?('def fixture')
|
|
25
|
+
puts 'repeated installation preserves parser'
|
|
26
|
+
RUBY
|
|
27
|
+
stdout, stderr, status = Open3.capture3(RbConfig.ruby, '-Ilib', '-e', program)
|
|
28
|
+
expect(status.success?).to be(true), stderr
|
|
29
|
+
expect(stdout).to eq("repeated installation preserves parser\n")
|
|
30
|
+
end
|
|
31
|
+
|
|
16
32
|
it 'routes CTRL+D in pwn-ai to leave_special_mode instead of exiting Pry' do
|
|
17
33
|
src = File.read(described_class.method(:pry).source_location.first)
|
|
18
34
|
expect(src).to include('leave_special_mode!')
|