1
1
Fork 0
mirror of https://github.com/OJ/gobuster.git synced 2024-05-13 12:56:03 +02:00

Compare commits

...

2 Commits

Author SHA1 Message Date
firefart 0a77af9d71 no progressbar when no terminal 2024-02-01 20:18:23 +00:00
firefart 33c222ce5e fix #482 2024-02-01 14:05:34 +01:00
7 changed files with 112 additions and 71 deletions

View File

@ -1,28 +1,30 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "Go",
"image": "mcr.microsoft.com/devcontainers/go",
"features": {
"ghcr.io/guiyomh/features/golangci-lint:0": {}
},
"postCreateCommand": "go mod download",
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "go version",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"golang.go",
"shardulm94.trailing-spaces",
"IBM.output-colorizer",
"ms-vscode.makefile-tools",
"ms-azuretools.vscode-docker"
]
}
}
}
"name": "Go",
"image": "mcr.microsoft.com/devcontainers/go",
"features": {
"ghcr.io/guiyomh/features/golangci-lint:0": {},
"ghcr.io/devcontainers-contrib/features/go-task:1": {}
},
"postCreateCommand": "go mod download",
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "go version",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"golang.go",
"shardulm94.trailing-spaces",
"IBM.output-colorizer",
"task.vscode-task",
"github.vscode-github-actions",
"redhat.vscode-yaml"
]
}
}
}

View File

@ -13,6 +13,9 @@ jobs:
with:
go-version: ${{ matrix.go }}
- name: Install Task
uses: arduino/setup-task@v1
- name: Check out code
uses: actions/checkout@v4
@ -29,10 +32,10 @@ jobs:
go get -v -t -d ./...
- name: Build linux
run: make linux
run: task linux
- name: Build windows
run: make windows
run: task windows
- name: Test
run: make test
run: task test

View File

@ -1,41 +0,0 @@
.DEFAULT_GOAL := linux
.PHONY: linux
linux:
go build -o ./gobuster
.PHONY: windows
windows:
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o ./gobuster.exe
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: update
update:
go get -u
go mod tidy -v
.PHONY: all
all: fmt update linux windows test lint
.PHONY: test
test:
go test -v -race ./...
.PHONY: lint
lint:
"$$(go env GOPATH)/bin/golangci-lint" run ./...
go mod tidy
.PHONY: lint-update
lint-update:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin
$$(go env GOPATH)/bin/golangci-lint --version
.PHONY: tag
tag:
@[ "${TAG}" ] && echo "Tagging a new version ${TAG}" || ( echo "TAG is not set"; exit 1 )
git tag -a "${TAG}" -m "${TAG}"
git push origin "${TAG}"

View File

@ -40,6 +40,8 @@ All funds that are donated to this project will be donated to charity. A full lo
- added automaxprocs for use in docker with cpu limits
- log http requests with debug enabled
- allow fuzzing of Host header in fuzz mode
- automatically disable progress output when output is redirected
- fix extra special characters when run with `--no-progress`
## 3.6

62
Taskfile.yml Normal file
View File

@ -0,0 +1,62 @@
version: "3"
vars:
PROGRAM: gobuster
tasks:
update:
cmds:
- go get -u
- go mod tidy -v
build:
aliases: [default, linux]
cmds:
- go fmt ./...
- go vet ./...
- go build -o {{.PROGRAM}}
env:
CGO_ENABLED: 0
linux:
cmds:
- task: build
env:
CGO_ENABLED: 0
GOOS: linux
GOARCH: amd64
windows:
cmds:
- task: build
env:
CGO_ENABLED: 0
GOOS: windows
GOARCH: amd64
test:
env:
CGO_ENABLED: 1 # required by -race
cmds:
- go test -race -cover ./...
lint:
cmds:
- golangci-lint run ./... --timeout=30m
- go mod tidy
lint-update:
cmds:
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b {{ .GOPATH }}/bin
- golangci-lint --version
vars:
GOPATH:
sh: go env GOPATH
tag:
cmds:
- git tag -a "${TAG}" -m "${TAG}"
- git push origin "${TAG}"
preconditions:
- sh: '[[ -n "${TAG}" ]]'
msg: "Please set the TAG environment variable"

View File

@ -36,7 +36,12 @@ func resultWorker(g *libgobuster.Gobuster, filename string, wg *sync.WaitGroup)
}
if s != "" {
s = strings.TrimSpace(s)
_, _ = fmt.Printf("%s%s\n", TERMINAL_CLEAR_LINE, s)
if g.Opts.NoProgress {
_, _ = fmt.Printf("%s\n", s)
} else {
// only print the clear line when progress output is enabled
_, _ = fmt.Printf("%s%s\n", TERMINAL_CLEAR_LINE, s)
}
if f != nil {
err = writeToFile(f, s)
if err != nil {
@ -163,6 +168,15 @@ func Gobuster(ctx context.Context, opts *libgobuster.Options, plugin libgobuster
log.Println(ruler)
}
fi, err := os.Stdout.Stat()
if err != nil {
return err
}
// check if we are not in a terminal. If so, disable output
if (fi.Mode() & os.ModeCharDevice) != os.ModeCharDevice {
opts.NoProgress = true
}
// our waitgroup for all goroutines
// this ensures all goroutines are finished
// when we call wg.Wait()

View File

@ -11,7 +11,6 @@ type Options struct {
PatternFile string
Patterns []string
OutputFilename string
NoStatus bool
NoProgress bool
NoError bool
Quiet bool