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
data/lib/pwn/plugins/debugger.rb
CHANGED
|
@@ -257,7 +257,7 @@ module PWN
|
|
|
257
257
|
PWN::Plugins::ProcessTube.write_line(id: sess[:handle], line: opts[:cmd].to_s)
|
|
258
258
|
row = PWN::Plugins::ProcessTube.expect(
|
|
259
259
|
id: sess[:handle],
|
|
260
|
-
pattern:
|
|
260
|
+
pattern: /^(?:\^(?:done|error|running)|\*stopped)[^\r\n]*\r?\n/,
|
|
261
261
|
timeout: opts[:timeout] || 8
|
|
262
262
|
)
|
|
263
263
|
row.is_a?(Hash) ? row[:matched].to_s : row.to_s
|
|
@@ -91,7 +91,7 @@ module PWN
|
|
|
91
91
|
authorization: dd_obj[:authz_header],
|
|
92
92
|
params: params
|
|
93
93
|
},
|
|
94
|
-
verify_ssl:
|
|
94
|
+
verify_ssl: true,
|
|
95
95
|
timeout: request_timeout,
|
|
96
96
|
open_timeout: request_timeout
|
|
97
97
|
)
|
|
@@ -120,7 +120,7 @@ module PWN
|
|
|
120
120
|
authorization: dd_obj[:authz_header]
|
|
121
121
|
},
|
|
122
122
|
payload: payload,
|
|
123
|
-
verify_ssl:
|
|
123
|
+
verify_ssl: true,
|
|
124
124
|
timeout: request_timeout,
|
|
125
125
|
open_timeout: request_timeout
|
|
126
126
|
)
|
|
@@ -138,6 +138,7 @@ module PWN
|
|
|
138
138
|
puts "PARAMS: #{params.inspect}"
|
|
139
139
|
puts "HTTP POST BODY: #{http_body.inspect}" if http_body
|
|
140
140
|
puts "#{e}\n#{e.response}\n\n\n"
|
|
141
|
+
raise e
|
|
141
142
|
rescue StandardError, SystemExit, Interrupt => e
|
|
142
143
|
dd_obj = logout(dd_obj) unless dd_obj.nil?
|
|
143
144
|
raise e
|
|
@@ -153,6 +154,7 @@ module PWN
|
|
|
153
154
|
dd_obj = opts[:dd_obj]
|
|
154
155
|
api_version = dd_obj[:api_version]
|
|
155
156
|
tool_config_name = opts[:tool_config_name].to_s.scrub
|
|
157
|
+
return nil if tool_config_name.empty?
|
|
156
158
|
|
|
157
159
|
tool_configuration_list = self.tool_configuration_list(dd_obj: dd_obj)
|
|
158
160
|
if api_version == 'v1'
|
|
@@ -218,6 +220,8 @@ module PWN
|
|
|
218
220
|
)
|
|
219
221
|
|
|
220
222
|
engagements = JSON.parse(response, symbolize_names: true)
|
|
223
|
+
return engagements if opts[:id]
|
|
224
|
+
|
|
221
225
|
total_engagements_avail = engagements[:count]
|
|
222
226
|
total_enagements_aggregated = engagements[:results]
|
|
223
227
|
|
|
@@ -283,7 +287,7 @@ module PWN
|
|
|
283
287
|
|
|
284
288
|
http_body[:description] = opts[:description]
|
|
285
289
|
|
|
286
|
-
|
|
290
|
+
http_body[:engagement_type] = opts[:engagement_type] || opts[:engagment_type] || 'CI/CD'
|
|
287
291
|
|
|
288
292
|
status = opts[:status].to_s.strip.chomp.scrub
|
|
289
293
|
|
|
@@ -182,7 +182,7 @@ module PWN
|
|
|
182
182
|
end
|
|
183
183
|
found << name if ok
|
|
184
184
|
end
|
|
185
|
-
native = found.map(&:to_s).reject(&:empty?).uniq.sort
|
|
185
|
+
native = (found.map(&:to_s).reject(&:empty?).uniq - pwn_installed_bins(opts)).sort
|
|
186
186
|
cap = if opts.key?(:cap_net_raw)
|
|
187
187
|
opts[:cap_net_raw]
|
|
188
188
|
else
|
data/lib/pwn/plugins/detonate.rb
CHANGED
|
@@ -18,24 +18,14 @@ module PWN
|
|
|
18
18
|
net = (opts[:network] || :none).to_s
|
|
19
19
|
return { error: 'isolation preconditions unmet', hint: 'install podman (rootless); never falling back to host', path: path } unless PWN::Plugins::PreflightChecker.bin?(name: 'podman')
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
stdout, stderr, status = Open3.capture3(*cmd)
|
|
30
|
-
iocs = {
|
|
31
|
-
stdout: stdout,
|
|
32
|
-
stderr: stderr,
|
|
33
|
-
exit: status.exitstatus,
|
|
34
|
-
home_untouched: File.directory?(home),
|
|
35
|
-
attempted_home_write: stdout.include?('attempted_write_home')
|
|
36
|
-
}
|
|
37
|
-
{ iocs: iocs, network: net, timeout: timeout, isolated: true }
|
|
38
|
-
end
|
|
21
|
+
{
|
|
22
|
+
error: 'sample execution backend is not implemented; refusing synthetic detonation',
|
|
23
|
+
path: path,
|
|
24
|
+
network: net,
|
|
25
|
+
timeout: timeout,
|
|
26
|
+
isolated: false,
|
|
27
|
+
executed: false
|
|
28
|
+
}
|
|
39
29
|
end
|
|
40
30
|
|
|
41
31
|
public_class_method def self.authors
|
|
@@ -44,7 +34,7 @@ module PWN
|
|
|
44
34
|
|
|
45
35
|
public_class_method def self.help
|
|
46
36
|
puts "USAGE:
|
|
47
|
-
#
|
|
37
|
+
# Validate the sample and report unavailable execution honestly; never run it on the host.
|
|
48
38
|
#{self}.detonate(
|
|
49
39
|
path: 'required - sample filesystem path',
|
|
50
40
|
sample: 'optional - alias for path',
|
|
@@ -70,12 +70,12 @@ module PWN
|
|
|
70
70
|
public_class_method def self.sync(opts = {})
|
|
71
71
|
dest = opts[:dir].to_s
|
|
72
72
|
dest = intel_dir if dest.empty?
|
|
73
|
-
FileUtils.mkdir_p(dest)
|
|
74
73
|
fetched = []
|
|
75
74
|
csv_url = (opts[:csv_url] || EXPLOITDB_CSV_URL).to_s
|
|
76
75
|
bins_url = (opts[:gtfobins_url] || GTFOBINS_TAR_URL).to_s
|
|
77
76
|
return { dest: dest, dry_run: true, urls: [csv_url, bins_url], fetched: [] } if opts[:dry_run]
|
|
78
77
|
|
|
78
|
+
FileUtils.mkdir_p(dest)
|
|
79
79
|
csv_body = http_get(url: csv_url, get: opts[:get], timeout: opts[:timeout])
|
|
80
80
|
csv_path = File.join(dest, 'files_exploits.csv')
|
|
81
81
|
File.binwrite(csv_path, csv_body)
|
data/lib/pwn/plugins/file_fu.rb
CHANGED
data/lib/pwn/plugins/findings.rb
CHANGED
|
@@ -19,6 +19,7 @@ module PWN
|
|
|
19
19
|
|
|
20
20
|
# Strict P10 boundary. Legacy record remains available for older callers.
|
|
21
21
|
public_class_method def self.record_structured(opts = {})
|
|
22
|
+
lock = writer_lock
|
|
22
23
|
opts = opts.transform_keys(&:to_sym)
|
|
23
24
|
opts[:affected_asset] ||= opts[:target]
|
|
24
25
|
opts[:poc] ||= opts[:repro_cmd]
|
|
@@ -38,6 +39,7 @@ module PWN
|
|
|
38
39
|
|
|
39
40
|
artifacts = resolve_evidence(opts)
|
|
40
41
|
paths = artifacts.map { |artifact| artifact[:path] }.uniq
|
|
42
|
+
leases = source_leases(session_id: opts[:session_id], paths: paths)
|
|
41
43
|
steps = opts[:reproduction_steps] || [opts[:poc]]
|
|
42
44
|
raise ArgumentError, 'reproduction_steps must be a nonempty Array of nonempty strings' unless steps.is_a?(Array) && !steps.empty? && steps.all? { |step| step.is_a?(String) && !step.strip.empty? }
|
|
43
45
|
|
|
@@ -68,6 +70,9 @@ module PWN
|
|
|
68
70
|
file.puts(JSON.generate(row))
|
|
69
71
|
end
|
|
70
72
|
row
|
|
73
|
+
ensure
|
|
74
|
+
Array(leases).each { |lease| PWN::Sessions.deactivate(lease: lease) }
|
|
75
|
+
writer_unlock(lock: lock)
|
|
71
76
|
end
|
|
72
77
|
|
|
73
78
|
private_class_method def self.engagement_scope(opts = {})
|
|
@@ -171,6 +176,7 @@ module PWN
|
|
|
171
176
|
end
|
|
172
177
|
|
|
173
178
|
public_class_method def self.record(opts = {})
|
|
179
|
+
lock = writer_lock
|
|
174
180
|
title = opts[:title].to_s
|
|
175
181
|
raise 'ERROR: title is required' if title.empty?
|
|
176
182
|
|
|
@@ -182,6 +188,8 @@ module PWN
|
|
|
182
188
|
end
|
|
183
189
|
raise 'ERROR: poc_artifacts are required' if arts.empty?
|
|
184
190
|
|
|
191
|
+
leases = source_leases(session_id: opts[:session_id], paths: arts)
|
|
192
|
+
|
|
185
193
|
ev = opts[:evidence]
|
|
186
194
|
ev_list = Array(ev).map(&:to_s)
|
|
187
195
|
ev_text = ev_list.join(' ')
|
|
@@ -222,6 +230,9 @@ module PWN
|
|
|
222
230
|
File.open(FILE, 'a') { |f| f.puts(JSON.generate(row)) }
|
|
223
231
|
note_mission(finding_id: row[:id], host: opts[:host])
|
|
224
232
|
row
|
|
233
|
+
ensure
|
|
234
|
+
Array(leases).each { |lease| PWN::Sessions.deactivate(lease: lease) }
|
|
235
|
+
writer_unlock(lock: lock)
|
|
225
236
|
end
|
|
226
237
|
|
|
227
238
|
private_class_method def self.note_mission(opts = {})
|
|
@@ -437,8 +448,11 @@ module PWN
|
|
|
437
448
|
steps = reproduction_commands(row: row)
|
|
438
449
|
raise ArgumentError, 'reproduction_steps are required to verify' if steps.empty?
|
|
439
450
|
|
|
440
|
-
|
|
451
|
+
reproduction = run_reproduction(steps: steps)
|
|
452
|
+
transcript = reproduction[:transcript]
|
|
441
453
|
hit = transcript.include?(impact)
|
|
454
|
+
raise IOError, 'PoC reproduction failed; retest outcome is unknown' if opts[:mode].to_s == 'retest' && !hit && !reproduction[:success]
|
|
455
|
+
|
|
442
456
|
arts = steps.select { |step| step.start_with?('/') && File.file?(step) }
|
|
443
457
|
if opts[:mode].to_s == 'retest'
|
|
444
458
|
status = hit ? 'still_open' : 'fixed'
|
|
@@ -504,12 +518,14 @@ module PWN
|
|
|
504
518
|
|
|
505
519
|
private_class_method def self.run_reproduction(opts = {})
|
|
506
520
|
transcript = +''
|
|
521
|
+
success = true
|
|
507
522
|
Array(opts[:steps]).each do |step|
|
|
508
523
|
stdout, stderr, status = Open3.capture3('sh', '-c', step.to_s)
|
|
524
|
+
success &&= status.success?
|
|
509
525
|
transcript << stdout.to_s << stderr.to_s
|
|
510
526
|
transcript << "\nexit=#{status.exitstatus}\n"
|
|
511
527
|
end
|
|
512
|
-
transcript
|
|
528
|
+
{ transcript: transcript, success: success }
|
|
513
529
|
end
|
|
514
530
|
|
|
515
531
|
private_class_method def self.claimed_severity(opts = {})
|
|
@@ -552,6 +568,7 @@ module PWN
|
|
|
552
568
|
end
|
|
553
569
|
|
|
554
570
|
private_class_method def self.rewrite_row(opts = {})
|
|
571
|
+
lock = writer_lock
|
|
555
572
|
id = opts[:id].to_s
|
|
556
573
|
patch = opts[:patch] || {}
|
|
557
574
|
rows = report
|
|
@@ -561,9 +578,12 @@ module PWN
|
|
|
561
578
|
rows[idx] = rows[idx].merge(patch)
|
|
562
579
|
persist_rows(rows: rows)
|
|
563
580
|
rows[idx]
|
|
581
|
+
ensure
|
|
582
|
+
writer_unlock(lock: lock)
|
|
564
583
|
end
|
|
565
584
|
|
|
566
585
|
private_class_method def self.persist_rows(opts = {})
|
|
586
|
+
lock = writer_lock
|
|
567
587
|
rows = opts[:rows]
|
|
568
588
|
FileUtils.mkdir_p(File.dirname(FILE))
|
|
569
589
|
File.open(FILE, File::RDWR | File::CREAT, 0o644) do |file|
|
|
@@ -575,11 +595,62 @@ module PWN
|
|
|
575
595
|
file.fsync
|
|
576
596
|
end
|
|
577
597
|
rows
|
|
598
|
+
ensure
|
|
599
|
+
writer_unlock(lock: lock)
|
|
600
|
+
end
|
|
601
|
+
|
|
602
|
+
# Permanent store ownership precedes nonblocking source leases, matching
|
|
603
|
+
# Sessions mutation and cleanup. Never publish a reference to a lost source.
|
|
604
|
+
private_class_method def self.writer_lock
|
|
605
|
+
path = File.join(File.dirname(FILE), '.findings-write.lock')
|
|
606
|
+
owner = Thread.current[:pwn_findings_write_lock]
|
|
607
|
+
return nil if owner && owner[:pid] == Process.pid && owner[:thread] == Thread.current && owner[:path] == path && !owner[:file].closed?
|
|
608
|
+
|
|
609
|
+
FileUtils.mkdir_p(File.dirname(path), mode: 0o700)
|
|
610
|
+
raise IOError, 'Unsafe findings lock directory' unless File.realpath(File.dirname(path)) == File.expand_path(File.dirname(path))
|
|
611
|
+
|
|
612
|
+
file = File.open(path, File::RDWR | File::CREAT | File::NOFOLLOW, 0o600) # rubocop:disable Style/FileOpen -- caller owns lock until ensure
|
|
613
|
+
file.flock(File::LOCK_EX)
|
|
614
|
+
Thread.current[:pwn_findings_write_lock] = { pid: Process.pid, thread: Thread.current, path: path, file: file }
|
|
615
|
+
file
|
|
616
|
+
rescue Exception # rubocop:disable Lint/RescueException -- release untransferred lock on cancellation
|
|
617
|
+
file&.close
|
|
618
|
+
raise
|
|
619
|
+
end
|
|
620
|
+
|
|
621
|
+
private_class_method def self.writer_unlock(opts = {})
|
|
622
|
+
lock = opts[:lock]
|
|
623
|
+
return unless lock
|
|
624
|
+
|
|
625
|
+
Thread.current[:pwn_findings_write_lock] = nil
|
|
626
|
+
lock.close
|
|
627
|
+
end
|
|
628
|
+
|
|
629
|
+
private_class_method def self.source_leases(opts = {})
|
|
630
|
+
ids = [opts[:session_id].to_s]
|
|
631
|
+
Array(opts[:paths]).each do |path|
|
|
632
|
+
next unless File.dirname(path) == PWN::Sessions::SESSIONS_DIR && path.match?(/\.(?:meta\.json|jsonl)\z/)
|
|
633
|
+
|
|
634
|
+
ids << File.basename(path).sub(/\.(?:meta\.json|jsonl)\z/, '')
|
|
635
|
+
end
|
|
636
|
+
leases = []
|
|
637
|
+
ids.reject(&:empty?).uniq.sort.each do |id|
|
|
638
|
+
transcript = File.join(PWN::Sessions.sessions_dir, "#{id}.jsonl")
|
|
639
|
+
next unless id.match?(PWN::Sessions::SESSION_ID) || File.file?(transcript)
|
|
640
|
+
|
|
641
|
+
leases << PWN::Sessions.activate(session_id: id)
|
|
642
|
+
end
|
|
643
|
+
leases
|
|
644
|
+
rescue Exception # rubocop:disable Lint/RescueException -- release partial acquisition on cancellation
|
|
645
|
+
Array(leases).each { |lease| PWN::Sessions.deactivate(lease: lease) }
|
|
646
|
+
raise
|
|
578
647
|
end
|
|
579
648
|
|
|
580
649
|
private_class_method def self.evidence_anchor(opts = {})
|
|
650
|
+
lock = writer_lock
|
|
581
651
|
row = opts[:row]
|
|
582
652
|
arts = Array(opts[:arts])
|
|
653
|
+
leases = source_leases(session_id: row[:session_id], paths: arts)
|
|
583
654
|
eng = row[:engagement_id].to_s
|
|
584
655
|
eng = 'default' if eng.empty?
|
|
585
656
|
raise ArgumentError, 'engagement_id must be a simple identifier' unless eng.match?(/\A[a-zA-Z0-9_-]+\z/)
|
|
@@ -619,6 +690,9 @@ module PWN
|
|
|
619
690
|
end
|
|
620
691
|
rec
|
|
621
692
|
end
|
|
693
|
+
ensure
|
|
694
|
+
Array(leases).each { |lease| PWN::Sessions.deactivate(lease: lease) }
|
|
695
|
+
writer_unlock(lock: lock)
|
|
622
696
|
end
|
|
623
697
|
|
|
624
698
|
public_class_method def self.authors
|
data/lib/pwn/plugins/fuzz.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require 'base64'
|
|
4
4
|
require 'cgi'
|
|
5
5
|
require 'htmlentities'
|
|
6
|
+
require 'timeout'
|
|
6
7
|
|
|
7
8
|
module PWN
|
|
8
9
|
module Plugins
|
|
@@ -123,12 +124,20 @@ module PWN
|
|
|
123
124
|
this_socket_fuzz_result[:request_encoding] = this_request.encoding.name
|
|
124
125
|
this_socket_fuzz_result[:request_len] = this_request.length
|
|
125
126
|
|
|
126
|
-
# Send
|
|
127
|
-
sock_obj.write(this_request.
|
|
127
|
+
# Send the template bytes without interpreting Ruby string-literal escapes.
|
|
128
|
+
sock_obj.write(this_request.b)
|
|
128
129
|
|
|
129
130
|
does_respond = sock_obj.wait_readable(response_timeout)
|
|
130
131
|
if does_respond
|
|
131
|
-
response =
|
|
132
|
+
response = +''.b
|
|
133
|
+
begin
|
|
134
|
+
Timeout.timeout(response_timeout) do
|
|
135
|
+
loop { response << sock_obj.readpartial(16_384) }
|
|
136
|
+
end
|
|
137
|
+
rescue EOFError, Timeout::Error
|
|
138
|
+
# Preserve bytes already received when the peer closes or stays open.
|
|
139
|
+
nil
|
|
140
|
+
end
|
|
132
141
|
response_len = response.length
|
|
133
142
|
this_socket_fuzz_result[:response] = response.to_s.inspect
|
|
134
143
|
this_socket_fuzz_result[:response_len] = response_len
|
data/lib/pwn/plugins/gdb.rb
CHANGED
|
@@ -26,7 +26,7 @@ module PWN
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
public_class_method def self.run_to_crash(opts = {})
|
|
29
|
-
cmds = ['run', 'bt', 'info registers']
|
|
29
|
+
cmds = Array(opts[:commands] || opts[:cmds]) + ['run', 'bt', 'info registers']
|
|
30
30
|
batch(opts.merge(commands: cmds))
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -120,7 +120,12 @@ module PWN
|
|
|
120
120
|
)
|
|
121
121
|
|
|
122
122
|
# Run run to crash and return its result
|
|
123
|
-
#{self}.run_to_crash
|
|
123
|
+
#{self}.run_to_crash(
|
|
124
|
+
binary: 'required - executable to run under gdb',
|
|
125
|
+
args: 'optional - Array of inferior arguments',
|
|
126
|
+
commands: 'optional - setup commands issued before run, backtrace and registers',
|
|
127
|
+
cmds: 'optional - alias for commands'
|
|
128
|
+
)
|
|
124
129
|
|
|
125
130
|
# Run registers and return its result
|
|
126
131
|
#{self}.registers
|
data/lib/pwn/plugins/gdbmi.rb
CHANGED
|
@@ -104,19 +104,21 @@ module PWN
|
|
|
104
104
|
public_class_method def self.run_to_crash(opts = {})
|
|
105
105
|
sid = opts[:session] || PWN::Plugins::GDBMI.open(opts)
|
|
106
106
|
begin
|
|
107
|
-
run(opts.merge(session: sid))
|
|
107
|
+
execution = run(opts.merge(session: sid))
|
|
108
|
+
raise IOError, "GDB execution failed: #{execution[:raw]}" unless execution[:ok]
|
|
109
|
+
|
|
108
110
|
regs = registers(session: sid)
|
|
109
111
|
stack = backtrace(session: sid)
|
|
110
112
|
fault = evaluate(session: sid, expr: '$_siginfo._sifields._sigfault.si_addr')
|
|
111
|
-
stopped = regs[:stopped]
|
|
113
|
+
stopped = [execution[:stopped], regs[:stopped], stack[:stopped]].find { |record| record && !record.empty? } || {}
|
|
112
114
|
pc = regs[:registers]['rip'] || regs[:registers]['eip'] || regs[:registers]['pc'] || stopped[:addr]
|
|
113
|
-
signal = stopped[:signal]
|
|
115
|
+
signal = stopped[:signal]
|
|
114
116
|
fault_addr = fault || stopped[:addr]
|
|
115
117
|
crash = {
|
|
116
118
|
signal: signal,
|
|
117
119
|
pc: pc,
|
|
118
120
|
fault_addr: fault_addr,
|
|
119
|
-
exploitability: classify(signal: signal, pc: pc),
|
|
121
|
+
exploitability: classify(signal: signal, pc: pc, reason: stopped[:reason]),
|
|
120
122
|
registers: regs[:registers],
|
|
121
123
|
backtrace: stack[:frames],
|
|
122
124
|
interpreter: 'mi3',
|
|
@@ -318,7 +320,7 @@ module PWN
|
|
|
318
320
|
mem = { addr: m[1], hex: m[2], bytes: [m[2]].pack('H*') }
|
|
319
321
|
end
|
|
320
322
|
{
|
|
321
|
-
ok: raw.match?(/\^(?:done|running|exit)|\*stopped/),
|
|
323
|
+
ok: !raw.match?(/^\d*\^error(?:,|\s|$)/) && raw.match?(/\^(?:done|running|exit)|\*stopped/),
|
|
322
324
|
raw: raw,
|
|
323
325
|
registers: regs,
|
|
324
326
|
frames: frames,
|
|
@@ -337,12 +339,14 @@ module PWN
|
|
|
337
339
|
end
|
|
338
340
|
|
|
339
341
|
private_class_method def self.classify(opts = {})
|
|
342
|
+
return 'none' if %w[exited-normally exited].include?(opts[:reason])
|
|
343
|
+
return 'unknown' if opts[:signal].to_s.empty?
|
|
344
|
+
|
|
340
345
|
pc = opts[:pc].to_s.sub(/\A0x/, '')
|
|
341
346
|
bytes = [pc].pack('H*')
|
|
342
347
|
return 'pc_control' if bytes.bytesize >= 4 && bytes.bytes.all? { |byte| byte.between?(0x20, 0x7e) }
|
|
343
348
|
return 'exploitable' if opts[:signal].to_s.match?(/SEGV|ILL|BUS/)
|
|
344
349
|
return 'abort' if opts[:signal].to_s.include?('ABRT')
|
|
345
|
-
return 'none' if opts[:signal].to_s.empty?
|
|
346
350
|
|
|
347
351
|
'unknown'
|
|
348
352
|
rescue StandardError
|
data/lib/pwn/plugins/git.rb
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'shellwords'
|
|
4
|
+
require 'open3'
|
|
5
|
+
require 'cgi'
|
|
4
6
|
|
|
5
7
|
module PWN
|
|
6
8
|
module Plugins
|
|
@@ -21,17 +23,17 @@ module PWN
|
|
|
21
23
|
git_repo_branch = opts[:branch].to_s
|
|
22
24
|
since_date = opts[:since]
|
|
23
25
|
|
|
24
|
-
git_pull_output = '<div style="background-color:#CCCCCC; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">'
|
|
26
|
+
git_pull_output = +'<div style="background-color:#CCCCCC; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">'
|
|
25
27
|
if since_date
|
|
26
|
-
git_pull_output << "<h3>#{git_repo_name}->#{git_repo_branch} Diff Summary Since #{since_date}</h3>"
|
|
27
|
-
git_entity =
|
|
28
|
+
git_pull_output << "<h3>#{CGI.escapeHTML(git_repo_name)}->#{CGI.escapeHTML(git_repo_branch)} Diff Summary Since #{CGI.escapeHTML(since_date.to_s)}</h3>"
|
|
29
|
+
git_entity = Open3.capture2('git', 'log', '--since', since_date.to_s, '--stat-width=65535', '--graph', err: File::NULL).first.to_s.scrub
|
|
28
30
|
else
|
|
29
|
-
git_pull_output << "<h3>#{git_repo_name}->#{git_repo_branch} Diff Summary Since Last Pull</h3>"
|
|
30
|
-
git_entity =
|
|
31
|
+
git_pull_output << "<h3>#{CGI.escapeHTML(git_repo_name)}->#{CGI.escapeHTML(git_repo_branch)} Diff Summary Since Last Pull</h3>"
|
|
32
|
+
git_entity = Open3.capture2('git', 'log', 'ORIG_HEAD..', '--stat-width=65535', '--graph', err: File::NULL).first.to_s.scrub
|
|
31
33
|
end
|
|
32
34
|
# For debugging purposes
|
|
33
35
|
@@logger.info(git_entity)
|
|
34
|
-
git_pull_output << git_entity.gsub("\n", '<br />')
|
|
36
|
+
git_pull_output << CGI.escapeHTML(git_entity).gsub("\n", '<br />')
|
|
35
37
|
git_pull_output << '</div>'
|
|
36
38
|
git_pull_output << '<br />'
|
|
37
39
|
|
|
@@ -53,10 +55,12 @@ module PWN
|
|
|
53
55
|
repo_root = opts[:repo_root].to_s unless repo_root.is_a?(String)
|
|
54
56
|
from_line = opts[:from_line].to_i
|
|
55
57
|
to_line = opts[:to_line].to_i
|
|
56
|
-
target_file = opts[:target_file].to_s
|
|
57
|
-
target_file.gsub!(%r{^#{repo_root}/}, '')
|
|
58
|
+
target_file = opts[:target_file].to_s.delete_prefix("#{repo_root}/")
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
return unless File.directory?(repo_root) && File.file?("#{repo_root}/#{target_file}")
|
|
61
|
+
|
|
62
|
+
output = Open3.capture2('git', "--git-dir=#{repo_root}/.git", 'log', '-L', "#{from_line},#{to_line}:#{target_file}", err: File::NULL).first
|
|
63
|
+
output.to_s.scrub.lines.find { |line| line.start_with?('Author:') }
|
|
60
64
|
rescue StandardError => e
|
|
61
65
|
raise e
|
|
62
66
|
end
|
|
@@ -68,7 +72,7 @@ module PWN
|
|
|
68
72
|
|
|
69
73
|
public_class_method def self.dump_all_repo_branches(opts = {})
|
|
70
74
|
git_url = opts[:git_url].to_s.scrub
|
|
71
|
-
|
|
75
|
+
Open3.capture2('git', 'ls-remote', '--', git_url, err: File::NULL).first.to_s.scrub
|
|
72
76
|
rescue StandardError => e
|
|
73
77
|
raise e
|
|
74
78
|
end
|
|
@@ -93,9 +97,10 @@ module PWN
|
|
|
93
97
|
# we need to query the original file
|
|
94
98
|
# instead of the .JS-BEAUTIFIED file
|
|
95
99
|
if entry_beautified
|
|
96
|
-
target_file.
|
|
97
|
-
|
|
98
|
-
target_file_line_length =
|
|
100
|
+
target_file = target_file.to_s.sub(/\.JS-BEAUTIFIED$/, '')
|
|
101
|
+
source_file = File.expand_path(target_file, repo_root || '.')
|
|
102
|
+
target_file_line_length = File.file?(source_file) ? File.foreach(source_file).count : 1
|
|
103
|
+
target_file_line_length = 1 if target_file_line_length < 1
|
|
99
104
|
|
|
100
105
|
author = get_author_by_line_range(
|
|
101
106
|
repo_root: repo_root,
|
data/lib/pwn/plugins/github.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'json'
|
|
4
4
|
require 'open3'
|
|
5
|
+
require 'shellwords'
|
|
5
6
|
|
|
6
7
|
module PWN
|
|
7
8
|
module Plugins
|
|
@@ -76,10 +77,11 @@ module PWN
|
|
|
76
77
|
url: "#{base_api_uri}/#{rest_call}",
|
|
77
78
|
headers: headers,
|
|
78
79
|
payload: http_body,
|
|
79
|
-
verify_ssl:
|
|
80
|
+
verify_ssl: true
|
|
80
81
|
)
|
|
81
82
|
|
|
82
83
|
return response if raw
|
|
84
|
+
return {} if response.code == 204
|
|
83
85
|
|
|
84
86
|
JSON.parse(response.body, symbolize_names: true)
|
|
85
87
|
rescue RestClient::Forbidden, RestClient::Unauthorized => e
|
|
@@ -256,17 +258,20 @@ module PWN
|
|
|
256
258
|
|
|
257
259
|
# Supported Method Parameters::
|
|
258
260
|
# PWN::Plugins::Github.gh(
|
|
259
|
-
# cmd: 'required -
|
|
261
|
+
# cmd: 'required - argv Array or shellword-quoted subcommand string; no shell expansion',
|
|
260
262
|
# token: 'optional - PAT (default PWN::Env[:plugins][:github][:personal_access_token])'
|
|
261
263
|
# )
|
|
262
264
|
# Thin wrapper around the `gh` CLI with GH_TOKEN injected from PWN::Env so
|
|
263
265
|
# `gh auth login` is never required.
|
|
264
266
|
|
|
265
267
|
public_class_method def self.gh(opts = {})
|
|
266
|
-
cmd = opts[:cmd]
|
|
268
|
+
cmd = opts[:cmd]
|
|
269
|
+
argv = cmd.is_a?(Array) ? cmd : Shellwords.split(cmd.to_s)
|
|
270
|
+
raise ArgumentError, 'cmd must contain a gh subcommand and string arguments' if argv.empty? || !argv.all?(String)
|
|
271
|
+
|
|
267
272
|
gh_bin = ENV['PATH'].to_s.split(File::PATH_SEPARATOR)
|
|
268
273
|
.map { |d| File.join(d, 'gh') }
|
|
269
|
-
.find { |f| File.executable?(f) }
|
|
274
|
+
.find { |f| File.file?(f) && File.executable?(f) }
|
|
270
275
|
# Run api and return its result
|
|
271
276
|
raise "ERROR: gh CLI not found on PATH - use #{self}.api(path:) instead, or install gh (https://cli.github.com)" unless gh_bin
|
|
272
277
|
|
|
@@ -274,7 +279,7 @@ module PWN
|
|
|
274
279
|
raise 'ERROR: no GitHub token - set plugins.github.personal_access_token in ~/.pwn/pwn.yaml' unless token
|
|
275
280
|
|
|
276
281
|
env = { 'GH_TOKEN' => token, 'GH_PROMPT_DISABLED' => '1', 'NO_COLOR' => '1' }
|
|
277
|
-
stdout, stderr, status = Open3.capture3(env,
|
|
282
|
+
stdout, stderr, status = Open3.capture3(env, [gh_bin, gh_bin], *argv)
|
|
278
283
|
{ stdout: stdout, stderr: stderr, exit: status.exitstatus }
|
|
279
284
|
rescue StandardError => e
|
|
280
285
|
raise e
|
|
@@ -348,7 +353,7 @@ module PWN
|
|
|
348
353
|
|
|
349
354
|
# Thin wrapper around the `gh` CLI with GH_TOKEN injected from PWN::Env so
|
|
350
355
|
#{self}.gh(
|
|
351
|
-
cmd: 'required - gh subcommand string
|
|
356
|
+
cmd: 'required - argv Array or shellword-quoted gh subcommand string; metacharacters are literal, never shell-expanded',
|
|
352
357
|
token: 'optional - PAT (default PWN::Env[:plugins][:github][:personal_access_token])'
|
|
353
358
|
)
|
|
354
359
|
|
|
@@ -355,7 +355,7 @@ module PWN
|
|
|
355
355
|
RestClient.post(REVOKE_URI, { token: tok }, content_type: 'application/x-www-form-urlencoded') if real_config_value?(value: tok)
|
|
356
356
|
blank = { bearer_token: nil, refresh_token: nil, expires_at: nil }
|
|
357
357
|
sync_oauth_into_env(oauth: c.merge(blank))
|
|
358
|
-
persist_oauth_to_vault(oauth: c
|
|
358
|
+
persist_oauth_to_vault(oauth: c, revoke: true)
|
|
359
359
|
FileUtils.rm_f(PENDING_FILE)
|
|
360
360
|
true
|
|
361
361
|
rescue RestClient::ExceptionWithResponse
|
|
@@ -409,8 +409,11 @@ module PWN
|
|
|
409
409
|
slot = vault[:plugins][:google_workspace][:oauth]
|
|
410
410
|
slot = vault[:plugins][:google_workspace][:oauth] = {} unless slot.is_a?(Hash)
|
|
411
411
|
%i[bearer_token refresh_token expires_at client_id client_secret redirect_uri scope].each do |k|
|
|
412
|
+
# Missing grant fields (including nil) do not revoke prior values.
|
|
412
413
|
slot[k] = oauth[k] if oauth.key?(k) && !oauth[k].nil?
|
|
413
414
|
end
|
|
415
|
+
# Only the explicit revoke operation clears durable token fields.
|
|
416
|
+
slot.merge!(bearer_token: '', refresh_token: nil, expires_at: nil) if opts[:revoke] == true
|
|
414
417
|
end
|
|
415
418
|
true
|
|
416
419
|
rescue StandardError => e
|
|
@@ -478,6 +481,9 @@ module PWN
|
|
|
478
481
|
id: msg[:id],
|
|
479
482
|
threadId: msg[:threadId],
|
|
480
483
|
from: headers['from'],
|
|
484
|
+
reply_to: headers['reply-to'],
|
|
485
|
+
message_id: headers['message-id'],
|
|
486
|
+
references: headers['references'],
|
|
481
487
|
to: headers['to'],
|
|
482
488
|
subject: headers['subject'],
|
|
483
489
|
date: headers['date'],
|
|
@@ -518,7 +524,8 @@ module PWN
|
|
|
518
524
|
orig = gmail_get(id: id)
|
|
519
525
|
subj = orig[:subject].to_s
|
|
520
526
|
subj = "Re: #{subj}" unless subj.downcase.start_with?('re:')
|
|
521
|
-
|
|
527
|
+
references = [orig[:references], orig[:message_id]].compact.join(' ')
|
|
528
|
+
raw = gmail_rfc822(opts.merge(to: orig[:reply_to] || orig[:from], subject: subj, in_reply_to: orig[:message_id], references: references))
|
|
522
529
|
sent = api(
|
|
523
530
|
http_method: :post,
|
|
524
531
|
url: "#{GMAIL_API}/users/me/messages/send",
|
|
@@ -539,6 +546,7 @@ module PWN
|
|
|
539
546
|
"Content-Type: #{ctype}; charset=UTF-8"
|
|
540
547
|
]
|
|
541
548
|
lines << "In-Reply-To: #{opts[:in_reply_to]}" if opts[:in_reply_to]
|
|
549
|
+
lines << "References: #{opts[:references]}" unless opts[:references].to_s.empty?
|
|
542
550
|
lines << ''
|
|
543
551
|
lines << opts[:body].to_s
|
|
544
552
|
Base64.urlsafe_encode64(lines.join("\r\n"), padding: false)
|
|
@@ -635,7 +643,7 @@ module PWN
|
|
|
635
643
|
|
|
636
644
|
public_class_method def self.drive_search(opts = {})
|
|
637
645
|
q = opts[:query].to_s
|
|
638
|
-
q = "fullText contains '#{q.gsub(
|
|
646
|
+
q = "fullText contains '#{q.gsub(/['\\]/) { |char| "\\#{char}" }}'" unless opts[:raw_query]
|
|
639
647
|
data = api(
|
|
640
648
|
url: "#{DRIVE_API}/files",
|
|
641
649
|
params: {
|
|
@@ -90,13 +90,17 @@ module PWN
|
|
|
90
90
|
url: url,
|
|
91
91
|
headers: headers,
|
|
92
92
|
payload: http_body,
|
|
93
|
-
verify_ssl:
|
|
93
|
+
verify_ssl: true
|
|
94
94
|
)
|
|
95
95
|
|
|
96
96
|
return response if raw
|
|
97
|
+
return {} if response.code == 204
|
|
97
98
|
|
|
98
99
|
JSON.parse(response.body, symbolize_names: true)
|
|
99
100
|
rescue ::RestClient::TooManyRequests
|
|
101
|
+
retry_count = retry_count.to_i + 1
|
|
102
|
+
raise if retry_count > 3
|
|
103
|
+
|
|
100
104
|
@@logger.warn('HackerOne rate limit (429). Sleeping 10s then retrying...')
|
|
101
105
|
sleep 10
|
|
102
106
|
retry
|