gitrob
gitrob copied to clipboard
Add `-no-server` switch
Added option to stop gitrob from starting its own web server so it is possible to just get findings.
Closing issues
Closes #142
Please merge or point out issues preventing the merge, thanks.
Github shows no conflicts for merge, but I do not have write access to merge the Pull Request.
@dcepler
git clone https://github.com/InVisionApp/gitrob.git -b feature/no-server /my_clone
→ go build main.go
# command-line-arguments
./main.go:221:20: sess.Options.NoServer undefined (type core.Options has no field or method NoServer)
./main.go:247:20: sess.Options.NoServer undefined (type core.Options has no field or method NoServer)
Not sure why it is throwing undefined error.
→ cat options.go
package core
import (
"flag"
)
type Options struct {
CommitDepth *int
GithubAccessToken *string `json:"-"`
NoExpandOrgs *bool
Threads *int
Save *string `json:"-"`
Load *string `json:"-"`
BindAddress *string
Port *int
Silent *bool
Debug *bool
NoServer *bool
Logins []string
}
func ParseOptions() (Options, error) {
options := Options{
CommitDepth: flag.Int("commit-depth", 500, "Number of repository commits to process"),
GithubAccessToken: flag.String("github-access-token", "", "GitHub access token to use for API requests"),
NoExpandOrgs: flag.Bool("no-expand-orgs", false, "Don't add members to targets when processing organizations"),
Threads: flag.Int("threads", 0, "Number of concurrent threads (default number of logical CPUs)"),
Save: flag.String("save", "", "Save session to file"),
Load: flag.String("load", "", "Load session file"),
BindAddress: flag.String("bind-address", "127.0.0.1", "Address to bind web server to"),
Port: flag.Int("port", 9393, "Port to run web server on"),
Silent: flag.Bool("silent", false, "Suppress all output except for errors"),
Debug: flag.Bool("debug", false, "Print debugging information"),
NoServer: flag.Bool("no-server", false, "Disables web server"),
}
flag.Parse()
options.Logins = flag.Args()
return options, nil
}
@arbazkiraak Sorry for answering so late, I hope the answer is still useful for you.
The layout of this repository is somewhat "unconventional" (some may say broken). The repo is spread over several subdirectories, which are included using the full gopath. As a result, main.go looks for a 'core' package where the Options struct is defined. Using the full path, the compiler does not look in your local checkout, but in probably another checkout that you have under $GOPATH/github.com/michenriksen/gitrob/core .
Here is a full example of what you could do.
# Setup go environment
# you can use your own, but this is a full example
cd
mkdir -p src/go_example
cd src/go_example
mkdir src pkg bin
export GOPATH=~/src/go_example
# clone the repo
# note the path. Non-existing directories are automatically created
git clone https://github.com/InVisionApp/gitrob.git -b feature/no-server src/github.com/michenriksen/gitrob
# get dependencies
go get github.com/michenriksen/gitrob
# build
go build github.com/michenriksen/gitrob
Since you seem to have a checkout of the original repo, you could also do
cd $GOPATH/src/github.com/michenriksen/gitrob
git checkout feature/no-server
go build github.com/michenriksen/gitrob
But this is just a guess, I don't know if this would work.
Hope that helps cheers
@dcepler Thanks for submitting this, it was something I was also hacking around but this is a cleaner solution than mine. This is merged in at my fork. Please feel free to open new issues or pull requests against that.