Skip to content

seikaikyo/git_cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🔐 Universal Git Secrets Cleaner + GitGuardian Integration

Python Version License GitGuardian

🇺🇸 English | 🇯🇵 日本語 | 🇹🇼 正體中文


🇹🇼 正體中文

概述

企業級 Git 機敏資料檢測與清理工具,支援 GitHub、GitLab.com、自架 GitLab。整合 GitGuardian API 提供專業檢測,具備完整 Git 歷史清理功能。

✨ 主要功能

  • 🌐 多平台支援: GitHub、GitLab.com、自架 GitLab
  • 🔍 專業檢測: GitGuardian API(650+ 種機敏資料)+ 本地檢測
  • 🖥️ 雙重界面: 命令列工具 + 圖形界面
  • 🧹 完整清理: Git 歷史重寫 + 檔案移除 + 字串替換
  • 💾 自動備份: 修改前自動備份
  • 🎯 三種模式: 僅掃描、自動清理、配置驅動

🚀 快速開始

安裝

# 複製專案
git clone https://github.com/your-username/universal-git-cleaner.git
cd universal-git-cleaner

# 安裝相依套件
pip install requests

# 使用方式
python universal_git_cleaner.py        # 命令列版本
python git_cleaner_gui.py              # 圖形界面版本(推薦)

基本使用

  1. 選擇平台: GitHub / GitLab.com / 自架 GitLab
  2. 輸入 Token: Personal Access Token
  3. 選擇檢測: GitGuardian API(可選)/ 本地模式
  4. 選擇模式: 掃描 / 清理 / 配置檔案

🔧 設定指南

Token 權限需求

GitHub: repo, user
GitLab: api, read_repository, write_repository
GitGuardian: scan:read

取得方式

  • GitHub: Settings → Developer settings → Personal access tokens
  • GitLab: User Settings → Access Tokens
  • GitGuardian: Dashboard → API Keys

📋 支援檢測類型

GitGuardian(650+ 類型)

AWS、Azure、GCP、OpenAI、Stripe、資料庫憑證、SSH Keys、JWT Tokens 等

本地模式

OpenAI API Keys、Google API Keys、AWS 憑證、Stripe Keys、資料庫 URLs、一般機密模式

⚠️ 重要警告

  • Git 歷史重寫: 永久改變倉庫歷史
  • 團隊協調: 清理後所有人需重新 clone
  • 憑證撤銷: 執行前先撤銷暴露的憑證
  • 備份建議: 建立額外備份

📊 輸出範例

=== GitLab 掃描摘要 ===
檢測方式: GitGuardian
總倉庫數: 45
有問題的倉庫: 12
發現的問題: 28
機敏檔案: 8

問題類型分佈:
  AWS Secrets: 8
  Database Credentials: 6
  API Keys: 14

高風險倉庫:
  company/payment-service: 8 個問題, 2 個檔案
  company/auth-service: 6 個問題, 1 個檔案

🤝 貢獻

  1. Fork 專案
  2. 建立分支 (git checkout -b feature/amazing-feature)
  3. 提交變更 (git commit -m 'Add amazing feature')
  4. 推送分支 (git push origin feature/amazing-feature)
  5. 建立 Pull Request

📄 授權

MIT License - 詳見 LICENSE 檔案


🇺🇸 English

Overview

Enterprise-grade Git secrets detection and cleaning tool supporting GitHub, GitLab.com, and self-hosted GitLab. Features GitGuardian API integration for professional detection and complete Git history rewriting capabilities.

✨ Key Features

  • 🌐 Multi-Platform: GitHub, GitLab.com, Self-hosted GitLab
  • 🔍 Professional Detection: GitGuardian API (650+ secret types) + Local patterns
  • 🖥️ Dual Interface: Command-line tool + Graphical interface
  • 🧹 Complete Cleanup: Git history rewriting + File removal + String replacement
  • 💾 Auto Backup: Automatic backup before modifications
  • 🎯 Three Modes: Scan-only, Auto cleanup, Config-driven

🚀 Quick Start

Installation

# Clone repository
git clone https://github.com/your-username/universal-git-cleaner.git
cd universal-git-cleaner

# Install dependencies
pip install requests

# Usage
python universal_git_cleaner.py        # Command-line version
python git_cleaner_gui.py              # GUI version (recommended)

Basic Usage

  1. Choose Platform: GitHub / GitLab.com / Self-hosted GitLab
  2. Enter Token: Personal Access Token
  3. Choose Detection: GitGuardian API (optional) / Local mode
  4. Select Mode: Scan / Cleanup / Config file

🔧 Setup Guide

Required Token Permissions

GitHub: repo, user
GitLab: api, read_repository, write_repository
GitGuardian: scan:read

How to Get Tokens

  • GitHub: Settings → Developer settings → Personal access tokens
  • GitLab: User Settings → Access Tokens
  • GitGuardian: Dashboard → API Keys

📋 Supported Detection Types

GitGuardian (650+ types)

AWS, Azure, GCP, OpenAI, Stripe, Database credentials, SSH Keys, JWT Tokens, etc.

Local Mode

OpenAI API Keys, Google API Keys, AWS credentials, Stripe Keys, Database URLs, Generic secrets

⚠️ Important Warnings

  • Git History Rewriting: Permanently changes repository history
  • Team Coordination: All collaborators must re-clone after cleanup
  • Credential Revocation: Revoke exposed credentials before running
  • Backup Recommended: Create additional backups

📊 Sample Output

=== GitHub Scan Summary ===
Detection Method: GitGuardian
Total Repositories: 45
Repositories with Issues: 12
Issues Found: 28
Sensitive Files: 8

Issue Type Distribution:
  AWS Secrets: 8
  Database Credentials: 6
  API Keys: 14

High-Risk Repositories:
  company/payment-service: 8 issues, 2 files
  company/auth-service: 6 issues, 1 file

🤝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push branch (git push origin feature/amazing-feature)
  5. Create Pull Request

📄 License

MIT License - see LICENSE file for details


🇯🇵 日本語

概要

GitHub、GitLab.com、セルフホスト GitLab に対応したエンタープライズグレードの Git 機密データ検出・クリーニングツール。GitGuardian API 統合による専門的検出と完全な Git 履歴書き換え機能を提供。

✨ 主要機能

  • 🌐 マルチプラットフォーム: GitHub、GitLab.com、セルフホスト GitLab
  • 🔍 専門的検出: GitGuardian API(650+種類)+ ローカルパターン
  • 🖥️ デュアルインターフェース: コマンドラインツール + グラフィカルインターフェース
  • 🧹 完全クリーニング: Git 履歴書き換え + ファイル削除 + 文字列置換
  • 💾 自動バックアップ: 変更前の自動バックアップ
  • 🎯 3 つのモード: スキャンのみ、自動クリーニング、設定駆動

🚀 クイックスタート

インストール

# リポジトリをクローン
git clone https://github.com/your-username/universal-git-cleaner.git
cd universal-git-cleaner

# 依存関係をインストール
pip install requests

# 使用方法
python universal_git_cleaner.py        # コマンドライン版
python git_cleaner_gui.py              # GUI版(推奨)

基本的な使用方法

  1. プラットフォーム選択: GitHub / GitLab.com / セルフホスト GitLab
  2. トークン入力: Personal Access Token
  3. 検出方式選択: GitGuardian API(オプション)/ ローカルモード
  4. モード選択: スキャン / クリーニング / 設定ファイル

🔧 セットアップガイド

必要なトークン権限

GitHub: repo, user
GitLab: api, read_repository, write_repository
GitGuardian: scan:read

トークンの取得方法

  • GitHub: Settings → Developer settings → Personal access tokens
  • GitLab: User Settings → Access Tokens
  • GitGuardian: Dashboard → API Keys

📋 対応検出タイプ

GitGuardian(650+タイプ)

AWS、Azure、GCP、OpenAI、Stripe、データベース認証情報、SSH キー、JWT トークンなど

ローカルモード

OpenAI API キー、Google API キー、AWS 認証情報、Stripe キー、データベース URL、一般的なシークレット

⚠️ 重要な警告

  • Git 履歴書き換え: リポジトリ履歴を永続的に変更
  • チーム調整: クリーニング後、全員が再クローンする必要
  • 認証情報の無効化: 実行前に露出した認証情報を無効化
  • バックアップ推奨: 追加のバックアップを作成

📊 出力例

=== GitLab スキャン概要 ===
検出方式: GitGuardian
総リポジトリ数: 45
問題のあるリポジトリ: 12
発見された問題: 28
機密ファイル: 8

問題タイプ分布:
  AWS Secrets: 8
  Database Credentials: 6
  API Keys: 14

高リスクリポジトリ:
  company/payment-service: 8個の問題、2ファイル
  company/auth-service: 6個の問題、1ファイル

🤝 貢献

  1. リポジトリをフォーク
  2. 機能ブランチを作成 (git checkout -b feature/amazing-feature)
  3. 変更をコミット (git commit -m 'Add amazing feature')
  4. ブランチをプッシュ (git push origin feature/amazing-feature)
  5. プルリクエストを作成

📄 ライセンス

MIT License - 詳細は LICENSE ファイルを参照

🌟 謝辞

  • GitGuardian - 専門的な機密データ検出 API
  • Git コミュニティ - 強力なバージョン管理システム
  • 全ての貢献者とユーザー

⭐ このツールが役に立った場合は、Star をお願いします!

🔗 チームと共有して、より安全なコードベースを構築しましょう!

About

企業級 Git 機敏資料檢測與清理工具,支援 GitHub、GitLab.com、自架 GitLab。整合 GitGuardian API 提供專業檢測,具備完整 Git 歷史清理功能。

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages