Skip to main content

This is a multiple threads tool to download the `.git` folder and rebuild git repository locally.

Project description

GitHacker

Desciption

This is a multiple threads tool to detect whether a site has the .git folder leakage vulnerability. It is able to download the target .git folder almost completely. This tool also works when the DirectoryListings feature is disabled. It is worth mentioning that this tool will download almost all files of the target git repository and then rebuild them locally, which makes this tool State of the art in this area. For example, tools like [githack] just simply restore the latest version. With GitHacker's help, you can view the developer's commit history, which makes a better understanding of the character and psychology of developers, so as to lay the foundation for further code audition.

PROCLAMATION (IMPORTANT)

Several VULNERABILITIES have been reported recently, if you are using GitHacker <= 1.1.0, please update your tool as soon as possible.

The remote .git folder maybe malicious, so to prevent you from being attacked. I highly recommend you run this tool under a disposable jailed environment (eg: docker container).

Security Issues

2021-08-01 Fixed: Malicious .git folder maybe harmful to the user of this tool (Reported by Driver Tom)

2022-03-01 Fixed: Arbitrary file write via recursive file downloader (Reported by Justin Steven)

  • The analysis is to be released.

2022-03-01 Fixed: Remote Code Execution via malicious .git/config and .git/hooks/* files (Reported by Justin Steven)

  • The analysis is to be released.

Comparison of other tools

2021-05-25

Tools Index Source Code Reflogs Stashes Commits Branches Remotes Tags
GitTools :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x: :heavy_check_mark: :x: :heavy_check_mark: :x:
dvcs-ripper :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x: :heavy_check_mark: :x: :heavy_check_mark: :x:
GitHack :heavy_check_mark: :heavy_check_mark: :x: :x: :x: :x: :x: :x:
git-dumper :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
GitHacker :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
GitTools :x: :heavy_check_mark: :heavy_check_mark: :x: :heavy_check_mark: :x: :heavy_check_mark: :x:
dvcs-ripper :x: :x: :x: :x: :x: :x: :x: :x:
GitHack :x: :heavy_check_mark: :x: :x: :x: :x: :x: :x:
git-dumper :x: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :x: :heavy_check_mark: :x:
GitHacker :x: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :muscle: :heavy_check_mark: :muscle:

Requirments

  • git >= 2.11.0
  • Python 3

Installation

pip3 install GitHacker

Usage

# quick start
githacker --url http://127.0.0.1/.git/ --output-folder result
# brute for the name of branchs / tags
githacker --brute --url http://127.0.0.1/.git/ --output-folder result

Example

Demo

TODO

  • Publish Docker image to hub.docker.com
  • Add Dockerfile
  • Fix stash files missing due to the fix of #21 (git clone can't download stash files)
  • Fix infinit downloading 404 files
  • Use python f'string in test.py
  • Download packed files firstly (Unsolvable via StackOverflow)
  • Download tags and branches when Index enabled
  • Try common tags and branches when Index disabled
  • find packed refs

Videos

asciinema

asciicast

YouTube

References

Acknowledgement

Licsence

THE DRINKWARE LICENSE

<wangyihanger@gmail.com> wrote this file. As long as 
you retain this :x:tice you can do whatever you want 
with this stuff. If we meet some day, and you think 
this stuff is worth it, you can buy me the following
drink(s) in return.

Red Bull
JDB
Coffee
Sprite
Cola
Harbin Beer
etc

Wang Yihang

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

GitHacker-1.1.1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

GitHacker-1.1.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file GitHacker-1.1.1.tar.gz.

File metadata

  • Download URL: GitHacker-1.1.1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.5.0 pkginfo/1.8.2 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.10

File hashes

Hashes for GitHacker-1.1.1.tar.gz
Algorithm Hash digest
SHA256 16a568124ce83b8dd19af8d49b7b10e6d4b529cc775cd42ebf9ab72585b26575
MD5 449efb30c582a49641fb681b98724d38
BLAKE2b-256 335f635d0d337ce77b609b5507909c3d51d4ea91364c2a1352fc23b3d2daeacc

See more details on using hashes here.

File details

Details for the file GitHacker-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: GitHacker-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.5.0 pkginfo/1.8.2 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.10

File hashes

Hashes for GitHacker-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cb31493f75c85c8e3f2217227c95808ab8e4e58d280221d5a00f60d29c97da6f
MD5 1519c37966a1a967b00d8182da33790f
BLAKE2b-256 9963c8286df9895a931303a025b0064abd4d02c81c37aa86c69d81e852c55135

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page