infinite-omicron / pentesting-vm

Penetration Testing Virtual Machine
GNU General Public License v3.0
2 stars 2 forks source link

gobuster installation warnings #20

Closed outzhu closed 1 year ago

outzhu commented 2 years ago

go get github.com/OJ/gobuster works for Vagrant but throws

==> pentesting-vagrant.vagrant.alpine: go: downloading github.com/OJ/gobuster v1.4.2
==> pentesting-vagrant.vagrant.alpine: go: downloading github.com/OJ/gobuster v2.0.1+incompatible
==> pentesting-vagrant.vagrant.alpine: go: downloading github.com/google/uuid v1.3.0
==> pentesting-vagrant.vagrant.alpine: go: downloading github.com/hashicorp/go-multierror v1.1.1
==> pentesting-vagrant.vagrant.alpine: go: downloading golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
==> pentesting-vagrant.vagrant.alpine: go: downloading golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
==> pentesting-vagrant.vagrant.alpine: go: downloading github.com/hashicorp/errwrap v1.0.0
==> pentesting-vagrant.vagrant.alpine: go: downloading golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1

and also does not work for Docker.

==> pentesting-docker.docker.alpine: go: go.mod file not found in current directory or any parent directory.
==> pentesting-docker.docker.alpine:    'go get' is no longer supported outside a module.
==> pentesting-docker.docker.alpine:    To build and install a command, use 'go install' with a version,
==> pentesting-docker.docker.alpine:    like 'go install example.com/cmd@latest'
==> pentesting-docker.docker.alpine:    For more information, see https://golang.org/doc/go-get-install-deprecation
==> pentesting-docker.docker.alpine:    or run 'go help get' or 'go help install'.

go install github.com/OJ/gobuster@latest "works" for Docker

==> pentesting-docker.docker.alpine: go: downloading github.com/OJ/gobuster v2.0.1+incompatible
==> pentesting-docker.docker.alpine: go: finding module for package github.com/hashicorp/go-multierror
==> pentesting-docker.docker.alpine: go: finding module for package golang.org/x/crypto/ssh/terminal
==> pentesting-docker.docker.alpine: go: finding module for package github.com/google/uuid
==> pentesting-docker.docker.alpine: go: downloading github.com/hashicorp/go-multierror v1.1.1
==> pentesting-docker.docker.alpine: go: downloading github.com/google/uuid v1.3.0
==> pentesting-docker.docker.alpine: go: downloading golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
==> pentesting-docker.docker.alpine: go: found golang.org/x/crypto/ssh/terminal in golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
==> pentesting-docker.docker.alpine: go: found github.com/google/uuid in github.com/google/uuid v1.3.0
==> pentesting-docker.docker.alpine: go: found github.com/hashicorp/go-multierror in github.com/hashicorp/go-multierror v1.1.1
==> pentesting-docker.docker.alpine: go: downloading golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
==> pentesting-docker.docker.alpine: go: downloading github.com/hashicorp/errwrap v1.0.0
==> pentesting-docker.docker.alpine: go: downloading golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1

but gives Vagrant more errors.

==> pentesting-vagrant.vagrant.alpine: go: downloading github.com/OJ/gobuster v1.4.2
==> pentesting-vagrant.vagrant.alpine: go: downloading github.com/OJ/gobuster v2.0.1+incompatible
==> pentesting-vagrant.vagrant.alpine: go: finding module for package github.com/google/uuid
==> pentesting-vagrant.vagrant.alpine: go: finding module for package golang.org/x/crypto/ssh/terminal
==> pentesting-vagrant.vagrant.alpine: go: downloading github.com/google/uuid v1.3.0
==> pentesting-vagrant.vagrant.alpine: go: finding module for package github.com/hashicorp/go-multierror
==> pentesting-vagrant.vagrant.alpine: go: downloading golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
==> pentesting-vagrant.vagrant.alpine: go: downloading github.com/hashicorp/go-multierror v1.1.1
==> pentesting-vagrant.vagrant.alpine: go: found golang.org/x/crypto/ssh/terminal in golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
==> pentesting-vagrant.vagrant.alpine: go: found github.com/google/uuid in github.com/google/uuid v1.3.0
==> pentesting-vagrant.vagrant.alpine: go: found github.com/hashicorp/go-multierror in github.com/hashicorp/go-multierror v1.1.1
==> pentesting-vagrant.vagrant.alpine: go: downloading golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
==> pentesting-vagrant.vagrant.alpine: go: downloading github.com/hashicorp/errwrap v1.0.0
==> pentesting-vagrant.vagrant.alpine: go: downloading golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1

What version of gobuster should it use?

oxr463 commented 2 years ago

I would think go install github.com/oj/gobuster@latest would be the best approach. I don't see an error in the bottom code block for Vagrant.

outzhu commented 2 years ago

I suppose errors isn't the right word, but it does show up as red text. Maybe Warnings is the better word?

oxr463 commented 2 years ago

I suppose errors isn't the right word, but it does show up as red text. Maybe Warnings is the better word?

Ah... Well warnings are fine for now, as long as the build completes :)

outzhu commented 2 years ago

Do you know where gobuster would be? I tried gobuster help to check if it was working but I got -bash: gobuster: command not found I don't think it got installed.

outzhu commented 2 years ago

Yeah, gobuster is not installed. the command go install github.com/OJ/gobuster/v3@latest should work but nope. Output from the vagrant box.

go: downloading github.com/OJ/gobuster v1.4.2
go: downloading github.com/OJ/gobuster/v3 v3.1.0
go: downloading github.com/OJ/gobuster v2.0.1+incompatible
go: downloading github.com/spf13/cobra v1.0.0
go: downloading golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
go: downloading github.com/google/uuid v1.1.1
go: downloading github.com/spf13/pflag v1.0.5
go: downloading golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed
outzhu commented 2 years ago

Ah ok it's an issue with go the path for needs to be defined. Probably.

oxr463 commented 2 years ago

I wonder where it installs the binary to? You're probably on to something with the path.

outzhu commented 2 years ago

It works but still trying to figure out how to make env variables work in packer.

outzhu commented 2 years ago

I added environment_vars = ["GOPATH=$HOME/go"] but not "PATH=/${PATH}:${GOPATH}/bin/" to https://github.com/infinite-omicron/pentesting-vm/pull/23 since Packer complaints about $GOPATH/$PATH as unknown variables. I haven't figured out how to call the in-builds variables yet.

Making a note that Packer doesn't store the variable in the Vagrant build so we have to also export GOPATH and that we have to add the GOPATH to PATH variable.

I wonder if we installed go properly or something cause it seems to be weird that go needs to be configured like this.

oxr463 commented 2 years ago

I wonder if we installed go properly or something cause it seems to be weird that go needs to be configured like this.

No, this is normal. Each user on Linux, can specify their own GOPATH... But our use case is a little different.

An environment variable in Packer, would only persist during the build itself... We'll need to set this to persist in the images that get created. Perhaps the best place to put this would be in the dependencies.sh file.