File tree 3 files changed +106
-37
lines changed
3 files changed +106
-37
lines changed Original file line number Diff line number Diff line change @@ -2,22 +2,40 @@ TARGET=./build
2
2
OSES =darwin linux windows
3
3
ARCHS =amd64 386
4
4
5
- all :
5
+ current : outputdir
6
+ @go build -o ./gobuster; \
7
+ echo " Done."
8
+
9
+ outputdir :
6
10
@mkdir -p ${TARGET}
7
- @for GOOS in ${OSES} ; do \
8
- for GOARCH in ${ARCHS} ; do \
9
- echo " Building for $$ {GOOS} $$ {GOARCH} ..." ; \
10
- if [ " $$ {GOOS}" == " windows" ]; then \
11
- GOOS=$$ {GOOS} GARCH=$$ {GOARCH} go build -o ${TARGET} /gobuster-$$ {GOARCH}.exe ; \
12
- else \
13
- GOOS=$$ {GOOS} GARCH=$$ {GOARCH} go build -o ${TARGET} /gobuster-$$ {GOOS}-$$ {GOARCH} ; \
14
- fi ; \
15
- done ; \
11
+
12
+ windows : outputdir
13
+ @for GOARCH in ${ARCHS} ; do \
14
+ echo " Building for windows $$ {GOARCH} ..." ; \
15
+ GOOS=windows GARCH=$$ {GOARCH} go build -o ${TARGET} /gobuster-$$ {GOARCH}.exe ; \
16
+ done ; \
17
+ echo " Done."
18
+
19
+ linux : outputdir
20
+ @for GOARCH in ${ARCHS} ; do \
21
+ echo " Building for linux $$ {GOARCH} ..." ; \
22
+ GOOS=linux GARCH=$$ {GOARCH} go build -o ${TARGET} /gobuster-linux-$$ {GOARCH} ; \
16
23
done ; \
17
24
echo " Done."
18
25
26
+ darwin : outputdir
27
+ @for GOARCH in ${ARCHS} ; do \
28
+ echo " Building for darwin $$ {GOARCH} ..." ; \
29
+ GOOS=darwin GARCH=$$ {GOARCH} go build -o ${TARGET} /gobuster-darwin-$$ {GOARCH} ; \
30
+ done ; \
31
+ echo " Done."
32
+
33
+
34
+ all : darwin linux windows
35
+
19
36
test :
20
- @go test -v -race ./...
37
+ @go test -v -race ./... ; \
38
+ echo " Done."
21
39
22
40
clean :
23
41
@rm -rf ${TARGET} /* ; \
Original file line number Diff line number Diff line change @@ -78,6 +78,14 @@ This will create a `gobuster` binary for you. If you want to install it in the `
78
78
```
79
79
gobuster $ go install
80
80
```
81
+ If you have all the dependencies already, you can make use of the build scripts:
82
+ * ` make ` - builds for the current Go configuration (ie. runs ` go build ` ).
83
+ * ` make windows ` - builds 32 and 64 bit binaries for windows, and writes them to the ` build ` subfolder.
84
+ * ` make linux ` - builds 32 and 64 bit binaries for linux, and writes them to the ` build ` subfolder.
85
+ * ` make darwin ` - builds 32 and 64 bit binaries for darwin, and writes them to the ` build ` subfolder.
86
+ * ` make all ` - builds for all platforms and architectures, and writes the resulting binaries to the ` build ` subfolder.
87
+ * ` make clean ` - clears out the ` build ` subfolder.
88
+ * ` make test ` - runs the tests (requires you to ` go get githubcom/h2non/gock ` first).
81
89
82
90
#### Running as a script
83
91
```
Original file line number Diff line number Diff line change 1
1
@ echo off
2
2
3
+ SET ARG = %1
3
4
SET TARGET = .\build
4
5
5
- IF %1 == " test" (
6
+ IF " %ARG% " == " test" (
6
7
go test -v -race ./...
8
+ echo Done.
9
+ GOTO Done
7
10
)
8
11
9
- IF %1 == " clean" (
10
- del /F %TARGET% \*.*
12
+ IF " %ARG% " == " clean" (
13
+ del /F /Q %TARGET% \*.*
14
+ echo Done.
15
+ GOTO Done
11
16
)
12
17
13
- IF %1 == " " (
14
- echo " Building for windows ..."
15
- set GOOS = windows
16
- set GOARCH = amd64
17
- go build -o %TARGET% \gobuster-%GOARCH% .exe
18
- set GOARCH = 386
19
- go build -o %TARGET% \gobuster-%GOARCH% .exe
20
-
21
- echo " Building for osx ..."
22
- set GOOS = osx
23
- set GOARCH = amd64
24
- go build -o %TARGET% \gobuster-%GOOS% -%GOARCH%
25
- set GOARCH = 386
26
- go build -o %TARGET% \gobuster-%GOOS% -%GOARCH%
27
-
28
- echo " Building for linux ..."
29
- set GOOS = osx
30
- set GOARCH = amd64
31
- go build -o %TARGET% \gobuster-%GOOS% -%GOARCH%
32
- set GOARCH = 386
33
- go build -o %TARGET% \gobuster-%GOOS% -%GOARCH%
34
-
35
- echo " Done."
18
+ IF " %ARG% " == " windows" (
19
+ CALL :Windows
20
+ GOTO Done
36
21
)
37
22
23
+ IF " %ARG% " == " darwin" (
24
+ CALL :Darwin
25
+ GOTO Done
26
+ )
27
+
28
+ IF " %ARG% " == " linux" (
29
+ CALL :Linux
30
+ GOTO Done
31
+ )
32
+
33
+ IF " %ARG% " == " all" (
34
+ CALL :Darwin
35
+ CALL :Linux
36
+ CALL :Windows
37
+ GOTO Done
38
+ )
39
+
40
+ IF " %ARG% " == " " (
41
+ go build -o .\gobuster.exe
42
+ GOTO Done
43
+ )
44
+
45
+ GOTO Done
46
+
47
+ :Darwin
48
+ set GOOS = darwin
49
+ set GOARCH = amd64
50
+ echo Building for %GOOS% %GOARCH% ...
51
+ go build -o %TARGET% \gobuster-%GOOS% -%GOARCH%
52
+ set GOARCH = 386
53
+ echo Building for %GOOS% %GOARCH% ...
54
+ go build -o %TARGET% \gobuster-%GOOS% -%GOARCH%
55
+ echo Done.
56
+ EXIT /B 0
57
+
58
+ :Linux
59
+ set GOOS = linux
60
+ set GOARCH = amd64
61
+ echo Building for %GOOS% %GOARCH% ...
62
+ go build -o %TARGET% \gobuster-%GOOS% -%GOARCH%
63
+ set GOARCH = 386
64
+ echo Building for %GOOS% %GOARCH% ...
65
+ go build -o %TARGET% \gobuster-%GOOS% -%GOARCH%
66
+ echo Done.
67
+ EXIT /B 0
68
+
69
+ :Windows
70
+ set GOOS = windows
71
+ set GOARCH = amd64
72
+ echo Building for %GOOS% %GOARCH% ...
73
+ go build -o %TARGET% \gobuster-%GOARCH% .exe
74
+ set GOARCH = 386
75
+ echo Building for %GOOS% %GOARCH% ...
76
+ go build -o %TARGET% \gobuster-%GOARCH% .exe
77
+ echo Done.
78
+ EXIT /B 0
79
+
80
+ :Done
You can’t perform that action at this time.
0 commit comments