|
| 1 | +<h1 align="center"> |
| 2 | + gitrepoenum |
| 3 | + <br> |
| 4 | +</h1> |
| 5 | +<h4 align="center">Download all github repositories of a org, user, fetch all member of a org, then Find leaked credentials.</h4> |
| 6 | + |
| 7 | +<p align="center"> |
| 8 | + <a href="https://pkg.go.dev/github.com/rix4uni/gitrepoenum"><img src="https://pkg.go.dev/badge/github.com/rix4uni/gitrepoenum.svg"></a> |
| 9 | + <a href="https://github.com/R0X4R/Pinaak/issues"><img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat"></a> |
| 10 | + <a href="https://goreportcard.com/report/github.com/rix4uni/gitrepoenum"><img src="https://goreportcard.com/badge/github.com/rix4uni/gitrepoenum"></a> |
| 11 | + <a href="https://github.com/rix4uni/gitrepoenum/blob/master/LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg"></a> |
| 12 | + <a href="https://twitter.com/rix4uni"><img src="https://img.shields.io/badge/twitter-%40rix4uni-blue.svg"></a> |
| 13 | +</p> |
| 14 | + |
| 15 | +<p align="center"> |
| 16 | + <a href="#installation">Installation</a> • |
| 17 | + <a href="#usage">Usage</a> • |
| 18 | + <a href="#workflow">Workflow</a> |
| 19 | +</p> |
| 20 | + |
| 21 | +## Installation |
| 22 | +``` |
| 23 | +go install github.com/rix4uni/gitrepoenum@latest |
| 24 | +``` |
| 25 | + |
| 26 | +## Download prebuilt binaries |
| 27 | +``` |
| 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 |
| 31 | +mv gitrepoenum ~/go/bin/gitrepoenum |
| 32 | +``` |
| 33 | +Or download [binary release](https://github.com/rix4uni/gitrepoenum/releases) for your platform. |
| 34 | + |
| 35 | +## Compile from source |
| 36 | +``` |
| 37 | +git clone --depth 1 github.com/rix4uni/gitrepoenum.git |
| 38 | +cd gitrepoenum; go install |
| 39 | +``` |
| 40 | + |
| 41 | +## Usage |
| 42 | +```console |
| 43 | +go run main.go -h |
| 44 | + |
| 45 | + _ __ |
| 46 | + ____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___ |
| 47 | + / __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \ |
| 48 | + / /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / / |
| 49 | + \__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/ |
| 50 | +/____/ /_/ |
| 51 | + Current gitrepoenum version v0.0.1 |
| 52 | + |
| 53 | +A longer description that spans multiple lines and likely contains |
| 54 | +examples and usage of using your application. For example: |
| 55 | + |
| 56 | +Cobra is a CLI library for Go that empowers applications. |
| 57 | +This application is a tool to generate the needed files |
| 58 | +to quickly create a Cobra application. |
| 59 | + |
| 60 | +Usage: |
| 61 | + gitrepoenum [flags] |
| 62 | + gitrepoenum [command] |
| 63 | + |
| 64 | +Available Commands: |
| 65 | + code Fetch code from multiple commits |
| 66 | + commit Show commit logs |
| 67 | + completion Generate the autocompletion script for the specified shell |
| 68 | + download Clone Git repositories with a custom directory name and parallel option |
| 69 | + help Help about any command |
| 70 | + member Fetch GitHub member name of a single ORG or multiple ORGS using a list of orgnames |
| 71 | + org Fetch GitHub repositories of a single ORG or multiple ORGS using a list of orgnames |
| 72 | + user Fetch GitHub repositories of a single USER or multiple USERS using a list of usernames |
| 73 | + vuln Scan repositories for vulnerabilities using TruffleHog |
| 74 | + |
| 75 | +Flags: |
| 76 | + -h, --help help for gitrepoenum |
| 77 | + -u, --update update gitrepoenum to latest version |
| 78 | + -v, --version Print the version of the tool and exit. |
| 79 | + |
| 80 | +Use "gitrepoenum [command] --help" for more information about a command. |
| 81 | +``` |
| 82 | + |
| 83 | +## Usage Examples |
| 84 | + |
| 85 | +<details> |
| 86 | + <summary> |
| 87 | + <b>gitrepoenum org -h</b> |
| 88 | + </summary> |
| 89 | + |
| 90 | +``` |
| 91 | +go run main.go org -h |
| 92 | +
|
| 93 | + _ __ |
| 94 | + ____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___ |
| 95 | + / __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \ |
| 96 | + / /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / / |
| 97 | + \__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/ |
| 98 | +/____/ /_/ |
| 99 | + Current gitrepoenum version v0.0.1 |
| 100 | +
|
| 101 | +Examples: |
| 102 | +$ echo "IBM" | gitrepoenum org -c -o output.json |
| 103 | +$ cat orgnames.txt | gitrepoenum org -c -o output.json |
| 104 | +$ echo "IBM" | gitrepoenum org --delay 1ns |
| 105 | +$ echo "IBM" | gitrepoenum org --config custompath/config.yaml -t custompath/github-token.txt |
| 106 | +
|
| 107 | +Usage: |
| 108 | + gitrepoenum org [flags] |
| 109 | +
|
| 110 | +Flags: |
| 111 | + --config string path to the config.yaml file (default "$HOME/.config/gitrepoenum/config.yaml") |
| 112 | + -c, --custom-field Custom Fields JSON output |
| 113 | + --delay string Delay duration between requests (e.g., 1ns, 1us, 1ms, 1s, 1m) (default "-1ns") |
| 114 | + -h, --help help for org |
| 115 | + -o, --output string File to save the output. |
| 116 | + -t, --token string Path to the file containing GitHub tokens, 1 token per line (default "$HOME/.config/gitrepoenum/github-token.txt") |
| 117 | +``` |
| 118 | +</details> |
| 119 | + |
| 120 | +<details> |
| 121 | + <summary> |
| 122 | + <b>gitrepoenum member -h</b> |
| 123 | + </summary> |
| 124 | + |
| 125 | +``` |
| 126 | +go run main.go member -h |
| 127 | +
|
| 128 | + _ __ |
| 129 | + ____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___ |
| 130 | + / __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \ |
| 131 | + / /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / / |
| 132 | + \__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/ |
| 133 | +/____/ /_/ |
| 134 | + Current gitrepoenum version v0.0.1 |
| 135 | +
|
| 136 | +Examples: |
| 137 | +$ echo "IBM" | gitrepoenum member -c -o output.json |
| 138 | +$ cat orgnames.txt | gitrepoenum member -c -o output.json |
| 139 | +$ echo "IBM" | gitrepoenum member --delay 1ns |
| 140 | +$ echo "IBM" | gitrepoenum member --config custompath/config.yaml -t custompath/github-token.txt |
| 141 | +
|
| 142 | +Usage: |
| 143 | + gitrepoenum member [flags] |
| 144 | +
|
| 145 | +Flags: |
| 146 | + --config string path to the config.yaml file (default "$HOME/.config/gitrepoenum/config.yaml") |
| 147 | + -c, --custom-field Custom Fields JSON output |
| 148 | + --delay string Delay duration between requests (e.g., 1ns, 1us, 1ms, 1s, 1m) (default "-1ns") |
| 149 | + -h, --help help for member |
| 150 | + -o, --output string File to save the output. |
| 151 | + -t, --token string Path to the file containing GitHub tokens, 1 token per line (default "$HOME/.config/gitrepoenum/github-token.txt") |
| 152 | +``` |
| 153 | +</details> |
| 154 | + |
| 155 | +<details> |
| 156 | + <summary> |
| 157 | + <b>gitrepoenum user -h</b> |
| 158 | + </summary> |
| 159 | + |
| 160 | +``` |
| 161 | +go run main.go user -h |
| 162 | +
|
| 163 | + _ __ |
| 164 | + ____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___ |
| 165 | + / __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \ |
| 166 | + / /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / / |
| 167 | + \__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/ |
| 168 | +/____/ /_/ |
| 169 | + Current gitrepoenum version v0.0.1 |
| 170 | +
|
| 171 | +Fetch GitHub repositories of a single USER or multiple USERS using a list of usernames |
| 172 | +
|
| 173 | +Examples: |
| 174 | +$ echo "rix4uni" | gitrepoenum user -c -o output.json |
| 175 | +$ cat usernames.txt | gitrepoenum user -c -o output.json |
| 176 | +$ echo "rix4uni" | gitrepoenum user --delay 1ns |
| 177 | +$ echo "rix4uni" | gitrepoenum user --config custompath/config.yaml -t custompath/github-token.txt |
| 178 | +
|
| 179 | +Usage: |
| 180 | + gitrepoenum user [flags] |
| 181 | +
|
| 182 | +Flags: |
| 183 | + --config string path to the config.yaml file (default "$HOME/.config/gitrepoenum/config.yaml") |
| 184 | + -c, --custom-field Custom Fields JSON output |
| 185 | + --delay string Delay duration between requests (e.g., 1ns, 1us, 1ms, 1s, 1m) (default "-1ns") |
| 186 | + -h, --help help for user |
| 187 | + -o, --output string File to save the output. |
| 188 | + -t, --token string Path to the file containing GitHub tokens, 1 token per line (default "$HOME/.config/gitrepoenum/github-token.txt") |
| 189 | +``` |
| 190 | +</details> |
| 191 | + |
| 192 | +<details> |
| 193 | + <summary> |
| 194 | + <b>gitrepoenum download -h</b> |
| 195 | + </summary> |
| 196 | + |
| 197 | +``` |
| 198 | +go run main.go download -h |
| 199 | +
|
| 200 | + _ __ |
| 201 | + ____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___ |
| 202 | + / __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \ |
| 203 | + / /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / / |
| 204 | + \__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/ |
| 205 | +/____/ /_/ |
| 206 | + Current gitrepoenum version v0.0.1 |
| 207 | +
|
| 208 | +Clone Git repositories and customize the directory name to username-repositoryname with an option to clone in parallel. |
| 209 | +
|
| 210 | +Examples: |
| 211 | +$ echo "https://github.com/rix4uni/gitrepoenum.git" | gitrepoenum download |
| 212 | +$ cat reponames.txt | gitrepoenum download |
| 213 | +$ cat reponames.txt | gitrepoenum download -o ~/allgithubrepo/download |
| 214 | +$ cat reponames.txt | gitrepoenum download -p 100 |
| 215 | +$ cat reponames.txt | gitrepoenum download -d 1 |
| 216 | +
|
| 217 | +Usage: |
| 218 | + gitrepoenum download [flags] |
| 219 | +
|
| 220 | +Flags: |
| 221 | + -d, --depth int Create a shallow clone with a history truncated to the specified number of commits, use -d 0 if you want all commits (default 1) |
| 222 | + -h, --help help for download |
| 223 | + -o, --output-directory string Directory to clone the repositories into (default "/root/allgithubrepo/download") |
| 224 | + -p, --parallel int Number of repositories to clone in parallel (default 10) |
| 225 | +``` |
| 226 | +</details> |
| 227 | + |
| 228 | +<details> |
| 229 | + <summary> |
| 230 | + <b>gitrepoenum commit -h</b> |
| 231 | + </summary> |
| 232 | + |
| 233 | +``` |
| 234 | +go run main.go commit -h |
| 235 | +
|
| 236 | + _ __ |
| 237 | + ____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___ |
| 238 | + / __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \ |
| 239 | + / /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / / |
| 240 | + \__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/ |
| 241 | +/____/ /_/ |
| 242 | + Current gitrepoenum version v0.0.1 |
| 243 | +
|
| 244 | +This command retrieves git commit logs based on date and time parameters. |
| 245 | +
|
| 246 | +Examples: |
| 247 | +$ gitrepoenum commit -i ~/allgithubrepo/download -d 50s -t before -o ~/allgithubrepo/commits |
| 248 | +$ gitrepoenum commit -i ~/allgithubrepo/download -d 5h -t before -o ~/allgithubrepo/commits |
| 249 | +$ gitrepoenum commit -i ~/allgithubrepo/download -d 1d -t after -o ~/allgithubrepo/commits |
| 250 | +$ gitrepoenum commit -i ~/allgithubrepo/download -d all -o ~/allgithubrepo/commits |
| 251 | +
|
| 252 | +Date Options: |
| 253 | +50s # 50 seconds |
| 254 | +40m # 40 minutes |
| 255 | +5h # 5 hours |
| 256 | +1d # 1 day |
| 257 | +2w # 2 weeks |
| 258 | +3M # 3 months |
| 259 | +1y # 1 year |
| 260 | +all # All commits |
| 261 | +
|
| 262 | +Usage: |
| 263 | + gitrepoenum commit [input] [flags] |
| 264 | +
|
| 265 | +Flags: |
| 266 | + -d, --date string Specify the date range for the commits (e.g., 50s, 40m, 5h, 1d, 2w, 3M, 1y, all) (default "all") |
| 267 | + -h, --help help for commit |
| 268 | + -i, --input string Specify the input directory containing Git repositories (default "/root/allgithubrepo/download") |
| 269 | + -o, --output string Specify the output directory for commit logs (default "/root/allgithubrepo/commits") |
| 270 | + -t, --time string Specify 'before' or 'after' the given date |
| 271 | +``` |
| 272 | +</details> |
| 273 | + |
| 274 | +<details> |
| 275 | + <summary> |
| 276 | + <b>gitrepoenum code -h</b> |
| 277 | + </summary> |
| 278 | + |
| 279 | +``` |
| 280 | +go run main.go code -h |
| 281 | +
|
| 282 | + _ __ |
| 283 | + ____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___ |
| 284 | + / __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \ |
| 285 | + / /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / / |
| 286 | + \__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/ |
| 287 | +/____/ /_/ |
| 288 | + Current gitrepoenum version v0.0.1 |
| 289 | +
|
| 290 | +This command fetches code from multiple commits based on a list in commits.txt for each repository. |
| 291 | +
|
| 292 | +Examples: |
| 293 | +$ gitrepoenum code -i ~/allgithubrepo/download -o ~/allgithubrepo/commits |
| 294 | +
|
| 295 | +Usage: |
| 296 | + gitrepoenum code [flags] |
| 297 | +
|
| 298 | +Flags: |
| 299 | + -h, --help help for code |
| 300 | + -i, --input string Specify the input directory containing Git repositories (default "/root/allgithubrepo/download") |
| 301 | + -o, --output string Specify the output directory for storing commit code (default "/root/allgithubrepo/commits") |
| 302 | +``` |
| 303 | +</details> |
| 304 | + |
| 305 | +<details> |
| 306 | + <summary> |
| 307 | + <b>gitrepoenum vuln -h</b> |
| 308 | + </summary> |
| 309 | + |
| 310 | +``` |
| 311 | +go run main.go vuln -h |
| 312 | +
|
| 313 | + _ __ |
| 314 | + ____ _ (_)/ /_ _____ ___ ____ ____ ___ ____ __ __ ____ ___ |
| 315 | + / __ // // __// ___// _ \ / __ \ / __ \ / _ \ / __ \ / / / // __ __ \ |
| 316 | + / /_/ // // /_ / / / __// /_/ // /_/ // __// / / // /_/ // / / / / / |
| 317 | + \__, //_/ \__//_/ \___// .___/ \____/ \___//_/ /_/ \__,_//_/ /_/ /_/ |
| 318 | +/____/ /_/ |
| 319 | + Current gitrepoenum version v0.0.1 |
| 320 | +
|
| 321 | +This command scans multiple repositories for vulnerabilities using TruffleHog |
| 322 | +and saves the results in the specified output directory. |
| 323 | +
|
| 324 | +Examples: |
| 325 | +$ gitrepoenum vuln |
| 326 | +$ gitrepoenum vuln -i ~/allgithubrepo/commits -o ~/allgithubrepo/commits |
| 327 | +
|
| 328 | +Usage: |
| 329 | + gitrepoenum vuln [flags] |
| 330 | +
|
| 331 | +Flags: |
| 332 | + -h, --help help for vuln |
| 333 | + -i, --input string Input directory containing repositories code (default "/root/allgithubrepo/commits") |
| 334 | + -o, --output string Output directory for vulnerability reports (default "/root/allgithubrepo/commits") |
| 335 | +``` |
| 336 | +</details> |
| 337 | + |
| 338 | +## Demo |
| 339 | +[asciinema Link](https://asciinema.org/~rix4uni) |
| 340 | + |
| 341 | +## Workflow |
| 342 | +<p align="center"> |
| 343 | +<a href="Workflow/gitrepoenum.png" target="_blank"> |
| 344 | +<img src="Workflow/gitrepoenum.png"/> |
| 345 | +</a> |
| 346 | +</p> |
| 347 | + |
| 348 | +## TODO |
| 349 | + |
| 350 | + |
| 351 | +## License |
| 352 | +This tool is open source and available under the [MIT License](/LICENSE). |
0 commit comments