Skip to content

Instantly share code, notes, and snippets.

@dhondta
Last active February 10, 2024 10:26
Show Gist options
  • Save dhondta/7511710facb5eecc575e133ec60ed87c to your computer and use it in GitHub Desktop.
Save dhondta/7511710facb5eecc575e133ec60ed87c to your computer and use it in GitHub Desktop.
Tinyscript tool for downloading the .git folder from a disclosed Web-hosted repository

Git Web Recovery

This is a small tool using Tinyscript and PyBots for downloading a .git folder left on a Web server. Note that this tool does NOT rely on Directory Indexing.

$ pip install pybots tinyscript
$ tsm install git-web-recovery

#!/usr/bin/env python
from pybots import GitRecoveryBot
from tinyscript import *
__author__ = "Alexandre D'Hondt"
__version__ = "1.2"
__copyright__ = ("A. D'Hondt", 2021)
__license__ = "gpl-3.0"
__examples__ = ["http://example.com/path/to/repo", "http://example.com/path/to/repo master dev"]
__doc__ = """
*Git Web Recovery* is a siple tool for downloading a .git folder disclosed on a Web server.
"""
BANNER_FONT = "standard"
BANNER_STYLE = {'fgcolor': "lolcat"}
DEFAULT_BRANCHES = ["main", "master", "dev", "test"]
if __name__ == '__main__':
parser.add_argument("url", help="URL of the Web repository")
parser.add_argument("branch", default=DEFAULT_BRANCHES, nargs="*", help="branches to be checked out")
initialize()
with GitRecoveryBot(re.sub(r"/(\.git/?)?$", "", args.url), verbose=args.verbose) as bot:
for b in args.branch:
bot.checkout(b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment