Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Add -no-server switch #156

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dcepler
Copy link

@dcepler dcepler commented Aug 27, 2018

Added option to stop gitrob from starting its own web server so it is possible to just get findings.

Closing issues

Closes #142

David Epler added 2 commits August 27, 2018 13:34
Added option to stop *gitrob* from starting its own web server so it is possible to just get findings.

Closes #142
Add option to README.md
@dcepler dcepler changed the title Add -no-server option Add -no-server switch Aug 27, 2018
@rleibl
Copy link

rleibl commented Nov 13, 2018

Please merge or point out issues preventing the merge, thanks.

@dcepler
Copy link
Author

dcepler commented Nov 21, 2018

Github shows no conflicts for merge, but I do not have write access to merge the Pull Request.

@arbazkiraak
Copy link

@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
}

@rleibl
Copy link

rleibl commented Jan 9, 2019

@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

@mattyjones
Copy link

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants