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/httpx.rb
CHANGED
|
@@ -12,7 +12,10 @@ module PWN
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
public_class_method def self.probe(opts = {})
|
|
15
|
-
|
|
15
|
+
body = jsonl_body(opts)
|
|
16
|
+
return { hosts: [], techs: [], error: 'missing jsonl file', stderr: nil, exit: nil } if body.is_a?(Hash) && body[:missing]
|
|
17
|
+
|
|
18
|
+
stdout = body
|
|
16
19
|
unless stdout
|
|
17
20
|
PWN::Plugins::PreflightChecker.require_bin!(name: 'httpx')
|
|
18
21
|
targets = Array(opts[:targets] || opts[:target] || opts[:urls]).map(&:to_s).reject(&:empty?)
|
|
@@ -22,8 +25,9 @@ module PWN
|
|
|
22
25
|
cmd += ['-u', *targets] if targets.length == 1
|
|
23
26
|
stdout, stderr, status = capture(cmd: cmd, stdin: targets.length > 1 ? "#{targets.join("\n")}\n" : nil)
|
|
24
27
|
end
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
parsed = parse_jsonl(text: stdout)
|
|
29
|
+
rows = parsed[:rows]
|
|
30
|
+
{ hosts: rows, techs: techs(rows: rows), stderr: stderr, exit: status&.exitstatus, rejected: parsed[:rejected] }
|
|
27
31
|
end
|
|
28
32
|
|
|
29
33
|
public_class_method def self.techs(opts = {})
|
|
@@ -48,7 +52,7 @@ module PWN
|
|
|
48
52
|
target: 'optional - single URL or hostname (required unless jsonl or targets is set)',
|
|
49
53
|
targets: 'optional - Array of URLs',
|
|
50
54
|
urls: 'optional - alias for targets',
|
|
51
|
-
jsonl: 'optional - httpx JSONL file path or raw JSONL text (skips the httpx binary)'
|
|
55
|
+
jsonl: 'optional - httpx JSONL file path or raw JSONL text (skips the httpx binary); a missing path-like value returns an error and malformed lines increment rejected',
|
|
52
56
|
)
|
|
53
57
|
|
|
54
58
|
# Flatten tech/product names from parsed httpx JSONL rows.
|
|
@@ -67,15 +71,27 @@ module PWN
|
|
|
67
71
|
src = opts[:jsonl]
|
|
68
72
|
return nil if src.nil?
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
text = src.to_s
|
|
75
|
+
if text.start_with?('/') || text.match?(/\.jsonl\z/i)
|
|
76
|
+
return { missing: true } unless File.file?(text)
|
|
77
|
+
|
|
78
|
+
return File.read(text)
|
|
79
|
+
end
|
|
80
|
+
text
|
|
71
81
|
end
|
|
72
82
|
|
|
73
83
|
private_class_method def self.parse_jsonl(opts = {})
|
|
74
|
-
|
|
75
|
-
|
|
84
|
+
rows = []
|
|
85
|
+
rejected = 0
|
|
86
|
+
opts[:text].to_s.each_line do |line|
|
|
87
|
+
next if line.strip.empty?
|
|
88
|
+
|
|
89
|
+
row = JSON.parse(line)
|
|
90
|
+
row.is_a?(Hash) ? rows << row : rejected += 1
|
|
76
91
|
rescue JSON::ParserError
|
|
77
|
-
|
|
92
|
+
rejected += 1
|
|
78
93
|
end
|
|
94
|
+
{ rows: rows, rejected: rejected }
|
|
79
95
|
end
|
|
80
96
|
|
|
81
97
|
private_class_method def self.capture(opts = {})
|
data/lib/pwn/plugins/ip_info.rb
CHANGED
|
@@ -93,7 +93,7 @@ module PWN
|
|
|
93
93
|
dns_resolver ||= Resolv::DNS.new
|
|
94
94
|
target_arr = dns_resolver.getaddresses(target).map(&:to_s).uniq
|
|
95
95
|
rescue Resolv::ResolvError
|
|
96
|
-
target_arr =
|
|
96
|
+
target_arr = []
|
|
97
97
|
end
|
|
98
98
|
end
|
|
99
99
|
|
|
@@ -109,7 +109,7 @@ module PWN
|
|
|
109
109
|
|
|
110
110
|
next unless proxy.nil?
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
ip_resp_hash.tap do |ip_resp|
|
|
113
113
|
tls_port_avail = PWN::Plugins::Sock.check_port_in_use(
|
|
114
114
|
server_ip: this_target,
|
|
115
115
|
port: tls_port
|
|
@@ -182,6 +182,7 @@ module PWN
|
|
|
182
182
|
results_file = opts[:results_file] ||= "/tmp/SUBS.#{parent_domain}-#{timestamp}-pwn_bruteforce_subdomains.txt"
|
|
183
183
|
|
|
184
184
|
File.write(results_file, "[\n")
|
|
185
|
+
results_started = true
|
|
185
186
|
|
|
186
187
|
# Break up dictonary file into sublines and process each subline in a thread
|
|
187
188
|
dict_lines = File.readlines(dictionary).shuffle
|
|
@@ -215,12 +216,14 @@ module PWN
|
|
|
215
216
|
rescue StandardError => e
|
|
216
217
|
raise e
|
|
217
218
|
ensure
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
219
|
+
if results_started
|
|
220
|
+
# Strip trailing comma and close JSON array
|
|
221
|
+
final_results = File.readlines(results_file).uniq
|
|
222
|
+
# Strip trailing newline and comma from last line
|
|
223
|
+
last_line = final_results[-1].chomp.chomp(',')
|
|
224
|
+
final_results[-1] = last_line
|
|
225
|
+
File.write(results_file, "#{final_results.join}\n]")
|
|
226
|
+
end
|
|
224
227
|
end
|
|
225
228
|
|
|
226
229
|
# Author(s):: 0day Inc. <support@0dayinc.com>
|
data/lib/pwn/plugins/irc.rb
CHANGED
|
@@ -15,27 +15,57 @@ module PWN
|
|
|
15
15
|
# )
|
|
16
16
|
private_class_method def self.irc_cmd(opts = {})
|
|
17
17
|
irc_obj = opts[:irc_obj]
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
readl_timeout = 0.001
|
|
22
|
-
irc_obj.puts(cmd)
|
|
18
|
+
frame = command_frame(cmd: opts[:cmd])
|
|
19
|
+
deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC) + opts.fetch(:max_timeout, 0.009)
|
|
20
|
+
irc_obj.write(frame)
|
|
23
21
|
response = []
|
|
22
|
+
loop do
|
|
23
|
+
line = read_frame(irc_obj: irc_obj, deadline: deadline)
|
|
24
|
+
break if line.nil? || line == :timeout
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
raise IOError if response.empty?
|
|
28
|
-
rescue IOError
|
|
29
|
-
readl_timeout += 0.001
|
|
30
|
-
retry if readl_timeout < max_timeout
|
|
31
|
-
return response if readl_timeout >= max_timeout
|
|
26
|
+
response << line.chomp
|
|
27
|
+
break if response.length >= 128
|
|
32
28
|
end
|
|
33
|
-
|
|
34
29
|
response
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
irc_obj
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private_class_method def self.read_frame(opts = {})
|
|
33
|
+
irc_obj = opts[:irc_obj]
|
|
34
|
+
buffer = irc_obj.instance_variable_get(:@pwn_irc_buffer)
|
|
35
|
+
unless buffer
|
|
36
|
+
buffer = ''.b
|
|
37
|
+
irc_obj.instance_variable_set(:@pwn_irc_buffer, buffer)
|
|
38
|
+
end
|
|
39
|
+
loop do
|
|
40
|
+
newline = buffer.index("\n")
|
|
41
|
+
return buffer.slice!(0, newline + 1) if newline && newline < 512
|
|
42
|
+
raise IOError, 'Oversized IRC response frame' if buffer.bytesize >= 512
|
|
43
|
+
|
|
44
|
+
remaining = opts[:deadline] - Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
45
|
+
return :timeout unless remaining.positive?
|
|
46
|
+
|
|
47
|
+
chunk = irc_obj.read_nonblock(512 - buffer.bytesize, exception: false)
|
|
48
|
+
case chunk
|
|
49
|
+
when :wait_readable then return :timeout unless irc_obj.wait_readable(remaining)
|
|
50
|
+
when :wait_writable then return :timeout unless irc_obj.wait_writable(remaining)
|
|
51
|
+
when nil then return nil
|
|
52
|
+
else buffer << chunk
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
private_class_method def self.command_frame(opts = {})
|
|
58
|
+
cmd = opts[:cmd].to_s.scrub
|
|
59
|
+
raise ArgumentError, 'Invalid IRC command frame' if cmd.match?(/[\r\n\x00]/) || cmd.bytesize > 510
|
|
60
|
+
|
|
61
|
+
"#{cmd}\r\n"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
private_class_method def self.parameter(opts = {})
|
|
65
|
+
value = opts[:value].to_s.scrub
|
|
66
|
+
raise ArgumentError, 'Invalid IRC parameter' if value.empty? || value.match?(/[\s\x00:]/)
|
|
67
|
+
|
|
68
|
+
value
|
|
39
69
|
end
|
|
40
70
|
|
|
41
71
|
# Supported Method Parameters::
|
|
@@ -50,10 +80,14 @@ module PWN
|
|
|
50
80
|
public_class_method def self.connect(opts = {})
|
|
51
81
|
host = opts[:host] ||= '127.0.0.1'
|
|
52
82
|
port = opts[:port] ||= 6667
|
|
53
|
-
nick = opts[:nick]
|
|
83
|
+
nick = parameter(value: opts[:nick])
|
|
54
84
|
real = opts[:real] ||= nick
|
|
55
85
|
tls = opts[:tls] || false
|
|
56
86
|
|
|
87
|
+
parameter(value: host)
|
|
88
|
+
command_frame(cmd: "NICK #{nick}")
|
|
89
|
+
command_frame(cmd: "USER #{nick} #{host} #{host} :#{real}")
|
|
90
|
+
|
|
57
91
|
irc_obj = PWN::Plugins::Sock.connect(
|
|
58
92
|
target: host,
|
|
59
93
|
port: port,
|
|
@@ -81,11 +115,12 @@ module PWN
|
|
|
81
115
|
# )
|
|
82
116
|
public_class_method def self.join(opts = {})
|
|
83
117
|
irc_obj = opts[:irc_obj]
|
|
84
|
-
nick = opts[:nick]
|
|
85
|
-
chan = opts[:chan]
|
|
118
|
+
nick = parameter(value: opts[:nick])
|
|
119
|
+
chan = parameter(value: opts[:chan])
|
|
120
|
+
command_frame(cmd: "PRIVMSG #{chan} :#{nick} joined.")
|
|
86
121
|
|
|
87
122
|
irc_cmd(irc_obj: irc_obj, cmd: "JOIN #{chan}")
|
|
88
|
-
privmsg(irc_obj: irc_obj, message: "#{nick} joined.")
|
|
123
|
+
privmsg(irc_obj: irc_obj, chan: chan, message: "#{nick} joined.")
|
|
89
124
|
rescue StandardError => e
|
|
90
125
|
raise e
|
|
91
126
|
end
|
|
@@ -97,15 +132,16 @@ module PWN
|
|
|
97
132
|
# )
|
|
98
133
|
public_class_method def self.names(opts = {})
|
|
99
134
|
irc_obj = opts[:irc_obj]
|
|
100
|
-
chan = opts[:chan]
|
|
135
|
+
chan = parameter(value: opts[:chan])
|
|
101
136
|
|
|
102
137
|
resp = irc_cmd(irc_obj: irc_obj, cmd: "NAMES #{chan}", max_timeout: 0.01)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
138
|
+
resp.flat_map do |line|
|
|
139
|
+
fields, trailing = line.split(' :', 2)
|
|
140
|
+
header = fields.split
|
|
141
|
+
next [] unless header[1] == '353' && header[4] == chan && trailing
|
|
107
142
|
|
|
108
|
-
|
|
143
|
+
trailing.split.map { |name| name.sub(/\A[~&@%+]+/, '') }
|
|
144
|
+
end.uniq
|
|
109
145
|
rescue StandardError => e
|
|
110
146
|
raise e
|
|
111
147
|
end
|
|
@@ -119,24 +155,14 @@ module PWN
|
|
|
119
155
|
# )
|
|
120
156
|
public_class_method def self.privmsg(opts = {})
|
|
121
157
|
irc_obj = opts[:irc_obj]
|
|
122
|
-
chan = opts[:chan]
|
|
158
|
+
chan = parameter(value: opts[:chan])
|
|
123
159
|
message = opts[:message].to_s.scrub
|
|
124
160
|
nick = opts[:nick].to_s.scrub
|
|
125
161
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if message_chunk.length.positive?
|
|
131
|
-
irc_cmd(
|
|
132
|
-
irc_obj: irc_obj,
|
|
133
|
-
cmd: this_message
|
|
134
|
-
)
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
else
|
|
138
|
-
irc_cmd(irc_obj: irc_obj, cmd: "PRIVMSG #{chan} :#{message}")
|
|
139
|
-
end
|
|
162
|
+
commands = message.split("\n").reject(&:empty?).map { |chunk| "PRIVMSG #{chan} :#{chunk}" }
|
|
163
|
+
commands.each { |cmd| command_frame(cmd: cmd) }
|
|
164
|
+
# Prevalidate the whole batch before the first frame leaves the socket.
|
|
165
|
+
commands.each { |cmd| irc_cmd(irc_obj: irc_obj, cmd: cmd) } # rubocop:disable Style/CombinableLoops
|
|
140
166
|
rescue StandardError => e
|
|
141
167
|
raise e
|
|
142
168
|
end
|
|
@@ -177,7 +203,7 @@ module PWN
|
|
|
177
203
|
# )
|
|
178
204
|
public_class_method def self.part(opts = {})
|
|
179
205
|
irc_obj = opts[:irc_obj]
|
|
180
|
-
chan = opts[:chan]
|
|
206
|
+
chan = parameter(value: opts[:chan])
|
|
181
207
|
message = opts[:message].to_s.scrub
|
|
182
208
|
|
|
183
209
|
irc_cmd(irc_obj: irc_obj, cmd: "PART #{chan} :#{message}")
|
|
@@ -212,9 +238,11 @@ module PWN
|
|
|
212
238
|
verbose = opts[:verbose] ||= false
|
|
213
239
|
|
|
214
240
|
loop do
|
|
215
|
-
message = irc_obj.
|
|
241
|
+
message = read_frame(irc_obj: irc_obj, deadline: Process.clock_gettime(Process::CLOCK_MONOTONIC) + 0.1)
|
|
242
|
+
break if message.nil?
|
|
243
|
+
next if message == :timeout
|
|
244
|
+
|
|
216
245
|
@@logger.info(message.to_s.chomp) if verbose
|
|
217
|
-
irc_obj.flush
|
|
218
246
|
next unless block_given?
|
|
219
247
|
|
|
220
248
|
yield message
|
data/lib/pwn/plugins/jenkins.rb
CHANGED
|
@@ -23,12 +23,12 @@ module PWN
|
|
|
23
23
|
|
|
24
24
|
public_class_method def self.connect(opts = {})
|
|
25
25
|
ip = opts[:ip]
|
|
26
|
-
port = opts[:port].to_i
|
|
26
|
+
port = (opts[:port] || 8080).to_i
|
|
27
27
|
username = opts[:username].to_s.scrub
|
|
28
28
|
base_jenkins_api_uri = "https://#{ip}/ase/services".to_s.scrub
|
|
29
29
|
api_key = opts[:api_key].to_s.scrub
|
|
30
30
|
identity_file = opts[:identity_file].to_s.scrub
|
|
31
|
-
ssl_bool =
|
|
31
|
+
ssl_bool = opts.fetch(:ssl, true)
|
|
32
32
|
|
|
33
33
|
if opts[:proxy]
|
|
34
34
|
proxy = URI(opts[:proxy])
|
|
@@ -85,7 +85,9 @@ module PWN
|
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
case response.code
|
|
88
|
-
when 201
|
|
88
|
+
when 201
|
|
89
|
+
response = JSON.parse(response, symbolize_names: true).merge(http_response_code: response.code)
|
|
90
|
+
when 204
|
|
89
91
|
response = { http_response_code: response.code }
|
|
90
92
|
else
|
|
91
93
|
response = JSON.parse(response, symbolize_names: true) if response.is_a?(RestClient::Response)
|
|
@@ -219,8 +221,8 @@ module PWN
|
|
|
219
221
|
raise 'ERROR: epic_name cannot be nil when issue_type is :epic.' if issue_type == :epic && epic_name.nil?
|
|
220
222
|
|
|
221
223
|
# Attempt create, dynamically omit unlicensed fields on failure
|
|
222
|
-
create_attempts
|
|
223
|
-
max_create_attempts
|
|
224
|
+
create_attempts = get_issue_attempts = 1
|
|
225
|
+
max_create_attempts = max_get_issue_attempts = 7
|
|
224
226
|
created_issue = nil
|
|
225
227
|
begin
|
|
226
228
|
http_body = {
|
|
@@ -281,9 +283,13 @@ module PWN
|
|
|
281
283
|
retry
|
|
282
284
|
end
|
|
283
285
|
rescue RestClient::ExceptionWithResponse => e
|
|
284
|
-
raise e if create_attempts >= max_create_attempts || e.response
|
|
286
|
+
raise e if create_attempts >= max_create_attempts || e.response&.body.to_s.empty?
|
|
285
287
|
|
|
286
|
-
|
|
288
|
+
begin
|
|
289
|
+
json = JSON.parse(e.response.body, symbolize_names: true)
|
|
290
|
+
rescue JSON::ParserError
|
|
291
|
+
raise e
|
|
292
|
+
end
|
|
287
293
|
errors_hash = json[:errors] if json.is_a?(Hash)
|
|
288
294
|
if errors_hash.is_a?(Hash)
|
|
289
295
|
unlicensed_field_keys = errors_hash.select { |_fk, msg| msg.to_s =~ /unlicensed/i }.keys
|
|
@@ -297,6 +303,7 @@ module PWN
|
|
|
297
303
|
retry
|
|
298
304
|
end
|
|
299
305
|
end
|
|
306
|
+
raise e
|
|
300
307
|
end
|
|
301
308
|
|
|
302
309
|
created_issue
|
|
@@ -369,7 +376,7 @@ module PWN
|
|
|
369
376
|
raise 'ERROR: comment_action must be one of :delete, :add, or :update.' unless %i[delete add update].include?(comment_action)
|
|
370
377
|
|
|
371
378
|
comment_id = opts[:comment_id]
|
|
372
|
-
raise 'ERROR: comment_id cannot be nil when comment_action is :delete or :update.'
|
|
379
|
+
raise 'ERROR: comment_id cannot be nil when comment_action is :delete or :update.' if %i[delete update].include?(comment_action) && comment_id.nil?
|
|
373
380
|
|
|
374
381
|
author = opts[:author]
|
|
375
382
|
comment = opts[:comment].to_s.scrub
|
data/lib/pwn/plugins/jobs.rb
CHANGED
|
@@ -181,6 +181,9 @@ module PWN
|
|
|
181
181
|
jobs = Array(opts[:jobs])
|
|
182
182
|
raise ArgumentError, 'jobs must be an Array of hashes with id and command' unless jobs.all?(Hash)
|
|
183
183
|
|
|
184
|
+
ids = jobs.map { |job| (job[:id] || job['id']).to_s }
|
|
185
|
+
return { jobs: {}, artifact_dir: opts[:artifact_dir], ok: false } if ids.any?(&:empty?) || ids.uniq.length != ids.length
|
|
186
|
+
|
|
184
187
|
dir = opts[:artifact_dir] || File.join(JOBS_DIR, "graph-#{SecureRandom.hex(4)}")
|
|
185
188
|
FileUtils.mkdir_p(dir)
|
|
186
189
|
remaining = jobs.map { |job| job.transform_keys(&:to_sym) }
|
|
@@ -199,6 +202,8 @@ module PWN
|
|
|
199
202
|
ready = remaining.select { |job| Array(job[:needs]).all? { |need| done[need.to_s] && done[need.to_s][:ok] } }
|
|
200
203
|
raise ArgumentError, 'job graph deadlock or missing needs' if ready.empty? && remaining.any?
|
|
201
204
|
|
|
205
|
+
groups = []
|
|
206
|
+
started = Queue.new
|
|
202
207
|
threads = ready.map do |job|
|
|
203
208
|
remaining.delete(job)
|
|
204
209
|
Thread.new do
|
|
@@ -206,24 +211,77 @@ module PWN
|
|
|
206
211
|
timeout = 3_600 if timeout <= 0
|
|
207
212
|
out = err = ''
|
|
208
213
|
st = nil
|
|
214
|
+
signaled = false
|
|
215
|
+
notify = lambda do
|
|
216
|
+
next if signaled
|
|
217
|
+
|
|
218
|
+
signaled = true
|
|
219
|
+
started << true
|
|
220
|
+
end
|
|
209
221
|
begin
|
|
210
222
|
Timeout.timeout(timeout) do
|
|
211
|
-
out, err, st =
|
|
223
|
+
out, err, st = capture_graph(command: job[:command].to_s, dir: dir, groups: groups, started: notify)
|
|
212
224
|
end
|
|
213
225
|
{ id: job[:id], ok: st.success?, stdout: out, stderr: err, exit: st.exitstatus }
|
|
214
226
|
rescue Timeout::Error
|
|
215
227
|
{ id: job[:id], ok: false, stdout: out, stderr: 'timeout', exit: 124, timeout: true }
|
|
228
|
+
ensure
|
|
229
|
+
notify.call
|
|
216
230
|
end
|
|
217
231
|
end
|
|
218
232
|
end
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
233
|
+
begin
|
|
234
|
+
threads.each { started.pop }
|
|
235
|
+
threads.each do |thr| # rubocop:disable Style/CombinableLoops -- spawn signals must all arrive before any value wait
|
|
236
|
+
row = thr.value
|
|
237
|
+
done[row[:id].to_s] = row
|
|
238
|
+
end
|
|
239
|
+
rescue StandardError
|
|
240
|
+
cancel_graph(groups: groups)
|
|
241
|
+
threads.each do |thr|
|
|
242
|
+
thr.join(2)
|
|
243
|
+
rescue StandardError
|
|
244
|
+
nil
|
|
245
|
+
end
|
|
246
|
+
raise
|
|
222
247
|
end
|
|
223
248
|
end
|
|
224
249
|
{ jobs: done, artifact_dir: dir, ok: done.values.none? { |row| row[:ok] == false && row[:skipped] != true } && done.values.any? { |row| row[:ok] } }
|
|
225
250
|
end
|
|
226
251
|
|
|
252
|
+
private_class_method def self.capture_graph(opts = {})
|
|
253
|
+
Open3.popen3(opts[:command], chdir: opts[:dir], pgroup: true) do |stdin, stdout, stderr, waiter|
|
|
254
|
+
stdin.close
|
|
255
|
+
Array(opts[:groups]) << waiter.pid
|
|
256
|
+
opts[:started]&.call
|
|
257
|
+
readers = [Thread.new { stdout.read }, Thread.new { stderr.read }]
|
|
258
|
+
begin
|
|
259
|
+
[readers[0].value, readers[1].value, waiter.value]
|
|
260
|
+
ensure
|
|
261
|
+
if waiter.alive? || readers.any?(&:alive?)
|
|
262
|
+
begin
|
|
263
|
+
Process.kill('KILL', -waiter.pid)
|
|
264
|
+
rescue Errno::ESRCH, Errno::EPERM
|
|
265
|
+
nil
|
|
266
|
+
end
|
|
267
|
+
end
|
|
268
|
+
readers.each do |thread|
|
|
269
|
+
thread.kill if thread.alive?
|
|
270
|
+
thread.join
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
private_class_method def self.cancel_graph(opts = {})
|
|
277
|
+
Array(opts[:groups]).uniq.each do |pid|
|
|
278
|
+
Process.kill('KILL', -pid)
|
|
279
|
+
rescue Errno::ESRCH, Errno::EPERM
|
|
280
|
+
nil
|
|
281
|
+
end
|
|
282
|
+
:cancelled
|
|
283
|
+
end
|
|
284
|
+
|
|
227
285
|
public_class_method def self.authors
|
|
228
286
|
"AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n"
|
|
229
287
|
end
|
data/lib/pwn/plugins/log.rb
CHANGED
|
@@ -118,7 +118,7 @@ module PWN
|
|
|
118
118
|
else
|
|
119
119
|
log_event += " => #{PWN::Redaction.redact(value: msg)}"
|
|
120
120
|
if msg.respond_to?('backtrace') && !msg.instance_of?(Errno::ECONNRESET)
|
|
121
|
-
log_event += " => \n\t#{msg.backtrace.join("\n\t")}"
|
|
121
|
+
log_event += " => \n\t#{Array(msg.backtrace).join("\n\t")}"
|
|
122
122
|
log_event += "\n\n\n"
|
|
123
123
|
end
|
|
124
124
|
end
|
|
@@ -33,7 +33,7 @@ module PWN
|
|
|
33
33
|
|
|
34
34
|
require 'method_source'
|
|
35
35
|
MethodSource::CodeHelpers.module_eval do
|
|
36
|
-
alias_method :original_complete_expression?, :complete_expression?
|
|
36
|
+
alias_method :original_complete_expression?, :complete_expression? unless method_defined?(:original_complete_expression?)
|
|
37
37
|
|
|
38
38
|
def complete_expression?(expression)
|
|
39
39
|
original_complete_expression?(expression)
|