From 1f6e574030eb981b3900bb95dc88d481efad7872 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 7 Nov 2023 09:43:23 -0700 Subject: [PATCH] WIP feroxbuster --- feroxbuster/install.ps1 | 46 ++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/feroxbuster/install.ps1 b/feroxbuster/install.ps1 index 6d4254a24..01d3bafd8 100644 --- a/feroxbuster/install.ps1 +++ b/feroxbuster/install.ps1 @@ -1,8 +1,8 @@ #!/usr/bin/env pwsh -################## +####################### # Install feroxbuster # -################## +####################### # Every package should define these variables $pkg_cmd_name = "feroxbuster" @@ -15,47 +15,41 @@ $pkg_src_bin = "$Env:USERPROFILE\.local\opt\feroxbuster-v$Env:WEBI_VERSION\bin" $pkg_src_dir = "$Env:USERPROFILE\.local\opt\feroxbuster-v$Env:WEBI_VERSION" $pkg_src = "$pkg_src_cmd" -New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null +New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | Out-Null $pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE" # Fetch archive -IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE")) -{ - echo "Downloading feroxbuster from $Env:WEBI_PKG_URL to $pkg_download" +IF (!(Test-Path -Path "$pkg_download")) { + Write-Host "Downloading feroxbuster from $Env:WEBI_PKG_URL to $pkg_download" & curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part" & move "$pkg_download.part" "$pkg_download" } -IF (!(Test-Path -Path "$pkg_src_cmd")) -{ - echo "Installing feroxbuster" +IF (!(Test-Path -Path "$pkg_src_cmd")) { + Write-Verbose "Installing feroxbuster" # TODO: create package-specific temp directory # Enter tmp pushd .local\tmp - # Remove any leftover tmp cruft - Remove-Item -Path ".\feroxbuster-v*" -Recurse -ErrorAction Ignore - Remove-Item -Path ".\feroxbuster.exe" -Recurse -ErrorAction Ignore + # Remove any leftover tmp cruft + Remove-Item -Path ".\feroxbuster-v*" -Recurse -ErrorAction Ignore + Remove-Item -Path ".\feroxbuster.exe" -Recurse -ErrorAction Ignore - # NOTE: DELETE THIS COMMENT IF NOT USED - # Move single binary into root of temporary folder - #& move "$pkg_download" "feroxbuster.exe" + # Unpack archive file into this temporary directory + # Windows BSD-tar handles zip. Imagine that. + Write-Verbose "Unpacking $pkg_download" + & tar xf "$pkg_download" - # Unpack archive file into this temporary directory - # Windows BSD-tar handles zip. Imagine that. - echo "Unpacking $pkg_download" - & tar xf "$pkg_download" - - # Settle unpacked archive into place - echo "Install Location: $pkg_src_cmd" - New-Item "$pkg_src_bin" -ItemType Directory -Force | out-null - Move-Item -Path ".\feroxbuster-*\feroxbuster.exe" -Destination "$pkg_src_bin" + # Settle unpacked archive into place + Write-Verbose "Install Location: $pkg_src_cmd" + New-Item "$pkg_src_bin" -ItemType Directory -Force | Out-Null + Move-Item -Path ".\feroxbuster-*\feroxbuster.exe" -Destination "$pkg_src_bin" # Exit tmp popd } -echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'" -Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null +Write-Host "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'" +Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | Out-Null Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse