Skip to content

Commit

Permalink
Dev Updates (#305)
Browse files Browse the repository at this point in the history
* retry on timeout
* Google Cloud Bucket enumeration
* colors in output
* goreleaser
* fix nil reference errors
  • Loading branch information
firefart authored Oct 8, 2022
1 parent 9ea1da4 commit 0a0cab9
Show file tree
Hide file tree
Showing 51 changed files with 1,670 additions and 1,094 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# These are supported funding model platforms

github: OJ
github: [OJ, firefart]
patreon: OJReeves
open_collective: gobuster
ko_fi: OJReeves
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
9 changes: 6 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.17", "1.18", "1.19"]
go: ["1.18", "1.19"]
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v2
Expand All @@ -28,8 +28,11 @@ jobs:
run: |
go get -v -t -d ./...
- name: Build
run: go build -v .
- name: Build linux
run: make linux

- name: Build windows
run: make windows

- name: Test
run: make test
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: goreleaser

on:
push:
tags:
- "*"

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 12 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Folders
_obj
_test

# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
# Test binary, built with `go test -c`
*.test

*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

_testmain.go
# Dependency directories (remove the comment below to include it)
# vendor/

*.exe
*.test
*.prof
*.txt
*.swp

.vscode/
gobuster
build
v3

.idea/
dist/
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters:
enable:
- nonamedreturns
36 changes: 36 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
archives:
- format: tar.gz
format_overrides:
- goos: windows
format: zip
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-dev"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
66 changes: 13 additions & 53 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,57 +1,28 @@
TARGET=./build
ARCHS=amd64 386
LDFLAGS="-s -w"
.DEFAULT_GOAL := linux

.PHONY: current
current:
@go build -o ./gobuster; \
echo "Done."
.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 ./...; \
echo "Done."
go fmt ./...

.PHONY: update
update:
@go get -u; \
go mod tidy -v; \
echo "Done."

.PHONY: windows
windows:
@for GOARCH in ${ARCHS}; do \
echo "Building for windows $${GOARCH} ..." ; \
mkdir -p ${TARGET}/gobuster-windows-$${GOARCH} ; \
GOOS=windows GOARCH=$${GOARCH} GO111MODULE=on CGO_ENABLED=0 go build -ldflags=${LDFLAGS} -trimpath -o ${TARGET}/gobuster-windows-$${GOARCH}/gobuster.exe ; \
done; \
echo "Done."

.PHONY: linux
linux:
@for GOARCH in ${ARCHS}; do \
echo "Building for linux $${GOARCH} ..." ; \
mkdir -p ${TARGET}/gobuster-linux-$${GOARCH} ; \
GOOS=linux GOARCH=$${GOARCH} GO111MODULE=on CGO_ENABLED=0 go build -ldflags=${LDFLAGS} -trimpath -o ${TARGET}/gobuster-linux-$${GOARCH}/gobuster ; \
done; \
echo "Done."

.PHONY: darwin
darwin:
@for GOARCH in ${ARCHS}; do \
echo "Building for darwin $${GOARCH} ..." ; \
mkdir -p ${TARGET}/gobuster-darwin-$${GOARCH} ; \
GOOS=darwin GOARCH=$${GOARCH} GO111MODULE=on CGO_ENABLED=0 go build -ldflags=${LDFLAGS} -trimpath -o ${TARGET}/gobuster-darwin-$${GOARCH}/gobuster ; \
done; \
echo "Done."
go get -u
go mod tidy -v

.PHONY: all
all: clean fmt update test lint darwin linux windows
all: fmt update linux windows test lint

.PHONY: test
test:
@go test -v -race ./... ; \
echo "Done."
go test -v -race ./...

.PHONY: lint
lint:
Expand All @@ -62,14 +33,3 @@ lint:
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: lint-docker
lint-docker:
docker pull golangci/golangci-lint:latest
docker run --rm -v $$(pwd):/app -w /app golangci/golangci-lint:latest golangci-lint run

.PHONY: clean
clean:
@rm -rf ${TARGET}/* ; \
go clean ./... ; \
echo "Done."
Loading

0 comments on commit 0a0cab9

Please sign in to comment.