diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index d44e117..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -custom: ['https://www.buymeacoffee.com/enenumxela'] diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..bcab5e5 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,32 @@ +# 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://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - + package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + target-branch: "dev" + commit-message: + prefix: "chore" + include: "scope" + labels: + - "Type: Maintenance" + + # Maintain dependencies for go modules + - + package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "weekly" + target-branch: "dev" + commit-message: + prefix: "chore" + include: "scope" + labels: + - "Type: Maintenance" \ No newline at end of file diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000..c648bb6 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,45 @@ +name: 🔨 Build Test + +on: + push: + branches: + - "main" + paths: + - '**.go' + - '**.mod' + pull_request: + branches: + - "main" + paths: + - '**.go' + - '**.mod' + workflow_dispatch: + +jobs: + build: + name: Build Test + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-12] + runs-on: ${{ matrix.os }} + steps: + - + name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20' + - + name: Checkout the code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - + name: Go modules hygine + run: | + go clean -modcache + go mod tidy + working-directory: . + - + name: Go build + run: go build -v . + working-directory: ./cmd/xs3scann3r \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 513b5e3..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: build 🔨 - -on: - push: - branches: - - main - workflow_dispatch: - -jobs: - build: - name: build - runs-on: ubuntu-latest - steps: - - - name: Check out code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: '>=1.17.0' - - - name: Build - run: go build -v . - working-directory: ./cmd/hqs3scann3r \ No newline at end of file diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml new file mode 100644 index 0000000..51d5f90 --- /dev/null +++ b/.github/workflows/lint-test.yml @@ -0,0 +1,40 @@ +name: 💅 Lint Test + +on: + push: + branches: + - "main" + paths: + - '**.go' + - '**.mod' + pull_request: + branches: + - "main" + paths: + - '**.go' + - '**.mod' + workflow_dispatch: + +permissions: + contents: read + +jobs: + lint: + name: Lint Test + runs-on: ubuntu-latest + steps: + - + name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20' + - + name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - + name: Run golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.52.2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6368ab4..21da946 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,40 +1,35 @@ -name: release 🎉 +name: 🎉 release on: create: + branches: + - main tags: - v*.*.* - workflow_dispatch: jobs: release: - name: release + name: Release runs-on: ubuntu-latest steps: - - name: Check out code + name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20' + - + name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Set up Go - uses: actions/setup-go@v3 + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v4 with: - go-version: '>=1.17.0' - - - name: Get dependencies - run: | - go get -v -t -d ./... - if [ -f Gopkg.toml ]; then - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - dep ensure - fi - - - name: "Create release on GitHub" - uses: goreleaser/goreleaser-action@v3 + args: "release --clean" + version: latest env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - with: - args: "release --rm-dist" - version: latest - distribution: goreleaser \ No newline at end of file + SLACK_WEBHOOK: "${{ secrets.SLACK_WEBHOOK }}" + DISCORD_WEBHOOK_ID: "${{ secrets.DISCORD_WEBHOOK_ID }}" + DISCORD_WEBHOOK_TOKEN: "${{ secrets.DISCORD_WEBHOOK_TOKEN }}" diff --git a/.gitignore b/.gitignore index a158aea..6a38dbb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # Excutables -cmd/hqs3scann3r/hqs3scann3r +cmd/xs3scann3r/xs3scann3r # Notes diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..b0b1ffd --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,61 @@ +run: + issues-exit-code: 1 + +linters: + disable-all: true + enable: + - bodyclose + - depguard + - dogsled + - dupl + - errcheck + - exportloopref + - exhaustive + - goconst + - gocritic + - gofmt + - goimports + - gocyclo + - gosec + - gosimple + - govet + - ineffassign + - misspell + - nolintlint + - prealloc + - predeclared + - revive + - staticcheck + - stylecheck + - thelper + - tparallel + - typecheck + - unconvert + - unparam + - unused + - whitespace + - wsl + +linters-settings: + errcheck: + check-type-assertions: true + goconst: + min-len: 2 + min-occurrences: 3 + gocritic: + enabled-tags: + - style + - diagnostic + - performance + - experimental + - opinionated + disabled-checks: + - captLocal + - octalLiteral + govet: + check-shadowing: true + enable: + - fieldalignment + nolintlint: + require-explanation: true + require-specific: true \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 242c16f..7ad4a31 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,7 +1,16 @@ +before: + hooks: + - go mod tidy + builds: - - binary: hqs3scann3r - main: cmd/hqs3scann3r/main.go + id: xs3scann3r-cli + main: cmd/xs3scann3r/main.go + binary: xs3scann3r + + env: + - CGO_ENABLED=0 + goos: - linux - windows @@ -11,10 +20,24 @@ builds: - 386 - arm - arm64 + ignore: + - + goos: darwin + goarch: 386 + - + goos: windows + goarch: arm + - + goos: windows + goarch: arm64 + + flags: + - -trimpath archives: - id: tgz + builds: [xs3scann3r-cli] format: tar.gz replacements: darwin: macOS @@ -22,3 +45,17 @@ archives: - goos: windows format: zip + +checksum: + algorithm: sha256 + +announce: + slack: + enabled: true + channel: '#release' + username: GoReleaser + message_template: 'New Release: {{ .ProjectName }} {{.Tag}} is published! Check it out at {{ .ReleaseURL }}' + + discord: + enabled: true + message_template: '**New Release: {{ .ProjectName }} {{.Tag}}** is published! Check it out at {{ .ReleaseURL }}' \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d17832a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,54 @@ +# Contributing + +Contributions are welcomed! + +Please review the following guidelines before contributing. Also, feel free to propose changes to these guidelines by updating this file and submitting a pull request. + +* [I have a question...](#have-a-question) +* [I found a bug...](#found-a-bug) +* [I have a feature request...](#have-a-feature-request) +* [I have a contribution to share...](#ready-to-contribute) + +## Have a Question? + +Please don't open a GitHub issue for questions about how to use `xs3scann3r`, as the goal is to use issues for managing bugs and feature requests. Issues that are related to general support will be closed. + +## Found a Bug? + +If you've identified a bug in `xs3scann3r`, please [submit an issue](#create-an-issue) to our GitHub repo: [hueristiq/xs3scann3r](https://github.com/hueristiq/xs3scann3r/issues/new). Please also feel free to submit a [Pull Request](#pull-requests) with a fix for the bug! + +## Have a Feature Request? + +All feature requests should start with [submitting an issue](#create-an-issue) documenting the user story and acceptance criteria. Again, feel free to submit a [Pull Request](#pull-requests) with a proposed implementation of the feature. + +## Ready to Contribute + +### Create an issue + +Before submitting a new issue, please search the issues to make sure there isn't a similar issue doesn't already exist. + +Assuming no existing issues exist, please ensure you include required information when submitting the issue to ensure we can quickly reproduce your issue. + +We may have additional questions and will communicate through the GitHub issue, so please respond back to our questions to help reproduce and resolve the issue as quickly as possible. + +New issues can be created with in our [GitHub repo](https://github.com/hueristiq/xs3scann3r/issues/new). + +### Pull Requests + +Pull requests should target the `dev` branch. Please also reference the issue from the description of the pull request using [special keyword syntax](https://help.github.com/articles/closing-issues-via-commit-messages/) to auto close the issue when the PR is merged. For example, include the phrase `fixes #14` in the PR description to have issue #14 auto close. + +### Styleguide + +When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible. Here are a few points to keep in mind: + +* Please run `go fmt ./...` before committing to ensure code aligns with go standards. +* We use [`golangci-lint`](https://golangci-lint.run/) for linting Go code, run `golangci-lint run --fix` before submitting PR. Editors such as Visual Studio Code or JetBrains IntelliJ; with Go support plugin will offer `golangci-lint` automatically. +* All dependencies must be defined in the `go.mod` file. + * Advanced IDEs and code editors (like VSCode) will take care of that, but to be sure, run `go mod tidy` to validate dependencies. +* For details on the approved style, check out [Effective Go](https://golang.org/doc/effective_go.html). + +### License + +By contributing your code, you agree to license your contribution under the terms of the [MIT License](https://github.com/hueristiq/xs3scann3r/blob/master/LICENSE). + +All files are released with the MIT license. diff --git a/LICENSE b/LICENSE index 3e1bd6b..5222152 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2020 Signed Security +Copyright (c) 2020 Hueristiq Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index c9755ba..1fb553d 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,21 @@ -# hqs3scann3r +# xs3scann3r -[![release](https://img.shields.io/github/release/hueristiq/hqs3scann3r?style=flat&color=0040ff)](https://github.com/hueristiq/hqs3scann3r/releases) ![maintenance](https://img.shields.io/badge/maintained%3F-yes-0040ff.svg) [![open issues](https://img.shields.io/github/issues-raw/hueristiq/hqs3scann3r.svg?style=flat&color=0040ff)](https://github.com/hueristiq/hqs3scann3r/issues?q=is:issue+is:open) [![closed issues](https://img.shields.io/github/issues-closed-raw/hueristiq/hqs3scann3r.svg?style=flat&color=0040ff)](https://github.com/hueristiq/hqs3scann3r/issues?q=is:issue+is:closed) [![license](https://img.shields.io/badge/license-MIT-gray.svg?colorB=0040FF)](https://github.com/hueristiq/hqs3scann3r/blob/master/LICENSE) [![twitter](https://img.shields.io/badge/twitter-@itshueristiq-0040ff.svg)](https://twitter.com/itshueristiq) +![made with go](https://img.shields.io/badge/made%20with-Go-0000FF.svg) [![release](https://img.shields.io/github/release/hueristiq/xs3scann3r?style=flat&color=0000FF)](https://github.com/hueristiq/xs3scann3r/releases) [![license](https://img.shields.io/badge/license-MIT-gray.svg?color=0000FF)](https://github.com/hueristiq/xs3scann3r/blob/master/LICENSE) ![maintenance](https://img.shields.io/badge/maintained%3F-yes-0000FF.svg) [![open issues](https://img.shields.io/github/issues-raw/hueristiq/xs3scann3r.svg?style=flat&color=0000FF)](https://github.com/hueristiq/xs3scann3r/issues?q=is:issue+is:open) [![closed issues](https://img.shields.io/github/issues-closed-raw/hueristiq/xs3scann3r.svg?style=flat&color=0000FF)](https://github.com/hueristiq/xs3scann3r/issues?q=is:issue+is:closed) [![contribution](https://img.shields.io/badge/contributions-welcome-0000FF.svg)](https://github.com/hueristiq/xs3scann3r/blob/master/CONTRIBUTING.md) -hqs3scann3r is tool to scan AWS S3 bucket permissions. +`xs3scann3r` is a command-line interface (CLI) utility to scan S3 bucket permissions. ## Resources * [Features](#features) * [Installation](#installation) - * [From Binary](#from-binary) - * [From source](#from-source) - * [From github](#from-github) + * [Install release binaries](#install-release-binaries) + * [Install source](#install-sources) + * [`go install ...`](#go-install) + * [`go build ...` the development Version](#go-build--the-development-version) * [Usage](#usage) * [Interpreting Results](#interpreting-results) * [Contribution](#contribution) +* [Licensing](#licensing) ## Features @@ -21,58 +23,117 @@ hqs3scann3r is tool to scan AWS S3 bucket permissions. ## Installation -#### From Binary +### Install release binaries -You can download the pre-built binary for your platform from this repository's [releases](https://github.com/hueristiq/hqs3scann3r/releases/) page, extract, then move it to your `$PATH`and you're ready to go. +Visit the [releases page](https://github.com/hueristiq/xs3scann3r/releases) and find the appropriate archive for your operating system and architecture. Download the archive from your browser or copy its URL and retrieve it with `wget` or `curl`: -#### From Source +* ...with `wget`: -hqs3scann3r requires **go1.17+** to install successfully. Run the following command to get the repo + ```bash + wget https://github.com/hueristiq/xs3scann3r/releases/download/v/xs3scann3r--linux-amd64.tar.gz + ``` + +* ...or, with `curl`: + + ```bash + curl -OL https://github.com/hueristiq/xs3scann3r/releases/download/v/xs3scann3r--linux-amd64.tar.gz + ``` + +...then, extract the binary: + +```bash +tar xf xs3scann3r--linux-amd64.tar.gz +``` + +> **TIP:** The above steps, download and extract, can be combined into a single step with this onliner +> +> ```bash +> curl -sL https://github.com/hueristiq/xs3scann3r/releases/download/v/xs3scann3r--linux-amd64.tar.gz | tar -xzv +> ``` + +**NOTE:** On Windows systems, you should be able to double-click the zip archive to extract the `xs3scann3r` executable. + +...move the `xs3scann3r` binary to somewhere in your `PATH`. For example, on GNU/Linux and OS X systems: ```bash -go install -v github.com/hueristiq/hqs3scann3r/cmd/hqs3scann3r@latest +sudo mv xs3scann3r /usr/local/bin/ ``` -#### From Github +**NOTE:** Windows users can follow [How to: Add Tool Locations to the PATH Environment Variable](https://msdn.microsoft.com/en-us/library/office/ee537574(v=office.14).aspx) in order to add `xs3scann3r` to their `PATH`. + +### Install source + +Before you install from source, you need to make sure that Go is installed on your system. You can install Go by following the official instructions for your operating system. For this, we will assume that Go is already installed. + +#### `go install ...` ```bash -git clone https://github.com/hueristiq/hqs3scann3r.git && \ -cd hqs3scann3r/cmd/hqs3scann3r/ && \ -go build . && \ -mv hqs3scann3r /usr/local/bin/ && \ -hqs3scann3r -h +go install -v github.com/hueristiq/xs3scann3r/cmd/xs3scann3r@latest ``` +#### `go build ...` the development Version + +* Clone the repository + + ```bash + git clone https://github.com/hueristiq/xs3scann3r.git + ``` + +* Build the utility + + ```bash + cd xs3scann3r/cmd/xs3scann3r && \ + go build . + ``` + +* Move the `xs3scann3r` binary to somewhere in your `PATH`. For example, on GNU/Linux and OS X systems: + + ```bash + sudo mv xs3scann3r /usr/local/bin/ + ``` + + **NOTE:** Windows users can follow [How to: Add Tool Locations to the PATH Environment Variable](https://msdn.microsoft.com/en-us/library/office/ee537574(v=office.14).aspx) in order to add `xs3scann3r` to their `PATH`. + + +**NOTE:** While the development version is a good way to take a peek at `xs3scann3r`'s latest features before they get released, be aware that it may have bugs. Officially released versions will generally be more stable. + ## Usage > **NOTE:** To use this tool awscli is required to have been installed and configured. -To display help message for hqs3scann3r use the `-h` flag: +To display help message for xs3scann3r use the `-h` flag: ``` -hqs3scann3r -h +`xs3scann3r` -h ``` +help message: + ``` - _ _____ _____ -| |__ __ _ ___|___ / ___ ___ __ _ _ __ _ __ |___ / _ __ -| '_ \ / _` / __| |_ \/ __|/ __/ _` | '_ \| '_ \ |_ \| '__| -| | | | (_| \__ \___) \__ \ (_| (_| | | | | | | |___) | | -|_| |_|\__, |___/____/|___/\___\__,_|_| |_|_| |_|____/|_| v1.2.0 - |_| + _____ _____ +__ _____|___ / ___ ___ __ _ _ __ _ __ |___ / _ __ +\ \/ / __| |_ \/ __|/ __/ _` | '_ \| '_ \ |_ \| '__| + > <\__ \___) \__ \ (_| (_| | | | | | | |___) | | +/_/\_\___/____/|___/\___\__,_|_| |_|_| |_|____/|_| v0.0.0 + +A CLI utility to scan S3 buckets permissions. USAGE: - hqs3scann3r [OPTIONS] + xs3scann3r [OPTIONS] + +INPUT: + -i, --input input file (use `-` to get from stdin) -OPTIONS: +CONFIGURATIONS: -c, --concurrency number of concurrent threads (default: 10) -d, --dump location to dump objects - -iL, --input-list buckets list (use `-iL -` to read from stdin) - -nC, --no-color no color mode (default: false) - -v, --verbose verbose mode + +OUTPUT: + -m, --monochrome disable output content coloring + -v, --verbosity debug, info, warning, error, fatal or silent (default: info) ``` -hqs3scann3r takes buckets in the format: +xs3scann3r takes buckets in the format: * Name - e.g. `flaws.cloud` * URL style - e.g. `s3://flaws.cloud` @@ -91,4 +152,8 @@ hqs3scann3r takes buckets in the format: ## Contribution -[Issues](https://github.com/hueristiq/hqs3scann3r/issues) and [Pull Requests](https://github.com/hueristiq/hqs3scann3r/pulls) are welcome! \ No newline at end of file +[Issues](https://github.com/hueristiq/xs3scann3r/issues) and [Pull Requests](https://github.com/hueristiq/xs3scann3r/pulls) are welcome! Check out the [contribution guidelines.](./CONTRIBUTING.md) + +## Licensing + +This utility is distributed under the [MIT license](./LICENSE) \ No newline at end of file diff --git a/example-buckets.txt b/buckets.txt similarity index 100% rename from example-buckets.txt rename to buckets.txt diff --git a/cmd/hqs3scann3r/main.go b/cmd/xs3scann3r/main.go similarity index 65% rename from cmd/hqs3scann3r/main.go rename to cmd/xs3scann3r/main.go index a458854..c72a6a6 100644 --- a/cmd/hqs3scann3r/main.go +++ b/cmd/xs3scann3r/main.go @@ -4,8 +4,8 @@ import ( "bufio" "context" "errors" - "flag" "fmt" + "io/fs" "log" "os" "path/filepath" @@ -16,110 +16,118 @@ import ( "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/feature/s3/manager" "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/hueristiq/hqs3scann3r/pkg/s3format" + hqlog "github.com/hueristiq/hqgoutils/log" + "github.com/hueristiq/hqgoutils/log/formatter" + "github.com/hueristiq/hqgoutils/log/levels" + "github.com/hueristiq/xs3scann3r/internal/configuration" + "github.com/hueristiq/xs3scann3r/pkg/s3format" "github.com/logrusorgru/aurora/v3" + "github.com/spf13/pflag" ) -type options struct { +var ( + au aurora.Aurora + concurrency int dump string - inputList string - noColor bool - verbose bool -} -var ( - co options - au aurora.Aurora + input string + monochrome bool + verbosity string ) -func banner() { - fmt.Fprintln(os.Stderr, aurora.BrightBlue(` - _ _____ _____ -| |__ __ _ ___|___ / ___ ___ __ _ _ __ _ __ |___ / _ __ -| '_ \ / _`+"`"+` / __| |_ \/ __|/ __/ _`+"`"+` | '_ \| '_ \ |_ \| '__| -| | | | (_| \__ \___) \__ \ (_| (_| | | | | | | |___) | | -|_| |_|\__, |___/____/|___/\___\__,_|_| |_|_| |_|____/|_| v1.2.0 - |_| -`).Bold()) -} - func init() { - flag.IntVar(&co.concurrency, "concurrency", 10, "") - flag.IntVar(&co.concurrency, "c", 10, "") - flag.StringVar(&co.dump, "dump", "", "") - flag.StringVar(&co.dump, "d", "", "") - flag.StringVar(&co.inputList, "input-list", "", "") - flag.StringVar(&co.inputList, "iL", "", "") - flag.BoolVar(&co.noColor, "no-color", false, "") - flag.BoolVar(&co.noColor, "nC", false, "") - flag.BoolVar(&co.verbose, "verbose", false, "") - flag.BoolVar(&co.verbose, "v", false, "") - - flag.Usage = func() { - banner() + // parse flags + pflag.IntVarP(&concurrency, "concurrency", "c", 10, "") + pflag.StringVarP(&dump, "dump", "p", "", "") + pflag.StringVarP(&input, "input", "i", "", "") + pflag.BoolVarP(&monochrome, "monochrome", "m", false, "") + pflag.StringVarP(&verbosity, "verbosity", "v", string(levels.LevelInfo), "") + + pflag.CommandLine.SortFlags = false + pflag.Usage = func() { + fmt.Fprintln(os.Stderr, configuration.BANNER) h := "USAGE:\n" - h += " hqs3scann3r [OPTIONS]\n" + h += " xs3scann3r [OPTIONS]\n" + + h += "\nINPUT:\n" + h += " -i, --input input file (use `-` to get from stdin)\n" - h += "\nOPTIONS:\n" + h += "\nCONFIGURATIONS:\n" h += " -c, --concurrency number of concurrent threads (default: 10)\n" h += " -d, --dump location to dump objects\n" - h += " -iL, --input-list buckets list (use `-iL -` to read from stdin)\n" - h += " -nC, --no-color no color mode (default: false)\n" - h += " -v, --verbose verbose mode\n" + + h += "\nOUTPUT:\n" + h += " -m, --monochrome disable output content coloring\n" + h += fmt.Sprintf(" -v, --verbosity debug, info, warning, error, fatal or silent (default: %s)\n", string(levels.LevelInfo)) fmt.Fprint(os.Stderr, h) } - flag.Parse() + pflag.Parse() + + // initialize logger + hqlog.DefaultLogger.SetMaxLevel(levels.LevelStr(verbosity)) + hqlog.DefaultLogger.SetFormatter(formatter.NewCLI(&formatter.CLIOptions{ + Colorize: !monochrome, + })) - au = aurora.NewAurora(!co.noColor) + au = aurora.NewAurora(!monochrome) } -func main() { - buckets := make(chan string, co.concurrency) +func main() { //nolint:gocyclo // To be refactored + // input s3 buckets + buckets := make(chan string, concurrency) go func() { defer close(buckets) - var scanner *bufio.Scanner + var ( + err error + file *os.File + stat fs.FileInfo + ) - if co.inputList == "-" { - stat, err := os.Stdin.Stat() + switch { + case input != "" && input == "-": + stat, err = os.Stdin.Stat() if err != nil { - log.Fatalln(errors.New("no stdin")) + hqlog.Fatal().Msg("no stdin") } if stat.Mode()&os.ModeNamedPipe == 0 { - log.Fatalln(errors.New("no stdin")) + hqlog.Fatal().Msg("no stdin") } - scanner = bufio.NewScanner(os.Stdin) - } else { - openedFile, err := os.Open(co.inputList) + file = os.Stdin + case input != "" && input != "-": + file, err = os.Open(input) if err != nil { - log.Fatalln(err) + hqlog.Fatal().Msg(err.Error()) } - defer openedFile.Close() - - scanner = bufio.NewScanner(openedFile) + default: + hqlog.Fatal().Msg("xs3scann3r takes input from stdin or file using ") } + scanner := bufio.NewScanner(file) + for scanner.Scan() { - if scanner.Text() != "" { - buckets <- scanner.Text() + bucket := scanner.Text() + + if bucket != "" { + buckets <- bucket } } - if scanner.Err() != nil { - log.Fatalln(scanner.Err()) + if err := scanner.Err(); err != nil { + hqlog.Fatal().Msg(err.Error()) } }() wg := &sync.WaitGroup{} - for i := 0; i < co.concurrency; i++ { + for i := 0; i < concurrency; i++ { wg.Add(1) go func() { @@ -127,7 +135,7 @@ func main() { cfg, err := config.LoadDefaultConfig(context.TODO()) if err != nil { - log.Fatalln(err) + hqlog.Fatal().Msg(err.Error()) } for bucket := range buckets { @@ -146,6 +154,7 @@ func main() { } log.Println("error:", err) + continue } @@ -158,11 +167,11 @@ func main() { }) // GetBucketAcl - GetBucketAclInput := &s3.GetBucketAclInput{ + GetBucketACLInput := &s3.GetBucketAclInput{ Bucket: aws.String(bucket), } - GetBucketAclOutput, err := client.GetBucketAcl(context.TODO(), GetBucketAclInput) + GetBucketACLOutput, err := client.GetBucketAcl(context.TODO(), GetBucketACLInput) if err != nil { logger.Printf("GET ACL: %s\n", au.BrightRed("Failed").Bold()) } else { @@ -172,7 +181,7 @@ func main() { } PERMISSIONS := map[string][]string{} - for _, grant := range GetBucketAclOutput.Grants { + for _, grant := range GetBucketACLOutput.Grants { if grant.Grantee.Type == "Group" { for GROUP := range GROUPS { if *grant.Grantee.URI == GROUP { @@ -217,9 +226,9 @@ func main() { } if ListObjectsV2Output != nil && ListObjectsV2Output.Contents != nil { - if co.dump != "" { + if dump != "" { // create the directory - directory := filepath.Join(co.dump, bucket) + directory := filepath.Join(dump, bucket) if _, err := os.Stat(directory); os.IsNotExist(err) { if directory != "" { diff --git a/go.mod b/go.mod index 5e6404f..bb36181 100644 --- a/go.mod +++ b/go.mod @@ -1,29 +1,34 @@ -module github.com/hueristiq/hqs3scann3r +module github.com/hueristiq/xs3scann3r -go 1.18 +go 1.20 require ( - github.com/aws/aws-sdk-go-v2 v1.16.8 - github.com/aws/aws-sdk-go-v2/config v1.15.15 - github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.21 - github.com/aws/aws-sdk-go-v2/service/s3 v1.27.2 + github.com/aws/aws-sdk-go-v2 v1.18.0 + github.com/aws/aws-sdk-go-v2/config v1.18.25 + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.67 + github.com/aws/aws-sdk-go-v2/service/s3 v1.33.1 + github.com/hueristiq/hqgoutils v0.0.0-20230313202103-053eefb3d3ec github.com/logrusorgru/aurora/v3 v3.0.0 + github.com/spf13/pflag v1.0.5 ) require ( - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.12.10 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.9 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.15 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.9 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.16 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.6 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.3 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.10 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.9 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.9 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.11.13 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.16.10 // indirect - github.com/aws/smithy-go v1.12.0 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.13.24 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.3 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.34 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.25 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.28 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.27 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.12.10 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.10 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.19.0 // indirect + github.com/aws/smithy-go v1.13.5 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/term v0.5.0 // indirect ) diff --git a/go.sum b/go.sum index 0016e04..5495289 100644 --- a/go.sum +++ b/go.sum @@ -1,43 +1,47 @@ -github.com/aws/aws-sdk-go-v2 v1.16.8 h1:gOe9UPR98XSf7oEJCcojYg+N2/jCRm4DdeIsP85pIyQ= -github.com/aws/aws-sdk-go-v2 v1.16.8/go.mod h1:6CpKuLXg2w7If3ABZCl/qZ6rEgwtjZTn4eAf4RcEyuw= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3 h1:S/ZBwevQkr7gv5YxONYpGQxlMFFYSRfz3RMcjsC9Qhk= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3/go.mod h1:gNsR5CaXKmQSSzrmGxmwmct/r+ZBfbxorAuXYsj/M5Y= -github.com/aws/aws-sdk-go-v2/config v1.15.15 h1:yBV+J7Au5KZwOIrIYhYkTGJbifZPCkAnCFSvGsF3ui8= -github.com/aws/aws-sdk-go-v2/config v1.15.15/go.mod h1:A1Lzyy/o21I5/s2FbyX5AevQfSVXpvvIDCoVFD0BC4E= -github.com/aws/aws-sdk-go-v2/credentials v1.12.10 h1:7gGcMQePejwiKoDWjB9cWnpfVdnz/e5JwJFuT6OrroI= -github.com/aws/aws-sdk-go-v2/credentials v1.12.10/go.mod h1:g5eIM5XRs/OzIIK81QMBl+dAuDyoLN0VYaLP+tBqEOk= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.9 h1:hz8tc+OW17YqxyFFPSkvfSikbqWcyyHRyPVSTzC0+aI= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.9/go.mod h1:KDCCm4ONIdHtUloDcFvK2+vshZvx4Zmj7UMDfusuz5s= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.21 h1:bpiKFJ9aC0xTVpygSRRRL/YHC1JZ+pHQHENATHuoiwo= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.21/go.mod h1:iIYPrQ2rYfZiB/iADYlhj9HHZ9TTi6PqKQPAqygohbE= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.15 h1:bx5F2mr6H6FC7zNIQoDoUr8wEKnvmwRncujT3FYRtic= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.15/go.mod h1:pWrr2OoHlT7M/Pd2y4HV3gJyPb3qj5qMmnPkKSNPYK4= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.9 h1:5sbyznZC2TeFpa4fvtpvpcGbzeXEEs1l1Jo51ynUNsQ= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.9/go.mod h1:08tUpeSGN33QKSO7fwxXczNfiwCpbj+GxK6XKwqWVv0= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.16 h1:f0ySVcmQhwmzn7zQozd8wBM3yuGBfzdpsOaKQ0/Epzw= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.16/go.mod h1:CYmI+7x03jjJih8kBEEFKRQc40UjUokT0k7GbvrhhTc= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.6 h1:3L8pcjvgaSOs0zzZcMKzxDSkYKEpwJ2dNVDdxm68jAY= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.6/go.mod h1:O7Oc4peGZDEKlddivslfYFvAbgzvl/GH3J8j3JIGBXc= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.3 h1:4n4KCtv5SUoT5Er5XV41huuzrCqepxlW3SDI9qHQebc= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.3/go.mod h1:gkb2qADY+OHaGLKNTYxMaQNacfeyQpZ4csDTQMeFmcw= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.10 h1:7LJcuRalaLw+GYQTMGmVUl4opg2HrDZkvn/L3KvIQfw= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.10/go.mod h1:Qks+dxK3O+Z2deAhNo6cJ8ls1bam3tUGUAcgxQP1c70= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.9 h1:sHfDuhbOuuWSIAEDd3pma6p0JgUcR2iePxtCE8gfCxQ= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.9/go.mod h1:yQowTpvdZkFVuHrLBXmczat4W+WJKg/PafBZnGBLga0= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.9 h1:sJdKvydGYDML9LTFcp6qq6Z5fIjN0Rdq2Gvw1hUg8tc= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.9/go.mod h1:Rc5+wn2k8gFSi3V1Ch4mhxOzjMh+bYSXVFfVaqowQOY= -github.com/aws/aws-sdk-go-v2/service/s3 v1.27.2 h1:NvzGue25jKnuAsh6yQ+TZ4ResMcnp49AWgWGm2L4b5o= -github.com/aws/aws-sdk-go-v2/service/s3 v1.27.2/go.mod h1:u+566cosFI+d+motIz3USXEh6sN8Nq4GrNXSg2RXVMo= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.13 h1:DQpf+al+aWozOEmVEdml67qkVZ6vdtGUi71BZZWw40k= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.13/go.mod h1:d7ptRksDDgvXaUvxyHZ9SYh+iMDymm94JbVcgvSYSzU= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.10 h1:7tquJrhjYz2EsCBvA9VTl+sBAAh1bv7h/sGASdZOGGo= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.10/go.mod h1:cftkHYN6tCDNfkSasAmclSfl4l7cySoay8vz7p/ce0E= -github.com/aws/smithy-go v1.12.0 h1:gXpeZel/jPoWQ7OEmLIgCUnhkFftqNfwWUwAHSlp1v0= -github.com/aws/smithy-go v1.12.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/aws-sdk-go-v2 v1.18.0 h1:882kkTpSFhdgYRKVZ/VCgf7sd0ru57p2JCxz4/oN5RY= +github.com/aws/aws-sdk-go-v2 v1.18.0/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 h1:dK82zF6kkPeCo8J1e+tGx4JdvDIQzj7ygIoLg8WMuGs= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10/go.mod h1:VeTZetY5KRJLuD/7fkQXMU6Mw7H5m/KP2J5Iy9osMno= +github.com/aws/aws-sdk-go-v2/config v1.18.25 h1:JuYyZcnMPBiFqn87L2cRppo+rNwgah6YwD3VuyvaW6Q= +github.com/aws/aws-sdk-go-v2/config v1.18.25/go.mod h1:dZnYpD5wTW/dQF0rRNLVypB396zWCcPiBIvdvSWHEg4= +github.com/aws/aws-sdk-go-v2/credentials v1.13.24 h1:PjiYyls3QdCrzqUN35jMWtUK1vqVZ+zLfdOa/UPFDp0= +github.com/aws/aws-sdk-go-v2/credentials v1.13.24/go.mod h1:jYPYi99wUOPIFi0rhiOvXeSEReVOzBqFNOX5bXYoG2o= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.3 h1:jJPgroehGvjrde3XufFIJUZVK5A2L9a3KwSFgKy9n8w= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.3/go.mod h1:4Q0UFP0YJf0NrsEuEYHpM9fTSEVnD16Z3uyEF7J9JGM= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.67 h1:fI9/5BDEaAv/pv1VO1X1n3jfP9it+IGqWsCuuBQI8wM= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.67/go.mod h1:zQClPRIwQZfJlZq6WZve+s4Tb4JW+3V6eS+4+KrYeP8= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33 h1:kG5eQilShqmJbv11XL1VpyDbaEJzWxd4zRiCG30GSn4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33/go.mod h1:7i0PF1ME/2eUPFcjkVIwq+DOygHEoK92t5cDqNgYbIw= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27 h1:vFQlirhuM8lLlpI7imKOMsjdQLuN9CPi+k44F/OFVsk= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27/go.mod h1:UrHnn3QV/d0pBZ6QBAEQcqFLf8FAzLmoUfPVIueOvoM= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.34 h1:gGLG7yKaXG02/jBlg210R7VgQIotiQntNhsCFejawx8= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.34/go.mod h1:Etz2dj6UHYuw+Xw830KfzCfWGMzqvUTCjUj5b76GVDc= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.25 h1:AzwRi5OKKwo4QNqPf7TjeO+tK8AyOK3GVSwmRPo7/Cs= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.25/go.mod h1:SUbB4wcbSEyCvqBxv/O/IBf93RbEze7U7OnoTlpPB+g= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 h1:y2+VQzC6Zh2ojtV2LoC0MNwHWc6qXv/j2vrQtlftkdA= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11/go.mod h1:iV4q2hsqtNECrfmlXyord9u4zyuFEJX9eLgLpSPzWA8= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.28 h1:vGWm5vTpMr39tEZfQeDiDAMgk+5qsnvRny3FjLpnH5w= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.28/go.mod h1:spfrICMD6wCAhjhzHuy6DOZZ+LAIY10UxhUmLzpJTTs= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.27 h1:0iKliEXAcCa2qVtRs7Ot5hItA2MsufrphbRFlz1Owxo= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.27/go.mod h1:EOwBD4J4S5qYszS5/3DpkejfuK+Z5/1uzICfPaZLtqw= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.2 h1:NbWkRxEEIRSCqxhsHQuMiTH7yo+JZW1gp8v3elSVMTQ= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.2/go.mod h1:4tfW5l4IAB32VWCDEBxCRtR9T4BWy4I4kr1spr8NgZM= +github.com/aws/aws-sdk-go-v2/service/s3 v1.33.1 h1:O+9nAy9Bb6bJFTpeNFtd9UfHbgxO1o4ZDAM9rQp5NsY= +github.com/aws/aws-sdk-go-v2/service/s3 v1.33.1/go.mod h1:J9kLNzEiHSeGMyN7238EjJmBpCniVzFda75Gxl/NqB8= +github.com/aws/aws-sdk-go-v2/service/sso v1.12.10 h1:UBQjaMTCKwyUYwiVnUt6toEJwGXsLBI6al083tpjJzY= +github.com/aws/aws-sdk-go-v2/service/sso v1.12.10/go.mod h1:ouy2P4z6sJN70fR3ka3wD3Ro3KezSxU6eKGQI2+2fjI= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.10 h1:PkHIIJs8qvq0e5QybnZoG1K/9QTrLr9OsqCIo59jOBA= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.10/go.mod h1:AFvkxc8xfBe8XA+5St5XIHHrQQtkxqrRincx4hmMHOk= +github.com/aws/aws-sdk-go-v2/service/sts v1.19.0 h1:2DQLAKDteoEDI8zpCzqBMaZlJuoE9iTYD0gFmXVax9E= +github.com/aws/aws-sdk-go-v2/service/sts v1.19.0/go.mod h1:BgQOMsg8av8jset59jelyPW7NoZcZXLVpDsXunGDrk8= +github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8= +github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/hueristiq/hqgoutils v0.0.0-20230313202103-053eefb3d3ec h1:rK/Tm5QTcb1hXThoQOQ+KnO6cmPDgrSBi5rPObo1OUM= +github.com/hueristiq/hqgoutils v0.0.0-20230313202103-053eefb3d3ec/go.mod h1:owPR/GbpoJMI3Bvx2NMXqLcwb4p8pd6x2qzuebsgbHk= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= @@ -46,7 +50,13 @@ github.com/logrusorgru/aurora/v3 v3.0.0 h1:R6zcoZZbvVcGMvDCKo45A9U/lzYyzl5NfYIvz github.com/logrusorgru/aurora/v3 v3.0.0/go.mod h1:vsR12bk5grlLvLXAYrBsb5Oc/N+LxAlxggSjiwMnCUc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/internal/configuration/configuration.go b/internal/configuration/configuration.go new file mode 100644 index 0000000..a676758 --- /dev/null +++ b/internal/configuration/configuration.go @@ -0,0 +1,29 @@ +package configuration + +import "github.com/logrusorgru/aurora/v3" + +const ( + // NAME is this projet's name + NAME string = "xs3scann3r" + // VERSION is this projet's version + VERSION string = "0.0.0" + // DESCRIPTION is this projet's description + DESCRIPTION string = "A CLI utility to scan S3 buckets permissions." +) + +var ( + // BANNER is this project's CLI display banner + BANNER = aurora.Sprintf( + aurora.BrightBlue(` + _____ _____ +__ _____|___ / ___ ___ __ _ _ __ _ __ |___ / _ __ +\ \/ / __| |_ \/ __|/ __/ _`+"`"+` | '_ \| '_ \ |_ \| '__| + > <\__ \___) \__ \ (_| (_| | | | | | | |___) | | +/_/\_\___/____/|___/\___\__,_|_| |_|_| |_|____/|_| %s + +%s +`).Bold(), + aurora.BrightYellow("v"+VERSION).Bold(), + aurora.BrightGreen(DESCRIPTION).Italic(), + ) +)