|
| 1 | +# SPDX-License-Identifier: Proprietary |
| 2 | +# |
| 3 | +# ASRFacet-Rb: Attack Surface Reconnaissance Framework |
| 4 | +# Copyright (c) 2026 voltsparx |
| 5 | +# |
| 6 | +# Author: voltsparx |
| 7 | +# Repository: https://github.com/voltsparx/ASRFacet-Rb |
| 8 | +# Contact: voltsparx@gmail.com |
| 9 | +# License: See LICENSE file in the project root |
| 10 | +# |
| 11 | +# This file is part of ASRFacet-Rb and is subject to the terms |
| 12 | +# and conditions defined in the LICENSE file. |
| 13 | + |
| 14 | +require_relative "support/smoke_helper" |
| 15 | + |
| 16 | +include ASRFacet::TestSupport |
| 17 | + |
| 18 | +def command_available?(name) |
| 19 | + lookup = windows? ? ["where", name] : ["which", name] |
| 20 | + _stdout, _stderr, status = Open3.capture3(*lookup) |
| 21 | + status.success? |
| 22 | +rescue StandardError |
| 23 | + false |
| 24 | +end |
| 25 | + |
| 26 | +announce("Website installer smoke verification started.") |
| 27 | + |
| 28 | +installers_dir = File.join(ROOT, "docs", "website", "web_assets", "installers") |
| 29 | +linux_rel = File.join("docs", "website", "web_assets", "installers", "asrfacet-rb-installer-linux.sh") |
| 30 | +macos_rel = File.join("docs", "website", "web_assets", "installers", "asrfacet-rb-installer-macos.sh") |
| 31 | +windows_ps_rel = File.join("docs", "website", "web_assets", "installers", "asrfacet-rb-installer-windows.ps1") |
| 32 | +windows_cmd_rel = File.join("docs", "website", "web_assets", "installers", "asrfacet-rb-installer-windows.cmd") |
| 33 | +readme_rel = File.join("docs", "website", "web_assets", "installers", "README.md") |
| 34 | + |
| 35 | +expected_files = [linux_rel, macos_rel, windows_ps_rel, windows_cmd_rel, readme_rel] |
| 36 | +expected_files.each do |relative_path| |
| 37 | + full_path = File.join(ROOT, relative_path) |
| 38 | + assert(File.file?(full_path), "Missing website installer asset: #{relative_path}") |
| 39 | +end |
| 40 | + |
| 41 | +linux_text = File.read(File.join(ROOT, linux_rel)) |
| 42 | +macos_text = File.read(File.join(ROOT, macos_rel)) |
| 43 | +windows_ps_text = File.read(File.join(ROOT, windows_ps_rel)) |
| 44 | +windows_cmd_text = File.read(File.join(ROOT, windows_cmd_rel)) |
| 45 | +readme_text = File.read(File.join(ROOT, readme_rel)) |
| 46 | + |
| 47 | +%w[install test update uninstall].each do |mode| |
| 48 | + assert(linux_text.include?(mode), "Linux website installer is missing mode '#{mode}'.") |
| 49 | + assert(macos_text.include?(mode), "macOS website installer is missing mode '#{mode}'.") |
| 50 | + assert(windows_ps_text.include?(mode), "Windows website installer is missing mode '#{mode}'.") |
| 51 | +end |
| 52 | + |
| 53 | +assert(linux_text.include?("docs/images"), "Linux website installer must include docs/images sparse path.") |
| 54 | +assert(macos_text.include?("docs/images"), "macOS website installer must include docs/images sparse path.") |
| 55 | +assert(windows_ps_text.include?("docs/images"), "Windows website installer must include docs/images sparse path.") |
| 56 | +assert(windows_cmd_text.include?("asrfacet-rb-installer-windows.ps1"), "Windows CMD wrapper must call the PowerShell installer.") |
| 57 | +assert(readme_text.include?("docs/images"), "Installer README must document docs/images payload behavior.") |
| 58 | + |
| 59 | +if command_available?("bash") |
| 60 | + run_command("bash", "-n", linux_rel, unbundled: true) |
| 61 | + run_command("bash", "-n", macos_rel, unbundled: true) |
| 62 | +else |
| 63 | + announce("Skipping shell syntax checks because bash is not available on this system.") |
| 64 | +end |
| 65 | + |
| 66 | +windows_ps_abs = File.join(ROOT, windows_ps_rel).gsub("\\", "/") |
| 67 | +ps_parse_command = "[void][scriptblock]::Create((Get-Content -Raw '#{windows_ps_abs.gsub("'", "''")}')); 'parse-ok'" |
| 68 | + |
| 69 | +if windows? |
| 70 | + parse_output = run_command("powershell", "-NoProfile", "-Command", ps_parse_command, unbundled: true) |
| 71 | + assert(parse_output.include?("parse-ok"), "PowerShell parser check did not return parse-ok.") |
| 72 | +elsif command_available?("pwsh") |
| 73 | + parse_output = run_command("pwsh", "-NoProfile", "-Command", ps_parse_command, unbundled: true) |
| 74 | + assert(parse_output.include?("parse-ok"), "pwsh parser check did not return parse-ok.") |
| 75 | +else |
| 76 | + announce("Skipping PowerShell syntax check because powershell/pwsh is not available on this system.") |
| 77 | +end |
| 78 | + |
| 79 | +announce("Website installer smoke verification passed.") |
0 commit comments