Skip to content

Commit 87a1a4a

Browse files
committed
Added v0.0.2
1 parent f35176f commit 87a1a4a

File tree

4 files changed

+920
-50
lines changed

4 files changed

+920
-50
lines changed

README.md

Lines changed: 84 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ go install github.com/rix4uni/gitrepoenum@latest
2525

2626
## Download prebuilt binaries
2727
```
28-
wget https://github.com/rix4uni/gitrepoenum/releases/download/v0.0.1/gitrepoenum-linux-amd64-0.0.1.tgz
29-
tar -xvzf gitrepoenum-linux-amd64-0.0.1.tgz
30-
rm -rf gitrepoenum-linux-amd64-0.0.1.tgz
28+
wget https://github.com/rix4uni/gitrepoenum/releases/download/v0.0.2/gitrepoenum-linux-amd64-0.0.2.tgz
29+
tar -xvzf gitrepoenum-linux-amd64-0.0.2.tgz
30+
rm -rf gitrepoenum-linux-amd64-0.0.2.tgz
3131
mv gitrepoenum ~/go/bin/gitrepoenum
3232
```
3333
Or download [binary release](https://github.com/rix4uni/gitrepoenum/releases) for your platform.
@@ -39,16 +39,14 @@ cd gitrepoenum; go install
3939
```
4040

4141
## Usage
42-
```console
43-
go run main.go -h
44-
42+
```yaml
4543
_ __
4644
____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___
4745
/ __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \
4846
/ /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / /
4947
\__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/
5048
/____/ /_/
51-
Current gitrepoenum version v0.0.1
49+
Current gitrepoenum version v0.0.2
5250

5351
A longer description that spans multiple lines and likely contains
5452
examples and usage of using your application. For example:
@@ -87,16 +85,14 @@ Use "gitrepoenum [command] --help" for more information about a command.
8785
<b>gitrepoenum org -h</b>
8886
</summary>
8987

90-
```
91-
go run main.go org -h
92-
88+
```yaml
9389
_ __
9490
____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___
9591
/ __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \
9692
/ /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / /
9793
\__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/
9894
/____/ /_/
99-
Current gitrepoenum version v0.0.1
95+
Current gitrepoenum version v0.0.2
10096

10197
Examples:
10298
$ echo "IBM" | gitrepoenum org -c -o output.json
@@ -122,16 +118,14 @@ Flags:
122118
<b>gitrepoenum member -h</b>
123119
</summary>
124120

125-
```
126-
go run main.go member -h
127-
121+
```yaml
128122
_ __
129123
____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___
130124
/ __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \
131125
/ /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / /
132126
\__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/
133127
/____/ /_/
134-
Current gitrepoenum version v0.0.1
128+
Current gitrepoenum version v0.0.2
135129

136130
Examples:
137131
$ echo "IBM" | gitrepoenum member -c -o output.json
@@ -157,16 +151,14 @@ Flags:
157151
<b>gitrepoenum user -h</b>
158152
</summary>
159153

160-
```
161-
go run main.go user -h
162-
154+
```yaml
163155
_ __
164156
____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___
165157
/ __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \
166158
/ /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / /
167159
\__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/
168160
/____/ /_/
169-
Current gitrepoenum version v0.0.1
161+
Current gitrepoenum version v0.0.2
170162

171163
Fetch GitHub repositories of a single USER or multiple USERS using a list of usernames
172164

@@ -194,16 +186,14 @@ Flags:
194186
<b>gitrepoenum download -h</b>
195187
</summary>
196188

197-
```
198-
go run main.go download -h
199-
189+
```yaml
200190
_ __
201191
____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___
202192
/ __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \
203193
/ /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / /
204194
\__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/
205195
/____/ /_/
206-
Current gitrepoenum version v0.0.1
196+
Current gitrepoenum version v0.0.2
207197

208198
Clone Git repositories and customize the directory name to username-repositoryname with an option to clone in parallel.
209199

@@ -230,16 +220,14 @@ Flags:
230220
<b>gitrepoenum commit -h</b>
231221
</summary>
232222

233-
```
234-
go run main.go commit -h
235-
223+
```yaml
236224
_ __
237225
____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___
238226
/ __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \
239227
/ /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / /
240228
\__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/
241229
/____/ /_/
242-
Current gitrepoenum version v0.0.1
230+
Current gitrepoenum version v0.0.2
243231

244232
This command retrieves git commit logs based on date and time parameters.
245233

@@ -276,16 +264,14 @@ Flags:
276264
<b>gitrepoenum code -h</b>
277265
</summary>
278266

279-
```
280-
go run main.go code -h
281-
267+
```yaml
282268
_ __
283269
____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___
284270
/ __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \
285271
/ /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / /
286272
\__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/
287273
/____/ /_/
288-
Current gitrepoenum version v0.0.1
274+
Current gitrepoenum version v0.0.2
289275

290276
This command fetches code from multiple commits based on a list in commits.txt for each repository.
291277

@@ -307,16 +293,14 @@ Flags:
307293
<b>gitrepoenum vuln -h</b>
308294
</summary>
309295

310-
```
311-
go run main.go vuln -h
312-
296+
```yaml
313297
_ __
314298
____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___
315299
/ __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \
316300
/ /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / /
317301
\__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/
318302
/____/ /_/
319-
Current gitrepoenum version v0.0.1
303+
Current gitrepoenum version v0.0.2
320304

321305
This command scans multiple repositories for vulnerabilities using TruffleHog
322306
and saves the results in the specified output directory.
@@ -335,18 +319,76 @@ Flags:
335319
```
336320
</details>
337321

322+
<details>
323+
<summary>
324+
<b>gitrepoenum leaksmoniter -h</b>
325+
</summary>
326+
327+
```yaml
328+
_ __
329+
____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___
330+
/ __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \
331+
/ /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / /
332+
\__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/
333+
/____/ /_/
334+
Current gitrepoenum version v0.0.2
335+
336+
A comprehensive tool to monitor GitHub organizations, users, and members
337+
for potential leaks and vulnerabilities using trufflehog scanning.
338+
339+
Features:
340+
- Fetch repositories from organizations, users, and their members
341+
- Clone repositories with configurable depth and parallelism
342+
- Extract commits and code changes
343+
- Scan for vulnerabilities using trufflehog
344+
- Send notifications to Discord
345+
346+
Examples:
347+
# Complete automated workflow including vulnerability scanning
348+
echo "Shopify" | gitrepoenum leaksmoniter --scan-repo org --date 24h
349+
350+
# Scan individual user repositories
351+
echo "rix4uni" | gitrepoenum leaksmoniter --scan-repo user
352+
353+
# Scan both org and member repositories
354+
cat orgnames.txt | gitrepoenum leaksmoniter --scan-repo org,member
355+
356+
# With Discord notifications for vulnerabilities
357+
cat orgnames.txt | gitrepoenum leaksmoniter --scan-repo org,member --notifyid allvuln
358+
359+
# With custom base directory
360+
cat orgnames.txt | gitrepoenum leaksmoniter --scan-repo org --download-dir ~/myrepos
361+
362+
# High parallelism for faster cloning
363+
cat orgnames.txt | gitrepoenum leaksmoniter --parallel 20 --depth 10
364+
365+
# Scan recent repositories only (last 7 days)
366+
echo "google" | gitrepoenum leaksmoniter --scan-repo org --date 7d
367+
368+
# Comprehensive scan with all options
369+
echo "microsoft" | gitrepoenum leaksmoniter --scan-repo org,member,user --date 30d --parallel 15 --notifyid my-webhook
370+
371+
Usage:
372+
gitrepoenum leaksmoniter [flags]
373+
374+
Flags:
375+
-D, --date string Specify the date range for repositories (e.g., 50s, 40m, 5h, 1d, 2w, 3M, 1y, all) (default "24h")
376+
-d, --delay string Delay between requests (e.g., 1ns, 1us, 1ms, 1s, 1m) (default "-1ns")
377+
-z, --depth int Git clone depth (default 5)
378+
-o, --download-dir string Base directory for downloads, commits, code, and vulnerabilities
379+
-h, --help help for leaksmoniter
380+
-n, --notifyid string Send verified vulnerabilities to Discord (default "allvuln")
381+
-p, --parallel int Repositories to clone in parallel (default 10)
382+
-s, --scan-repo string Scan type: org, member, user (default "org,member")
383+
-t, --token string GitHub tokens file, 1 token per line (default "$HOME/.config/gitrepoenum/github-token.txt")
384+
```
385+
</details>
386+
338387
## Demo
339-
[asciinema Link](https://asciinema.org/~rix4uni)
340388

341389
## Workflow
342390
<p align="center">
343391
<a href="Workflow/gitrepoenum.png" target="_blank">
344392
<img src="Workflow/gitrepoenum.png"/>
345393
</a>
346394
</p>
347-
348-
## TODO
349-
350-
351-
## License
352-
This tool is open source and available under the [MIT License](/LICENSE).

banner/banner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
)
66

77
// prints the version message
8-
const version = "v0.0.1"
8+
const version = "v0.0.2"
99

1010
func PrintVersion() {
1111
fmt.Printf("Current gitrepoenum version %s\n", version)

cmd/download.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import (
1515

1616
// Define variables for directory, parallel, and depth flags
1717
var directory string
18-
var parallel int
19-
var depth int
18+
var downloadparallel int
19+
var downloaddepth int
2020

2121
// downloadCmd represents the download command
2222
var downloadCmd = &cobra.Command{
@@ -47,7 +47,7 @@ $ cat reponames.txt | gitrepoenum download -d 1`,
4747
}
4848

4949
// Create a semaphore channel to limit concurrent clones
50-
sem := make(chan struct{}, parallel)
50+
sem := make(chan struct{}, downloadparallel)
5151
var wg sync.WaitGroup
5252

5353
for _, url := range repoURLs {
@@ -89,8 +89,8 @@ $ cat reponames.txt | gitrepoenum download -d 1`,
8989

9090
// Execute the git clone command with the custom directory name and depth option
9191
cloneArgs := []string{"clone", url, dirName}
92-
if depth > 0 {
93-
cloneArgs = append(cloneArgs, "--depth", fmt.Sprintf("%d", depth))
92+
if downloaddepth > 0 {
93+
cloneArgs = append(cloneArgs, "--depth", fmt.Sprintf("%d", downloaddepth))
9494
}
9595
cloneCmd := exec.Command("git", cloneArgs...)
9696

@@ -117,6 +117,6 @@ func init() {
117117
rootCmd.AddCommand(downloadCmd)
118118

119119
downloadCmd.Flags().StringVarP(&directory, "output-directory", "o", filepath.Join(os.Getenv("HOME"), "allgithubrepo", "download"), "Directory to clone the repositories into")
120-
downloadCmd.Flags().IntVarP(&parallel, "parallel", "p", 10, "Number of repositories to clone in parallel")
121-
downloadCmd.Flags().IntVarP(&depth, "depth", "d", 0, "Create a shallow clone with a history truncated to the specified number of commits, use -d 1 if you want only latest commits")
120+
downloadCmd.Flags().IntVarP(&downloadparallel, "parallel", "p", 10, "Number of repositories to clone in parallel")
121+
downloadCmd.Flags().IntVarP(&downloaddepth, "depth", "d", 0, "Create a shallow clone with a history truncated to the specified number of commits, use -d 1 if you want only latest commits")
122122
}

0 commit comments

Comments
 (0)