A Git Repository Leaks Scanner Python library written in C++
Table of Contents
About The Project
PyRepScan is a python library written in C++. The library uses libgit2 for repository parsing and traversing, re2 for regex pattern matching and cpp-taskflow for concurrency. The library was written to achieve high performance and python bindings.
Built With
Performance
CPU
| Library | Time | Improvement Factor |
|---|---|---|
| PyRepScan | 2.18s | 1.0x |
| gitleaks | 63.0s | 28.9x |
Prerequisites
In order to compile this package you should have GCC & Python development package installed.
- Fedora
sudo dnf install python3-devel gcc-c++ libgit2-devel re2-devel
- Ubuntu 18.04
sudo apt install python3-dev g++-9 libgit2-dev libre2-dev
Installation
pip3 install PyRepScan
Usage
import pyrepscan
grs = pyrepscan.GitRepositoryScanner()
# Adds a specific rule, can be called multiple times or none
grs.add_rule(
name='First Rule',
regex_pattern=r'''(-----BEGIN PRIVATE KEY-----)''',
regex_blacklist_patterns=[],
)
# Compiles the rules. Should be called only once after all the rules were added
grs.compile_rules()
# Add file extensions to ignore during the search
grs.add_ignored_file_extension('bin')
grs.add_ignored_file_extension('jpg')
# Add file paths to ignore during the search. Free text is allowed
grs.add_ignored_file_path('site-packages')
grs.add_ignored_file_path('node_modules')
# Scans a repository
results = grs.scan('/repository/path')
# Results is a list of dicts. Each dict is in the following format:
# {
# 'author_email': 'author@email.email',
# 'author_name': 'Author Name',
# 'commit_id': '1111111111111111111111111111111111111111',
# 'commit_message': 'The commit message',
# 'content': 'The content of the file that has been matched',
# 'file_path': 'full/file/path',
# 'match': 'The matched group',
# 'rule_name': 'First Rule'
# },
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Gal Ben David - gal@intsights.com
Project Link: https://github.com/intsights/PyRepScan
Metadata
Release files for pyrepscan 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PyRepScan-0.1.2.tar.gz | 119.8 kB | Without provenance | Details for PyRepScan-0.1.2.tar.gz |
Release files / PyRepScan-0.1.2.tar.gz
| Download URL | PyRepScan-0.1.2.tar.gz |
|---|---|
| Size | 119.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3bc1b0cd46ba0b90c6027d257e65b96d2d993142db49e4d1e04c7f0adf1713ff
|
|
BLAKE2b-256 checksum How to use checksums |
80831606b0a9ddb29ad6161ebf59113d576cfe3ad6538728954fbafc85229fb9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7
|
Security for pyrepscan 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.