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
|
@@ -51,22 +51,32 @@ module PWN
|
|
|
51
51
|
|
|
52
52
|
public_class_method def self.register(opts = {})
|
|
53
53
|
sid = (opts[:session_id] || 'default').to_s
|
|
54
|
+
raise ArgumentError, 'invalid session_id' unless sid.match?(/\A[A-Za-z0-9_-][A-Za-z0-9_.-]{0,127}\z/)
|
|
55
|
+
|
|
54
56
|
src = opts[:path].to_s
|
|
55
57
|
raise 'ERROR: path is required' if src.empty?
|
|
56
58
|
raise "ERROR: file not found: #{src}" unless File.file?(src)
|
|
57
59
|
|
|
58
60
|
dir = File.join(ROOT, sid)
|
|
59
|
-
FileUtils.mkdir_p(dir)
|
|
60
61
|
dest = File.join(dir, File.basename(src))
|
|
61
|
-
FileUtils.cp(src, dest)
|
|
62
62
|
meta = File.join(dir, 'index.jsonl')
|
|
63
|
+
[ROOT, dir, dest, meta].each do |path|
|
|
64
|
+
raise ArgumentError, 'artifact path is a symlink' if File.symlink?(path)
|
|
65
|
+
end
|
|
66
|
+
FileUtils.mkdir_p(dir)
|
|
67
|
+
FileUtils.cp(src, dest)
|
|
63
68
|
File.open(meta, 'a') { |f| f.puts(JSON.generate(path: dest, kind: opts[:kind], src: src, at: Time.now.utc.iso8601)) }
|
|
64
69
|
dest
|
|
65
70
|
end
|
|
66
71
|
|
|
67
72
|
public_class_method def self.list(opts = {})
|
|
68
73
|
sid = (opts[:session_id] || 'default').to_s
|
|
74
|
+
raise ArgumentError, 'invalid session_id' unless sid.match?(/\A[A-Za-z0-9_-][A-Za-z0-9_.-]{0,127}\z/)
|
|
75
|
+
|
|
69
76
|
meta = File.join(ROOT, sid, 'index.jsonl')
|
|
77
|
+
[ROOT, File.join(ROOT, sid), meta].each do |path|
|
|
78
|
+
raise ArgumentError, 'artifact path is a symlink' if File.symlink?(path)
|
|
79
|
+
end
|
|
70
80
|
return [] unless File.file?(meta)
|
|
71
81
|
|
|
72
82
|
File.readlines(meta).filter_map do |ln|
|
data/lib/pwn/plugins/assembly.rb
CHANGED
|
@@ -11,7 +11,7 @@ module PWN
|
|
|
11
11
|
# Supported Method Parameters::
|
|
12
12
|
# PWN::Plugins::Assembly.opcodes_to_asm(
|
|
13
13
|
# opcodes: 'required - hex escaped opcode(s) (e.g. "\x90\x90\x90")',
|
|
14
|
-
# opcodes_always_string_obj: 'optional -
|
|
14
|
+
# opcodes_always_string_obj: 'optional - interpret binary-tagged input as textual hex (default false; binary Strings are raw bytes)',
|
|
15
15
|
# arch: 'optional - architecture returned from objdump --info (defaults to PWN::Plugins::DetectOS.arch)',
|
|
16
16
|
# endian: 'optional - endianess :big|:little (defaults to current system endianess)'
|
|
17
17
|
# )
|
|
@@ -75,46 +75,13 @@ module PWN
|
|
|
75
75
|
raise "Unsupported architecture: #{arch}"
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
# puts opcodes.inspect
|
|
86
|
-
# known to work (when method is called directly) with:
|
|
87
|
-
# 'ffe4'
|
|
88
|
-
# 'ff,e4'
|
|
89
|
-
# 'ff e4'
|
|
90
|
-
# "ff,e4"
|
|
91
|
-
# "ff e4"
|
|
92
|
-
# ['ff', 'e4']
|
|
93
|
-
# ["ff", "e4"]
|
|
94
|
-
# '\xff\xe4'
|
|
95
|
-
# "\xff\xe4"
|
|
96
|
-
# "'ff', 'e4'"
|
|
97
|
-
# '"ff", "e4"'
|
|
98
|
-
# only known to work in pwn REPL driver with:
|
|
99
|
-
# ffe4
|
|
100
|
-
# ff e4
|
|
101
|
-
# puts opcodes.inspect
|
|
102
|
-
# More stripping if passed in via pwn REPL driver
|
|
103
|
-
# if opcodes_always_string_obj
|
|
104
|
-
# end
|
|
105
|
-
|
|
106
|
-
opcodes.delete!('%5B')
|
|
107
|
-
opcodes.delete!('%5D')
|
|
108
|
-
opcodes.delete!('%5Cx')
|
|
109
|
-
opcodes.delete!('%2C')
|
|
110
|
-
opcodes.delete!('%22')
|
|
111
|
-
opcodes.delete!('%27')
|
|
112
|
-
opcodes.delete!('+')
|
|
113
|
-
opcodes.delete!('%')
|
|
114
|
-
|
|
115
|
-
# puts opcodes.inspect
|
|
116
|
-
opcodes = [opcodes].pack('H*')
|
|
117
|
-
# puts opcodes.inspect
|
|
78
|
+
raw = opcodes.is_a?(String) && opcodes.encoding == Encoding::BINARY && !opcodes_always_string_obj
|
|
79
|
+
unless raw
|
|
80
|
+
opcodes = opcodes.join(',') if opcodes.is_a?(Array)
|
|
81
|
+
# Remove whole textual separators, never individual hexadecimal digits.
|
|
82
|
+
hex = opcodes.b.gsub(/\\x/i, '').gsub(/[\s,\[\]'" ]/, '')
|
|
83
|
+
opcodes = [hex].pack('H*') if hex.match?(/\A(?:[0-9a-fA-F]{2})+\z/)
|
|
84
|
+
end
|
|
118
85
|
|
|
119
86
|
"#{ai_analysis}\n\n* Assembly Instructions >>>#{Metasm::Shellcode.disassemble(arch_obj, opcodes).to_s.squeeze("\n")}\n"
|
|
120
87
|
rescue StandardError => e
|
|
@@ -314,7 +281,7 @@ module PWN
|
|
|
314
281
|
# Run opcodes to asm and return its result
|
|
315
282
|
#{self}.opcodes_to_asm(
|
|
316
283
|
opcodes: 'required - hex escaped opcode(s) (e.g. \\x90\\x90\\x90)',
|
|
317
|
-
opcodes_always_string_obj: 'optional -
|
|
284
|
+
opcodes_always_string_obj: 'optional - interpret binary-tagged input as textual hex (default false; binary Strings are raw bytes)',
|
|
318
285
|
arch: 'optional - architecture returned from objdump --info (defaults to PWN::Plugins::DetectOS.arch)',
|
|
319
286
|
endian: 'optional - endianess :big|:little (defaults to current system endianess)'
|
|
320
287
|
)
|
|
@@ -18,7 +18,7 @@ module PWN
|
|
|
18
18
|
# prompt: 'optional - string to display at prompt (Default: Username)'
|
|
19
19
|
# )
|
|
20
20
|
|
|
21
|
-
public_class_method def self.username
|
|
21
|
+
public_class_method def self.username(opts = {})
|
|
22
22
|
prompt = opts[:prompt] ||= 'Username'
|
|
23
23
|
user = TTY::Prompt.new.ask("#{prompt}: ")
|
|
24
24
|
user.to_s.strip.chomp.scrub
|
|
@@ -125,8 +125,9 @@ module PWN
|
|
|
125
125
|
public_class_method def self.help
|
|
126
126
|
puts "USAGE:
|
|
127
127
|
# Run username and return its result
|
|
128
|
-
#{self}.username
|
|
129
|
-
|
|
128
|
+
#{self}.username(
|
|
129
|
+
prompt: 'optional - string to display at prompt (Default: Username)'
|
|
130
|
+
)
|
|
130
131
|
# Run mask password and return its result
|
|
131
132
|
#{self}.mask_password(
|
|
132
133
|
prompt: 'optional - string to display at prompt (Default: Password)'
|
data/lib/pwn/plugins/baresip.rb
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'English'
|
|
4
|
+
|
|
3
5
|
require 'fileutils'
|
|
4
6
|
require 'htmlentities'
|
|
5
7
|
require 'nokogiri'
|
|
8
|
+
require 'timeout'
|
|
9
|
+
require 'tmpdir'
|
|
6
10
|
|
|
7
11
|
module PWN
|
|
8
12
|
module Plugins
|
|
@@ -66,13 +70,16 @@ module PWN
|
|
|
66
70
|
|
|
67
71
|
public_class_method def self.start(opts = {})
|
|
68
72
|
src_num = opts[:src_num]
|
|
73
|
+
timeout = opts.fetch(:timeout, 30)
|
|
74
|
+
raise ArgumentError, 'timeout must be finite positive seconds' unless timeout.is_a?(Numeric) && timeout.real? && timeout.finite? && timeout.positive?
|
|
69
75
|
|
|
70
76
|
baresip_bin = opts[:baresip_bin] if File.exist?(
|
|
71
77
|
opts[:baresip_bin].to_s
|
|
72
78
|
)
|
|
73
79
|
baresip_bin ||= '/usr/bin/baresip'
|
|
74
80
|
|
|
75
|
-
session_root = opts[:session_root]
|
|
81
|
+
session_root = opts[:session_root] || Dir.pwd
|
|
82
|
+
raise ArgumentError, 'session_root must be an existing directory' unless Dir.exist?(session_root)
|
|
76
83
|
|
|
77
84
|
config_root = opts[:config_root] if Dir.exist?(
|
|
78
85
|
opts[:config_root].to_s
|
|
@@ -123,9 +130,14 @@ module PWN
|
|
|
123
130
|
baresip_obj[:session_root] = session_root
|
|
124
131
|
baresip_obj[:screen_session] = screen_session
|
|
125
132
|
|
|
133
|
+
# Pin this log generation before launch; old registrations are not evidence.
|
|
134
|
+
registration_log = File.open(screenlog_path, File::RDWR | File::CREAT, 0o600) # rubocop:disable Style/FileOpen -- closed in acquisition ensure
|
|
135
|
+
registration_log.seek(0, IO::SEEK_END)
|
|
136
|
+
registration_text = ''.b
|
|
137
|
+
|
|
126
138
|
# Prefer running baresip in detached screen vs --daemon mode
|
|
127
139
|
# Since sndfile doesn't produce .wav files in --daemon mode
|
|
128
|
-
system(
|
|
140
|
+
launched = system(
|
|
129
141
|
'screen',
|
|
130
142
|
'-T',
|
|
131
143
|
'xterm',
|
|
@@ -145,34 +157,52 @@ module PWN
|
|
|
145
157
|
'/insmod sndfile',
|
|
146
158
|
'-v'
|
|
147
159
|
)
|
|
160
|
+
raise 'Failed to launch baresip screen session' unless launched
|
|
148
161
|
|
|
149
162
|
ok = 'registered successfully'
|
|
150
163
|
gone = 'account: No SIP accounts found'
|
|
151
164
|
forb = '403 Forbidden'
|
|
152
165
|
|
|
153
|
-
|
|
166
|
+
deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC) + timeout
|
|
154
167
|
print 'Starting baresip...'
|
|
155
168
|
loop do
|
|
156
|
-
|
|
169
|
+
raise Timeout::Error, 'Baresip registration timed out' if Process.clock_gettime(Process::CLOCK_MONOTONIC) >= deadline
|
|
157
170
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
171
|
+
current_log = File.stat(screenlog_path)
|
|
172
|
+
raise IOError, 'Baresip registration log changed generation' unless current_log.ino == registration_log.stat.ino && current_log.dev == registration_log.stat.dev && current_log.size >= registration_log.pos
|
|
173
|
+
|
|
174
|
+
registration_text << registration_log.read(16_384).to_s
|
|
175
|
+
error = [gone, forb].find { |message| registration_text.include?(message) }
|
|
176
|
+
raise "Baresip registration failed: #{error}" if error
|
|
177
|
+
break if registration_text.include?(ok)
|
|
163
178
|
|
|
164
|
-
|
|
165
|
-
next unless dump_session_data.select { |s| s.include?(forb) }.length.positive?
|
|
179
|
+
registration_text = registration_text.byteslice(-256, 256) || registration_text
|
|
166
180
|
|
|
167
|
-
|
|
168
|
-
error = forbid if dump_session_data.select { |s| s.include?(forb) }.length.positive?
|
|
169
|
-
raise "Something happened when attempting to start baresip: #{error}"
|
|
181
|
+
sleep 0.05
|
|
170
182
|
end
|
|
171
183
|
puts 'ready.'
|
|
172
184
|
|
|
185
|
+
registration_log.close
|
|
186
|
+
ready = true
|
|
173
187
|
baresip_obj
|
|
174
188
|
rescue StandardError => e
|
|
175
189
|
raise e
|
|
190
|
+
ensure
|
|
191
|
+
primary_error = $ERROR_INFO
|
|
192
|
+
begin
|
|
193
|
+
registration_log.close if registration_log && !registration_log.closed?
|
|
194
|
+
rescue StandardError, Interrupt
|
|
195
|
+
raise unless primary_error
|
|
196
|
+
ensure
|
|
197
|
+
if launched && !ready
|
|
198
|
+
begin
|
|
199
|
+
system('screen', '-S', screen_session, '-X', 'quit')
|
|
200
|
+
rescue StandardError, Interrupt
|
|
201
|
+
# Keep the registration/cancellation failure authoritative.
|
|
202
|
+
nil
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
end
|
|
176
206
|
end
|
|
177
207
|
|
|
178
208
|
# Supported Method Parameters::
|
|
@@ -390,8 +420,8 @@ module PWN
|
|
|
390
420
|
|
|
391
421
|
waveform_bin = 'waveform'
|
|
392
422
|
|
|
393
|
-
#
|
|
394
|
-
baresip_obj =
|
|
423
|
+
# Only stop a session after start has handed it off successfully.
|
|
424
|
+
baresip_obj = nil
|
|
395
425
|
|
|
396
426
|
# Colors!
|
|
397
427
|
red = "\e[31m"
|
|
@@ -400,8 +430,8 @@ module PWN
|
|
|
400
430
|
cayan = "\e[36m"
|
|
401
431
|
end_of_color = "\e[0m"
|
|
402
432
|
|
|
403
|
-
config_root_for_target_num =
|
|
404
|
-
FileUtils.cp_r(config_root, config_root_for_target_num)
|
|
433
|
+
config_root_for_target_num = Dir.mktmpdir('pwn-baresip-')
|
|
434
|
+
FileUtils.cp_r(File.join(config_root, '.'), config_root_for_target_num)
|
|
405
435
|
src_num = apply_src_num_rules(
|
|
406
436
|
config_root: config_root_for_target_num,
|
|
407
437
|
target_num: target_num,
|
|
@@ -585,19 +615,30 @@ module PWN
|
|
|
585
615
|
puts end_of_color
|
|
586
616
|
end
|
|
587
617
|
|
|
618
|
+
completed = true
|
|
588
619
|
call_resp_hash
|
|
589
620
|
rescue StandardError => e
|
|
590
621
|
raise e
|
|
591
622
|
ensure
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
623
|
+
primary_error = completed ? nil : $ERROR_INFO
|
|
624
|
+
cleanup_error = nil
|
|
625
|
+
begin
|
|
626
|
+
if call_resp_hash
|
|
627
|
+
call_resp_hash[:call_stopped] = Time.now.strftime('%Y-%m-%d_%H.%M.%S')
|
|
628
|
+
call_resp_hash[:reason] = reason
|
|
629
|
+
end
|
|
630
|
+
stop(baresip_obj: baresip_obj) if baresip_obj
|
|
631
|
+
rescue StandardError, Interrupt => e
|
|
632
|
+
cleanup_error = e
|
|
633
|
+
raise e unless primary_error
|
|
634
|
+
ensure
|
|
635
|
+
primary_error ||= cleanup_error
|
|
636
|
+
begin
|
|
637
|
+
FileUtils.remove_entry(config_root_for_target_num) if config_root_for_target_num && Dir.exist?(config_root_for_target_num)
|
|
638
|
+
rescue StandardError, Interrupt
|
|
639
|
+
raise unless primary_error
|
|
640
|
+
end
|
|
641
|
+
end
|
|
601
642
|
end
|
|
602
643
|
|
|
603
644
|
# Supported Method Parameters::
|
|
@@ -689,7 +730,8 @@ module PWN
|
|
|
689
730
|
config_root: 'optional - Optional dir of baresip config (Defaults to ~/.baresip)',
|
|
690
731
|
session_root: 'optional - Optional dir of baresip session (Defaults to Dir.pwd)',
|
|
691
732
|
screenlog_path: 'optional - Optional path of screenlog file (Defaults to screenlog.txt)',
|
|
692
|
-
screen_session: 'optional - Optional name of screen session (Defaults baresip)'
|
|
733
|
+
screen_session: 'optional - Optional name of screen session (Defaults baresip)',
|
|
734
|
+
timeout: 'optional - finite positive registration timeout in seconds, defaults to 30'
|
|
693
735
|
)
|
|
694
736
|
|
|
695
737
|
# Run baresip exec and return its result
|
|
@@ -18,8 +18,9 @@ module PWN
|
|
|
18
18
|
timeout = opts.fetch(:timeout, 60)
|
|
19
19
|
limit = opts.fetch(:limit, 2_000_000)
|
|
20
20
|
output = +''
|
|
21
|
-
Open3.popen2e(*argv, pgroup: true) do |stdin, stream, waiter|
|
|
21
|
+
Open3.popen2e([argv.first, argv.first], *argv.drop(1), pgroup: true) do |stdin, stream, waiter|
|
|
22
22
|
stdin.close
|
|
23
|
+
completed = false
|
|
23
24
|
begin
|
|
24
25
|
Timeout.timeout(timeout) do
|
|
25
26
|
loop do
|
|
@@ -28,13 +29,21 @@ module PWN
|
|
|
28
29
|
rescue EOFError
|
|
29
30
|
break
|
|
30
31
|
end
|
|
31
|
-
|
|
32
|
+
status = waiter.value
|
|
33
|
+
completed = status.success?
|
|
34
|
+
raise "backend exited #{status.exitstatus}: #{output[-1000, 1000] || output}" unless completed
|
|
32
35
|
end
|
|
33
36
|
ensure
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
# The leader can exit while a same-group child still holds the pipe.
|
|
38
|
+
# Signal the group on timeout, limit, or error. Do not reap descendants.
|
|
39
|
+
unless completed
|
|
40
|
+
begin
|
|
41
|
+
Process.kill('KILL', -waiter.pid)
|
|
42
|
+
rescue Errno::ESRCH, Errno::EPERM
|
|
43
|
+
nil
|
|
44
|
+
end
|
|
37
45
|
end
|
|
46
|
+
waiter.join if waiter.alive?
|
|
38
47
|
end
|
|
39
48
|
end
|
|
40
49
|
output.encode('UTF-8', invalid: :replace, undef: :replace)
|
|
@@ -152,24 +152,34 @@ module PWN
|
|
|
152
152
|
)
|
|
153
153
|
|
|
154
154
|
# Run info and return its result
|
|
155
|
-
#{self}.info
|
|
155
|
+
#{self}.info(
|
|
156
|
+
path: 'required - filesystem path of the binary to inspect'
|
|
157
|
+
)
|
|
156
158
|
|
|
157
159
|
# Run sections and return its result
|
|
158
|
-
#{self}.sections
|
|
160
|
+
#{self}.sections(
|
|
161
|
+
path: 'required - filesystem path of the binary to inspect'
|
|
162
|
+
)
|
|
159
163
|
|
|
160
164
|
# Run symbols and return its result
|
|
161
165
|
#{self}.symbols(
|
|
166
|
+
path: 'required - filesystem path of the binary to inspect',
|
|
162
167
|
limit: 'optional - limit value consumed by #symbols'
|
|
163
168
|
)
|
|
164
169
|
|
|
165
170
|
# Run imports and return its result
|
|
166
|
-
#{self}.imports
|
|
171
|
+
#{self}.imports(
|
|
172
|
+
path: 'required - filesystem path of the binary to inspect'
|
|
173
|
+
)
|
|
167
174
|
|
|
168
175
|
# Run exports and return its result
|
|
169
|
-
#{self}.exports
|
|
176
|
+
#{self}.exports(
|
|
177
|
+
path: 'required - filesystem path of the binary to inspect'
|
|
178
|
+
)
|
|
170
179
|
|
|
171
180
|
# Run relocations and return its result
|
|
172
181
|
#{self}.relocations(
|
|
182
|
+
path: 'required - filesystem path of the binary to inspect',
|
|
173
183
|
limit: 'optional - limit value consumed by #relocations'
|
|
174
184
|
)
|
|
175
185
|
|
|
@@ -539,6 +549,8 @@ module PWN
|
|
|
539
549
|
loads << { off: file_off, vaddr: vaddr, filesz: filesz, memsz: memsz }
|
|
540
550
|
end
|
|
541
551
|
v2off = lambda do |addr|
|
|
552
|
+
return nil if addr.nil?
|
|
553
|
+
|
|
542
554
|
seg = loads.find { |row| addr >= row[:vaddr] && addr < row[:vaddr] + [row[:memsz], row[:filesz]].max }
|
|
543
555
|
return nil unless seg
|
|
544
556
|
|
|
@@ -569,7 +581,6 @@ module PWN
|
|
|
569
581
|
symbols[name] ||= value
|
|
570
582
|
end
|
|
571
583
|
end
|
|
572
|
-
parse_symtab.call(v2off.call(dyn[6]), dyn[10] || 0x10000, strtab_off) if dyn[6] && strtab_off
|
|
573
584
|
if (sym = sections['.symtab']) && (str = sections['.strtab'])
|
|
574
585
|
parse_symtab.call(sym[:off], sym[:size], str[:off])
|
|
575
586
|
end
|
|
@@ -577,10 +588,32 @@ module PWN
|
|
|
577
588
|
plt = {}
|
|
578
589
|
jmprel = dyn[23]
|
|
579
590
|
pltrelsz = dyn[2].to_i
|
|
580
|
-
|
|
591
|
+
rel = dyn[20] == 17
|
|
592
|
+
relaent = if bits == 64
|
|
593
|
+
rel ? 16 : 24
|
|
594
|
+
else
|
|
595
|
+
rel ? 8 : 12
|
|
596
|
+
end
|
|
581
597
|
plt_base = sections['.plt.sec']&.[](:addr) || sections['.plt']&.[](:addr)
|
|
582
598
|
# .plt.sec slots start at the section base. Classic .plt reserves the first 16 bytes for the lazy resolver.
|
|
583
599
|
plt_bias = sections['.plt.sec'] ? 0 : 1
|
|
600
|
+
dyn_bytes = sections['.dynsym']&.[](:size).to_i
|
|
601
|
+
if dyn_bytes <= 0 && dyn[4]
|
|
602
|
+
hash_off = v2off.call(dyn[4])
|
|
603
|
+
nchain = hash_off ? u32.call(hash_off + 4).to_i : 0
|
|
604
|
+
dyn_bytes = nchain * syment if nchain.positive?
|
|
605
|
+
end
|
|
606
|
+
max_sym = -1
|
|
607
|
+
if jmprel && pltrelsz.positive? && (rel_floor = v2off.call(jmprel))
|
|
608
|
+
0.step(pltrelsz - relaent, relaent) do |cursor|
|
|
609
|
+
r_info = bits == 64 ? word.call(rel_floor + cursor + 8) : u32.call(rel_floor + cursor + 4)
|
|
610
|
+
sym_idx = bits == 64 ? (r_info >> 32) : (r_info >> 8)
|
|
611
|
+
max_sym = sym_idx if sym_idx > max_sym
|
|
612
|
+
end
|
|
613
|
+
end
|
|
614
|
+
# DT_STRSZ is the string table, not the symbol table. Without .dynsym or DT_HASH, cover symbols named by relocations.
|
|
615
|
+
dyn_bytes = (max_sym + 1) * syment if syment.positive? && 0.between?(dyn_bytes, max_sym)
|
|
616
|
+
parse_symtab.call(v2off.call(dyn[6]), dyn_bytes, strtab_off) if dyn[6] && strtab_off && dyn_bytes.positive?
|
|
584
617
|
if jmprel && pltrelsz.positive?
|
|
585
618
|
rel_off = v2off.call(jmprel)
|
|
586
619
|
idx = 0
|
|
@@ -609,7 +642,9 @@ module PWN
|
|
|
609
642
|
seg = loads.find { |row| hit >= row[:off] && hit < row[:off] + row[:filesz] }
|
|
610
643
|
strings[needle] = seg[:vaddr] + (hit - seg[:off]) if seg
|
|
611
644
|
end
|
|
612
|
-
|
|
645
|
+
machine = u16.call(18)
|
|
646
|
+
arch = { 3 => 'i386', 62 => 'x86_64', 40 => 'arm', 183 => 'aarch64', 8 => 'mips', 243 => 'riscv' }.fetch(machine, "machine-#{machine}")
|
|
647
|
+
{ path: opts[:path], arch: arch, symbols: symbols, got: got, plt: plt, strings: strings }
|
|
613
648
|
end
|
|
614
649
|
end
|
|
615
650
|
end
|
|
@@ -176,9 +176,9 @@ module PWN
|
|
|
176
176
|
delete_binary = true if opts[:delete_binary] ||= false
|
|
177
177
|
force_scan = true if opts[:force_scan] ||= false
|
|
178
178
|
callback_url = opts[:callback_url]
|
|
179
|
-
scan_infoleak =
|
|
180
|
-
code_analysis =
|
|
181
|
-
scan_code_familiarity =
|
|
179
|
+
scan_infoleak = opts.fetch(:scan_infoleak, true)
|
|
180
|
+
code_analysis = opts.fetch(:code_analysis, true)
|
|
181
|
+
scan_code_familiarity = opts.fetch(:scan_code_familiarity, false)
|
|
182
182
|
version = opts[:version]
|
|
183
183
|
product_id = opts[:product_id]
|
|
184
184
|
|
|
@@ -576,7 +576,7 @@ module PWN
|
|
|
576
576
|
|
|
577
577
|
bind_address = opts[:bindAddress] ||= listener_by_id[:bindAddress]
|
|
578
578
|
port = opts[:port] ||= listener_by_id[:port]
|
|
579
|
-
enabled = opts
|
|
579
|
+
enabled = opts.fetch(:enabled, listener_by_id[:enabled])
|
|
580
580
|
|
|
581
581
|
post_body = {
|
|
582
582
|
id: id.to_s,
|
|
@@ -682,9 +682,11 @@ module PWN
|
|
|
682
682
|
end
|
|
683
683
|
|
|
684
684
|
host = headers['Host'] || raise('No Host header found in request')
|
|
685
|
-
scheme =
|
|
685
|
+
scheme = site.dig(:http_service, :protocol) || 'http'
|
|
686
686
|
url = "#{scheme}://#{host}#{full_path}"
|
|
687
687
|
uri = URI.parse(url)
|
|
688
|
+
service_port = site.dig(:http_service, :port)
|
|
689
|
+
uri.port = service_port if service_port && URI.parse("//#{host}").port.nil?
|
|
688
690
|
query_string = uri.query ? URI.decode_www_form(uri.query).map { |k, v| { name: k, value: v.to_s } } : []
|
|
689
691
|
|
|
690
692
|
request_headers_size = request_head.bytesize + 4 # Account for \r\n\r\n
|
|
@@ -800,7 +802,7 @@ module PWN
|
|
|
800
802
|
}
|
|
801
803
|
}
|
|
802
804
|
|
|
803
|
-
|
|
805
|
+
return har_log
|
|
804
806
|
end
|
|
805
807
|
|
|
806
808
|
sitemap_arr.uniq
|
|
@@ -992,9 +994,11 @@ module PWN
|
|
|
992
994
|
end
|
|
993
995
|
|
|
994
996
|
host = headers['Host'] || raise('No Host header found in request')
|
|
995
|
-
scheme =
|
|
997
|
+
scheme = site.dig(:http_service, :protocol) || 'http'
|
|
996
998
|
url = "#{scheme}://#{host}#{full_path}"
|
|
997
999
|
uri = URI.parse(url)
|
|
1000
|
+
service_port = site.dig(:http_service, :port)
|
|
1001
|
+
uri.port = service_port if service_port && URI.parse("//#{host}").port.nil?
|
|
998
1002
|
query_string = uri.query ? URI.decode_www_form(uri.query).map { |k, v| { name: k, value: v.to_s } } : []
|
|
999
1003
|
|
|
1000
1004
|
request_headers_size = request_head.bytesize + 4 # Account for \r\n\r\n
|
|
@@ -1110,7 +1114,7 @@ module PWN
|
|
|
1110
1114
|
}
|
|
1111
1115
|
}
|
|
1112
1116
|
|
|
1113
|
-
|
|
1117
|
+
return har_log
|
|
1114
1118
|
end
|
|
1115
1119
|
|
|
1116
1120
|
sitemap_arr.uniq
|
|
@@ -1168,6 +1172,7 @@ module PWN
|
|
|
1168
1172
|
rescue RestClient::ExceptionWithResponse => e
|
|
1169
1173
|
puts "ERROR: Failed to add to sitemap: #{e.message}"
|
|
1170
1174
|
puts "HTTP error adding to sitemap: Status #{e.response.code}, Response: #{e.response.body}" if e.respond_to?(:response) && e.response.respond_to?(:code) && e.response.respond_to?(:body)
|
|
1175
|
+
raise e
|
|
1171
1176
|
rescue StandardError => e
|
|
1172
1177
|
stop(burp_obj: burp_obj) unless burp_obj.nil?
|
|
1173
1178
|
raise e
|
|
@@ -1231,9 +1236,6 @@ module PWN
|
|
|
1231
1236
|
|
|
1232
1237
|
debug = opts[:debug] || false
|
|
1233
1238
|
|
|
1234
|
-
openapi_spec_root = File.dirname(openapi_spec)
|
|
1235
|
-
Dir.chdir(openapi_spec_root)
|
|
1236
|
-
|
|
1237
1239
|
# Parse the OpenAPI JSON or YAML specification file
|
|
1238
1240
|
# If the openapi_spec is YAML, convert it to JSON
|
|
1239
1241
|
openapi = if openapi_spec.end_with?('.json')
|
|
@@ -1393,7 +1395,7 @@ module PWN
|
|
|
1393
1395
|
begin
|
|
1394
1396
|
# Construct HTTP request headers
|
|
1395
1397
|
request_headers = {
|
|
1396
|
-
host: host
|
|
1398
|
+
host: port == uri.default_port ? host : "#{host}:#{port}"
|
|
1397
1399
|
}
|
|
1398
1400
|
request_headers.merge!(additional_http_headers)
|
|
1399
1401
|
|
|
@@ -1641,12 +1643,13 @@ module PWN
|
|
|
1641
1643
|
|
|
1642
1644
|
sitemap_arr.each do |sitemap|
|
|
1643
1645
|
add_to_sitemap(burp_obj: burp_obj, sitemap: sitemap)
|
|
1644
|
-
rescue RestClient::ExceptionWithResponse => e
|
|
1645
|
-
puts e.message
|
|
1646
|
-
next
|
|
1647
1646
|
end
|
|
1648
1647
|
|
|
1649
1648
|
sitemap_arr
|
|
1649
|
+
rescue RestClient::ExceptionWithResponse
|
|
1650
|
+
# A rejected entry is not a successful import. Preserve the HTTP error
|
|
1651
|
+
# and caller-owned service; earlier successful entries are not replayed.
|
|
1652
|
+
raise
|
|
1650
1653
|
rescue StandardError => e
|
|
1651
1654
|
stop(burp_obj: burp_obj) unless burp_obj.nil?
|
|
1652
1655
|
raise e
|
|
@@ -12,11 +12,8 @@ module PWN
|
|
|
12
12
|
# )
|
|
13
13
|
|
|
14
14
|
public_class_method def self.connect_via_screen(opts = {})
|
|
15
|
-
block_dev = opts
|
|
16
|
-
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
block_dev ||= '/dev/ttyUSB0'
|
|
15
|
+
block_dev = opts.fetch(:block_dev, '/dev/ttyUSB0')
|
|
16
|
+
raise ArgumentError, 'Invalid serial block device' unless block_dev.is_a?(String) && File.exist?(block_dev)
|
|
20
17
|
|
|
21
18
|
screen_bin = '/usr/bin/screen'
|
|
22
19
|
raise "ERROR: #{screen_bin} not found." unless File.exist?(screen_bin)
|
|
@@ -44,9 +41,8 @@ module PWN
|
|
|
44
41
|
# )
|
|
45
42
|
|
|
46
43
|
public_class_method def self.connect(opts = {})
|
|
47
|
-
PWN::Plugins::Serial.connect(opts)
|
|
44
|
+
PWN::Plugins::Serial.connect(opts.merge(block_dev: opts.fetch(:block_dev, '/dev/ttyUSB0')))
|
|
48
45
|
rescue StandardError => e
|
|
49
|
-
disconnect(bus_pirate_obj: bus_pirate_obj) unless bus_pirate_obj.nil?
|
|
50
46
|
raise e
|
|
51
47
|
end
|
|
52
48
|
|
data/lib/pwn/plugins/char.rb
CHANGED
|
@@ -15,7 +15,12 @@ module PWN
|
|
|
15
15
|
obj = opts[:obj]
|
|
16
16
|
case obj
|
|
17
17
|
when String
|
|
18
|
-
obj.
|
|
18
|
+
text = obj.dup
|
|
19
|
+
text.force_encoding('UTF-8') if text.encoding == Encoding::BINARY
|
|
20
|
+
return text if text.encoding == Encoding::UTF_8 && text.valid_encoding?
|
|
21
|
+
|
|
22
|
+
text.force_encoding('ISO-8859-1') if obj.encoding == Encoding::BINARY
|
|
23
|
+
text.encode('UTF-8', invalid: :replace, undef: :replace)
|
|
19
24
|
when Array
|
|
20
25
|
obj.map { |item| force_utf8(obj: item) }
|
|
21
26
|
when Hash
|
|
@@ -358,13 +363,14 @@ module PWN
|
|
|
358
363
|
public_class_method def self.generate_encoded_files(opts = {})
|
|
359
364
|
from = opts[:from].to_i
|
|
360
365
|
to = opts[:to].to_i
|
|
361
|
-
output_dir = opts[:output_dir]
|
|
366
|
+
output_dir = opts[:output_dir].to_s
|
|
367
|
+
raise ArgumentError, 'output_dir must be an existing directory' unless Dir.exist?(output_dir)
|
|
362
368
|
|
|
363
369
|
char_arr = generate_by_range(from: 0, to: 0).first
|
|
364
370
|
char_keys = char_arr.keys
|
|
365
371
|
char_keys.each do |char_key|
|
|
366
372
|
encoder = char_arr[char_key][:encoder]
|
|
367
|
-
this_file = "#{output_dir}/#{from}_#{to}_#{encoder}.txt"
|
|
373
|
+
this_file = "#{output_dir}/#{from}_#{to}_#{encoder || char_key}.txt"
|
|
368
374
|
|
|
369
375
|
case char_key
|
|
370
376
|
when :bin, :dec, :hex, :html_entity, :html_entity_dec, :html_entity_hex, :long_int, :oct, :short_int, :url
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
require 'credit_card_validations'
|
|
4
4
|
require 'credit_card_validations/string'
|
|
5
|
+
require 'credit_card_validations/plugins/dankort'
|
|
6
|
+
require 'credit_card_validations/plugins/elo'
|
|
7
|
+
require 'credit_card_validations/plugins/hipercard'
|
|
8
|
+
require 'credit_card_validations/plugins/mir'
|
|
9
|
+
require 'credit_card_validations/plugins/rupay'
|
|
10
|
+
require 'credit_card_validations/plugins/solo'
|
|
11
|
+
require 'credit_card_validations/plugins/switch'
|
|
5
12
|
|
|
6
13
|
module PWN
|
|
7
14
|
module Plugins
|
data/lib/pwn/plugins/dao_ldap.rb
CHANGED
|
@@ -19,7 +19,7 @@ module PWN
|
|
|
19
19
|
|
|
20
20
|
public_class_method def self.connect(opts = {})
|
|
21
21
|
host = opts[:host].to_s
|
|
22
|
-
port = opts[:port].to_i
|
|
22
|
+
port = (opts[:port] || 636).to_i
|
|
23
23
|
base = opts[:base]
|
|
24
24
|
encryption = opts[:encryption]
|
|
25
25
|
auth_method = opts[:auth_method]
|
|
@@ -57,7 +57,7 @@ module PWN
|
|
|
57
57
|
)
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
ldap_obj.bind
|
|
60
|
+
raise IOError, 'LDAP bind failed' unless ldap_obj.bind
|
|
61
61
|
|
|
62
62
|
ldap_obj
|
|
63
63
|
rescue StandardError => e
|