mirror of
https://github.com/OJ/gobuster.git
synced 2024-05-04 22:46:07 +02:00
6a2b40ff86
This was cherry-picked from the gomod branch instead of being merged as a PR for two reasons: 1) The vhost plugin addition isn't yet ready for merging, as there's a lot of code duplication. 2) This code can technically be merged as is without the mods to the vhost plugin. When/If we're ready to merge the vhost plugin we'll fix that side up.
110 lines
1.9 KiB
Batchfile
110 lines
1.9 KiB
Batchfile
@echo off
|
|
|
|
SET ARG=%1
|
|
SET TARGET=.\build
|
|
SET BUILDARGS=-ldflags="-s -w" -gcflags="all=-trimpath=%GOPATH%\src" -asmflags="all=-trimpath=%GOPATH%\src"
|
|
|
|
IF "%ARG%"=="test" (
|
|
go test -v -race ./...
|
|
echo Done.
|
|
GOTO Done
|
|
)
|
|
|
|
IF "%ARG%"=="clean" (
|
|
del /F /Q %TARGET%\*.*
|
|
echo Done.
|
|
GOTO Done
|
|
)
|
|
|
|
IF "%ARG%"=="windows" (
|
|
CALL :Windows
|
|
GOTO Done
|
|
)
|
|
|
|
IF "%ARG%"=="darwin" (
|
|
CALL :Darwin
|
|
GOTO Done
|
|
)
|
|
|
|
IF "%ARG%"=="linux" (
|
|
CALL :Linux
|
|
GOTO Done
|
|
)
|
|
|
|
IF "%ARG%"=="update" (
|
|
CALL :Update
|
|
GOTO Done
|
|
)
|
|
|
|
IF "%ARG%"=="all" (
|
|
CALL :Update
|
|
CALL :Darwin
|
|
CALL :Linux
|
|
CALL :Windows
|
|
GOTO Done
|
|
)
|
|
|
|
IF "%ARG%"=="" (
|
|
go build -o .\gobuster.exe
|
|
GOTO Done
|
|
)
|
|
|
|
GOTO Done
|
|
|
|
:Update
|
|
set GO111MODULE=on
|
|
echo Updating ...
|
|
go get -u
|
|
go mod tidy
|
|
echo Done.
|
|
EXIT /B 0
|
|
|
|
:Darwin
|
|
set GOOS=darwin
|
|
set GOARCH=amd64
|
|
set GO111MODULE=on
|
|
echo Building for %GOOS% %GOARCH% ...
|
|
set DIR=%TARGET%\gobuster-%GOOS%-%GOARCH%
|
|
mkdir %DIR% 2> NUL
|
|
go build %BUILDARGS% -o %DIR%\gobuster
|
|
set GOARCH=386
|
|
echo Building for %GOOS% %GOARCH% ...
|
|
set DIR=%TARGET%\gobuster-%GOOS%-%GOARCH%
|
|
mkdir %DIR% 2> NUL
|
|
go build %BUILDARGS% -o %DIR%\gobuster
|
|
echo Done.
|
|
EXIT /B 0
|
|
|
|
:Linux
|
|
set GOOS=linux
|
|
set GOARCH=amd64
|
|
set GO111MODULE=on
|
|
echo Building for %GOOS% %GOARCH% ...
|
|
set DIR=%TARGET%\gobuster-%GOOS%-%GOARCH%
|
|
mkdir %DIR% 2> NUL
|
|
go build %BUILDARGS% -o %DIR%\gobuster
|
|
set GOARCH=386
|
|
echo Building for %GOOS% %GOARCH% ...
|
|
set DIR=%TARGET%\gobuster-%GOOS%-%GOARCH%
|
|
mkdir %DIR% 2> NUL
|
|
go build %BUILDARGS% -o %DIR%\gobuster
|
|
echo Done.
|
|
EXIT /B 0
|
|
|
|
:Windows
|
|
set GOOS=windows
|
|
set GOARCH=amd64
|
|
set GO111MODULE=on
|
|
echo Building for %GOOS% %GOARCH% ...
|
|
set DIR=%TARGET%\gobuster-%GOOS%-%GOARCH%
|
|
mkdir %DIR% 2> NUL
|
|
go build %BUILDARGS% -o %DIR%\gobuster.exe
|
|
set GOARCH=386
|
|
echo Building for %GOOS% %GOARCH% ...
|
|
set DIR=%TARGET%\gobuster-%GOOS%-%GOARCH%
|
|
mkdir %DIR% 2> NUL
|
|
go build %BUILDARGS% -o %DIR%\gobuster.exe
|
|
echo Done.
|
|
EXIT /B 0
|
|
|
|
:Done |