Skip to content

Commit

Permalink
WIP feroxbuster
Browse files Browse the repository at this point in the history
  • Loading branch information
coolaj86 committed Nov 7, 2023
1 parent 6626a0d commit 1f6e574
Showing 1 changed file with 20 additions and 26 deletions.
46 changes: 20 additions & 26 deletions feroxbuster/install.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env pwsh

##################
#######################
# Install feroxbuster #
##################
#######################

# Every package should define these variables
$pkg_cmd_name = "feroxbuster"
Expand All @@ -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

0 comments on commit 1f6e574

Please sign in to comment.