Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ $ pipx install gitfive
```
It will automatically use venvs to avoid dependency conflicts with other projects.

## Docker

```bash
$ docker build -t gitfive:latest .
$ docker run -it --name gitfive gitfive:latest python3 main.py login
$ docker start gitfive
$ docker exec -it gitfive python3 main.py user <username>
```

**Note:** Using a named container (`--name gitfive`) allows you to persist credentials between runs. The `-it` flags are required for interactive input (login prompts). Use `docker start gitfive` to start the container, then `docker exec -it gitfive` to run commands in it.

# Usage
First, login to GitHub *(preferably with a secondary account)* :
```bash
Expand Down
19 changes: 19 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3.11-slim

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

WORKDIR /app

RUN apt-get update && apt-get install -y \
git \
build-essential \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN pip install --upgrade pip \
&& pip install -r requirements.txt

COPY . .

CMD ["python", "main.py"]
22 changes: 18 additions & 4 deletions gitfive/lib/xray.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,20 @@ def get_repo(token: str, target_username: str, target_id: int, repos_folder: Pat

# Repo example to git clone : https://github.com/novitae/Aet-s-Tools

pass # In fact, it fails to checkout but commits are cloned, so we don't care. 💅

repo = Repo(repo_path)
# Check if repo_path exists (clone might have partially succeeded)
if not repo_path.exists():
# Clone completely failed (e.g., disabled repo, 403 error, etc.)
return results
# In fact, it fails to checkout but commits are cloned, so we don't care.
repo = Repo(repo_path)
else:
# Other GitCommandError (e.g., 403 Forbidden for disabled repos)
# Return empty results if clone completely failed
return results
except Exception as error:
# Catch any other exceptions (e.g., NoSuchPathError if path doesn't exist)
# Return empty results if we can't access the repo
return results

if not repo.refs:
# Empty repo, no branch
Expand Down Expand Up @@ -359,4 +370,7 @@ async def analyze_ext_contribs(runner: GitfiveRunner):
if not name in runner.target.usernames_history[username]["names"]:
runner.target._add_name(name) # Previous names are valid informations (unless target spoof it)
runner.target.usernames_history[username]["names"][name] = {"repos": set()}
runner.target.usernames_history[username]["names"][name]["repos"].add(repo_name)
try:
runner.target.usernames_history[username]["names"][name]["repos"].add(repo_name)
except KeyError as error:
continue