Skip to content

Commit 0eef84a

Browse files
Merge pull request #1 from mattyjones/master
Synch
2 parents 81b4cdf + 43cea27 commit 0eef84a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+4786
-2550
lines changed

.gitignore

+9-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@
44
*.dll
55
*.so
66
*.dylib
7-
gitrob
7+
gitrob*
88
gitrob.exe
9+
coverage.txt
10+
911
bin/
10-
.idea/
1112
vendor/
1213
build/
13-
coverage.txt
14+
bin/
15+
.vscode
16+
.idea
17+
__debug_bin
18+
go_build_gitrob_
19+
gitrob-script.sh
1420

1521
# Test binary, build with `go test -c`
1622
*.test

LICENSE.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
The MIT License (MIT)
22

33
Copyright (c) 2018 Michael Henriksen
4+
Copyright (c) 2020 Matt Jones
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy
67
of this software and associated documentation files (the "Software"), to deal

Makefile

+21-50
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44
# MIT License
55
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
66
#
7-
# version 0.1.23
7+
# version 0.1.24
88
#
99
SHELL = /bin/bash
1010

11-
# TODO: document Makefile
12-
13-
1411
.PHONY: all build clean coverage help install package pretty test
1512

1613
# The name of the binary to build
@@ -23,64 +20,39 @@ endif
2320
# Ex: windows, darwin, linux
2421
#
2522
ifndef target_os
26-
#target_os = linux
27-
ifeq ($(OS),Windows_NT)
28-
target_os = windows
29-
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
30-
target_arch = amd64
31-
else
32-
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
33-
target_arch = amd64
34-
endif
35-
36-
#ifeq ($(PROCESSOR_ARCHITECTURE),x86)
37-
# target_arch = 386
38-
#endif
39-
endif
40-
else
41-
UNAME_S := $(shell uname -s)
42-
ifeq ($(UNAME_S),Linux)
43-
target_os = linux
44-
endif
45-
46-
ifeq ($(UNAME_S),Darwin)
47-
target_os = darwin
48-
endif
49-
UNAME_P := $(shell uname -p)
50-
51-
ifeq ($(UNAME_P),x86_64)
52-
target_arch = amd64
53-
endif
54-
55-
#ifneq ($(filter %86,$(UNAME_P)),)
56-
# target_arch = 386
57-
#endif
23+
UNAME_S := $(shell uname -s)
24+
ifeq ($(UNAME_S),Linux)
25+
target_os = linux
26+
endif
27+
ifeq ($(UNAME_S),Darwin)
28+
target_os = darwin
29+
endif
30+
UNAME_P := $(shell uname -p)
31+
32+
ifeq ($(UNAME_P),x86_64)
33+
target_arch = amd64
5834
endif
5935
endif
6036

6137
ifeq ($(target_os),windows)
6238
target_ext = .exe
6339
endif
6440

65-
# Set the target arch
66-
# Ex: amd64, x86_64
67-
#
6841
ifndef target_arch
69-
target_arch = amd64
42+
target_arch = amd64
7043
endif
7144

7245

7346
all: pretty clean build
7447

75-
# TODO: need to add pretty back in when I figure out how
7648
build: prep
7749
@GOOS=$(target_os) GOARCH=$(target_arch) go build -o ./bin/$(pkg)-$(target_os)
7850

7951
release: prep
8052
@GOOS=$(target_os) GOARCH=$(target_arch) go build -ldflags="-s -w" -o ./bin/$(pkg)$(target_ext)
8153

8254
clean:
83-
@rm -rf ./bin ./rules
55+
@rm -rf ./bin
8456

8557
# TODO: write help command for Makefile
8658
# TODO: documentation
@@ -91,17 +63,16 @@ install: pretty
9163

9264
package: test clean build
9365

66+
# TODO set a flag to allow the updating of the packages at build time
9467
prep:
95-
@go get -u
68+
@go get
69+
9670

9771
pretty:
98-
@golint *.go
99-
@golint core/*.go
100-
@gofmt -w *.go
101-
@gofmt -w core/*.go
102-
@go vet *.go
103-
@go vet core/*.go
72+
@golint ./...
73+
@go fmt ./...
74+
@go vet ./...
10475

10576
test: pretty
106-
@cd ./$(pkg) && go test -cover
77+
@cd ./...$(pkg) && go test -cover
10778

README.md

+90-63
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,125 @@
11
<p align="center">
2-
<img src="https://github.com/michenriksen/gitrob/raw/master/static/images/gopher_full.png" alt="Gitrob" width="200" />
2+
<img src="./static/images/gopher_full.png" alt="Gitrob" width="200" />
33
</p>
4-
<br />
5-
<br />
6-
<br />
74

8-
# Gitrob: Putting the Open Source in OSINT
5+
# Wraith: Putting the Open Source in OSINT
96
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/mattyjones/gitrob)![GitHub release (latest by date)](https://img.shields.io/github/v/release/mattyjones/gitrob)![GitHub](https://img.shields.io/github/license/mattyjones/gitrob)
107

118
![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/mattyjones/gitrob)![Code Climate technical debt](https://img.shields.io/codeclimate/tech-debt/mattyjones/gitrob)![Code Climate issues](https://img.shields.io/codeclimate/issues/mattyjones/gitrob)
129

1310
[![Build Status](https://travis-ci.org/mattyjones/gitrob.svg?branch=master)](https://travis-ci.org/mattyjones/gitrob)
1411

15-
Gitrob is a tool to help find potentially sensitive files pushed to public repositories on Github. Gitrob will clone repositories belonging to a user or organization down to a configurable depth and iterate through the commit history and flag files that match signatures for potentially sensitive files. The findings will be presented through a web interface for easy browsing and analysis.
1612

17-
## Usage
13+
Wraith is a tool to help find potentially sensitive information pushed to repositories on GitLab or Github. Wraith will clone repositories belonging to a user or group/organization down to a configurable depth and iterate through the commit history and flag files and/or commit content that match signatures for potentially sensitive information. The findings will be presented through a web interface for easy browsing and analysis.
1814

19-
gitrob [options] target [target2] ... [targetN]
15+
## Features
2016

21-
### Options
17+
- Scan the following sources:
18+
- Gitlab repositories
19+
- Github.com repositories
20+
- Local git repos
21+
- Exclude files, paths, and extensions
22+
- Web interface for real-time results
23+
- Configurable commit depth
24+
- Use environment variables, a config file, or flags
25+
- Uses sub-commands for easier, more modular, functionality
26+
- Clone a repo to memory instead of disk
2227

23-
```
24-
-bind-address string
25-
Address to bind web server to (default "127.0.0.1")
26-
-commit-depth int
27-
Number of repository commits to process (default 500)
28-
-debug
29-
Print debugging information
30-
-enterprise-upload-url string
31-
Upload URL for Github Enterprise (defaults to the URL set in -enterprise-url if any)
32-
-enterprise-url string
33-
URL for Github Enterprise
34-
-enterprise-user string
35-
Username for Github Enterprise (defaults to first target)
36-
-github-access-token string
37-
GitHub access token to use for API requests
38-
-include-forks
39-
Include forked repositories in scan
40-
-load string
41-
Load session file
42-
-no-expand-orgs
43-
Don't add members to targets when processing organizations
44-
-no-server
45-
Disables web server
46-
-port int
47-
Port to run web server on (default 9393)
48-
-save string
49-
Save session to file
50-
-silent
51-
Suppress all output except for errors
52-
-threads int
53-
Number of concurrent threads (default number of logical CPUs)
54-
-gather-all
55-
Specify whether to pull all repositories from the domain
28+
This currently in beta, check the [roadmap][1] for planned functionality
29+
30+
## Usage
31+
32+
For a full list of use cases and configuration options use the included help functionality.
33+
34+
`gitrob --help`
35+
36+
37+
## Configuration
38+
39+
**IMPORTANT** If you are targeting a GitLab group, please give the **group ID** as the target argument. You can find the group ID just below the group name in the GitLab UI. Otherwise, names with suffice for the target arguments. This id can be found on the group homepage.
40+
41+
There are multiple was to configure the tool for a scan. The easiest way is via commandline flags. To get a full list of available flags and their purpose use `gitrob <subcommand> --help`. This will pring out a list of flags and how they interact with the base scan. You can also set all flags as environment variables or use a static config file in YAML format. This config file can be used to store targets for multiple scan targets.
42+
43+
The order of precendence with each item taking precedence over the item below it is:
44+
45+
- explicit call to Set
46+
- commandline flag
47+
- environment variable
48+
- configuration file
49+
- key/value store
50+
- default value
51+
52+
The various values are configured independently of each other so if you set all values in a config file, you can then override just the ones you want on the commandline. A sample config file looks like:
53+
54+
```yaml
55+
---
56+
commit-depth: 0
57+
gitlab-targets:
58+
- codeemitter
59+
- mattyjones1
60+
- 8692959
61+
silent: false
62+
debug: true
63+
gitlab-api-token: <token>
64+
github-api-token: <token>
65+
github-targets:
66+
- mattyjones
67+
- phantomSecrets
68+
ignore-path:
69+
- cmd/
70+
- docs/
71+
ignore-extension:
72+
- .go
73+
- .log
74+
in-mem-clone: true
75+
repo-dirs:
76+
- ../../../mattyjones/telegraf
5677
```
5778
58-
### Saving session to a file
79+
## Examples
5980
60-
By default, gitrob will store its state for an assessment in memory. This means that the results of an assessment is lost when Gitrob is closed. You can save the session to a file by using the `-save` option:
81+
Scan a GitLab group assuming your access token has been added to the environment variable or a config file. Look for file signature matches only:
6182
62-
gitrob -save ~/gitrob-session.json acmecorp
83+
gitrob scanGitlab <gitlab_group_id>
6384
64-
Gitrob will save all the gathered information to the specified file path as a special JSON document. The file can be loaded again for browsing at another point in time, shared with other analysts or parsed for custom integrations with other tools and systems.
85+
Scan a multiple GitLab groups assuming your access token has been added to the environment variable or a config file. Clone repositories into memory for faster analysis. Set the scan mode to 2 to scan each file match for a content match before creating a result.:
6586
66-
### Loading session from a file
87+
gitrob scanGitlab -in-mem-clone -mode 2 "<gitlab_group_id_1> <gitlab_group_id_2>"
6788
68-
A session stored in a file can be loaded with the `-load` option:
89+
Scan a GitLab groups assuming your access token has been added to the environment variable or a config file. Clone repositories into memory for faster analysis. Set the scan mode to 3 to scan each commit for content matches only.:
6990
70-
gitrob -load ~/gitrob-session.json
91+
gitrob scanGitlab -in-mem-clone -mode 3 "<gitlab_group_id>"
7192
72-
Gitrob will start its web interface and serve the results for analysis.
93+
Scan a Github user setting your Github access token as a parameter. Clone repositories into memory for faster analysis.
7394
74-
### Use with Github Enterprise
95+
gitrob scangithub -github-access-token <token> -in-mem-clone "<github_user_name>"
7596
76-
To configure Gitrob for Github Enterprise, the following switches can be used:
97+
### Editing File and Content Regular Expressions
7798
78-
- `enterprise-url`: Must be specified; this is the URL where the path `/api/v3/` exists. This is usually the URL where the Github web interface can be found. Example: `-enterprise-url=https://github.yourcompany.com`
79-
- `enterprise-upload-url:` Optional, defaults to `enterprise-url`; full path to the upload URL if different from the main Github Enterprise URL. Example: `-enterprise-upload-url=https://github.yourcompany.com/api/v3/upload`
80-
- `enterprise-user`: Optional, defaults to the first target. Example: `-enterprise-user=your.username`
99+
Regular expressions are included in the [filesignatures.json](./rules/filesignatures.json) and [contentsignatures.json](./rules/contentsignatures.json) files respectively. Edit these files to adjust your scope and fine-tune your results.
100+
101+
Gitrob will start its web interface and serve the results for analysis.
81102
82103
## Installation
83104
84-
A [precompiled version is available](https://github.com/michenriksen/gitrob/releases) for each release, alternatively you can use the latest version of the source code from this repository in order to build your own binary.
105+
At this stage the only option is to build from source from this repository.
85106
86-
Make sure you have a correctly configured **Go >= 1.11** environment and that `$GOPATH/bin` is in your `$PATH`
107+
To install from source, make sure you have a correctly configured **Go >= 1.14** environment and that `$GOPATH/bin` is in your `$PATH`.
87108

88-
$ go get github.com/michenriksen/gitrob
109+
$ git clone [email protected]:mattyjones1/gitrob.git
110+
$ cd ~/go/src/gitrob
111+
$ make build
112+
$ ./bin/gitrob-<ARCH> <sub-command>
113+
114+
In the future there will be binary releases of the code
89115

90-
This command will download gitrob, install its dependencies, compile it and move the `gitrob` executable to `$GOPATH/bin`.
116+
## Access Tokens
91117

92-
### Github access token
118+
Gitrob will need either a GitLab or Github access token in order to interact with the appropriate API. You can create a [GitLab personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html), or [a Github personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) and save it in an environment variable in your `.bashrc` or similar shell configuration file:
93119

94-
Gitrob will need a Github access token in order to interact with the Github API. [Create a personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) and save it in an environment variable in your `.bashrc` or similar shell configuration file:
120+
export GITROB_GITLAB_ACCESS_TOKEN=deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
121+
export GITROB_GITHUB_ACCESS_TOKEN=deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
95122

96-
export GITROB_ACCESS_TOKEN=deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
123+
Alternatively you can specify the access token with the `-gitlab-access-token` or `-github-access-token` option on the command line, but watch out for your command history! A configuration file can also be used, an example is provided above.
97124

98-
Alternatively you can specify the access token with the `-github-access-token` option, but watch out for your command history!
125+
[1]: docs/development/roadmap.md

Security.txt

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
If the issues is non-critical then open an issue on Github with
2+
* a full explanation of the issue
3+
* what versions it applies to
4+
* any third-party libraries it may effect
5+
6+
If the matter is critical send any details to urlugalATgmail using the following key if necessary
7+
8+
-----BEGIN PGP PUBLIC KEY BLOCK-----
9+
10+
mQENBF8fi7oBCADl862/KBPZFRb1A4t8b38BDY7juQ4Xj/gEgPSQ2GcqOvnBa+mX
11+
tCsKimanAGNiS8c2TtSDCejgggBWqKF7GgR1XP5a8a60PDWpsXZn2duzABeEOYhc
12+
qWHmmJTTgi3K7+gd+VSDK3rfXmWf6oSQIE/q03/fQJGphVTaQQfdXvfp+m3rwl9U
13+
A6EtIaNLyIn7LC6oBXGKGZnFx4MeZCfrPOF5GHvMq0bt0LQ4N46hkMK0oo+9eFb5
14+
LEvvOWbDQthpUBA12a/3Sw+XwlbowqnT5vxiCMDsehrEgENeZZ8zS8tY+YBtrt+R
15+
J+DZg4EtxS4cGDYlopntlXXMvmbCfYGBaOMXABEBAAG0Hk1hdHQgSm9uZXMgPHVy
16+
bHVnYWxAZ21haWwuY29tPokBTgQTAQgAOBYhBDJRM9sNhtVxJYvvU+2gu2mdq3WU
17+
BQJfH4u6AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEO2gu2mdq3WUsHAH
18+
/1BvzYOkOUdd3WIN9XaUlOctqzhGn4r6Wcj+K6zpZBrbnf6lemNvK4czdBhyl7KK
19+
YWNR5Lv3h2CHzxZPswcud+BjrAlDq77ZGjp3lqWyysJXKit5bEMxWqKMU6JSpD3j
20+
vO4j3oDard9qTcbApG87iGGQalHjk/IqeicChp/WwGb0GFm7brZDMlRO8JZ5yWHH
21+
KpMP8IAO/wQhZ9VFn1Zw02JVViHrBB83Cwbf1c3RFb61gs5V1Z+9t0v9Hto8IChD
22+
2xsBt2nqnpqOPagSwSdk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