Skip to content

Commit ac5380b

Browse files
committed
Initial commit: Add CaptchAI library with core functionality for solving AWS WAF CAPTCHAs using AI models. Includes project structure, configuration files, and initial implementations for image and audio captcha solving. Also adds testing resources and workflows for CI/CD integration.
0 parents  commit ac5380b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2423
-0
lines changed

.bumpversion.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[tool.bumpversion]
2+
current_version = "0.0.0"
3+
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
4+
serialize = [
5+
"{major}.{minor}.{patch}"
6+
]
7+
search = "{current_version}"
8+
replace = "{new_version}"
9+
regex = false
10+
ignore_missing_version = false
11+
tag_name = "v{new_version}"
12+
tag_message = "Release version {new_version}"
13+
commit = true
14+
message = "Bump version: {current_version} → {new_version}"
15+
16+
[[tool.bumpversion.files]]
17+
filename = "pyproject.toml"
18+
search = 'version = "{current_version}"'
19+
replace = 'version = "{new_version}"'

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GROQ_API_KEY=your_groq_key_here
2+
MOONDREAM_API_KEY=your_moondream_key_here

.github/workflows/publish.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Test and Publish
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
env:
14+
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
15+
MOONDREAM_API_KEY: ${{ secrets.MOONDREAM_API_KEY }}
16+
17+
steps:
18+
- uses: actions/checkout@v2

.github/workflows/test.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
branches: [ "master" ]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
env:
11+
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
12+
MOONDREAM_API_KEY: ${{ secrets.MOONDREAM_API_KEY }}
13+
strategy:
14+
matrix:
15+
python-version: ["3.12"]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install UV
26+
run: |
27+
curl -LsSf https://astral.sh/uv/install.sh | sh
28+
29+
- name: Cache UV packages
30+
uses: actions/cache@v4
31+
with:
32+
path: |
33+
~/.cache/uv
34+
.venv
35+
key: ${{ runner.os }}-uv-${{ hashFiles('**/pyproject.toml', '**/uv.lock') }}
36+
restore-keys: |
37+
${{ runner.os }}-uv-
38+
39+
- name: Install dependencies
40+
run: |
41+
# Install all dependencies including dev extras
42+
uv sync --all-extras --dev
43+
44+
- name: Check code quality with ruff
45+
run: |
46+
# Check code formatting
47+
uv run ruff format . --check
48+
# Run all ruff rules (includes type checking, imports, etc.)
49+
uv run ruff check . --select ALL
50+
51+
- name: Test with pytest
52+
run: |
53+
uv run pytest tests/
54+
55+
- name: Prune UV cache for CI
56+
run: uv cache prune --ci

.gitignore

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
MANIFEST
23+
.env
24+
.venv
25+
env/
26+
venv/
27+
ENV/
28+
env.bak/
29+
venv.bak/
30+
pythonenv*
31+
.python-version
32+
33+
# PyCharm
34+
.idea/
35+
*.iml
36+
*.iws
37+
*.ipr
38+
.idea_modules/
39+
out/
40+
41+
# VSCode
42+
.vscode/
43+
*.code-workspace
44+
.history/
45+
.settings/
46+
47+
# Jupyter Notebook
48+
.ipynb_checkpoints
49+
*.ipynb
50+
51+
# Testing
52+
.coverage
53+
.coverage.*
54+
coverage.xml
55+
*.cover
56+
.pytest_cache/
57+
.tox/
58+
nosetests.xml
59+
coverage/
60+
htmlcov/
61+
62+
# Distribution / packaging
63+
.Python
64+
*.pyc
65+
*.pyo
66+
*.pyd
67+
.Python
68+
*.so
69+
70+
# Logs and databases
71+
*.log
72+
*.sqlite
73+
*.db
74+
*.sql
75+
*.sqlite3
76+
77+
# OS generated files
78+
.DS_Store
79+
.DS_Store?
80+
._*
81+
.Spotlight-V100
82+
.Trashes
83+
ehthumbs.db
84+
Thumbs.db
85+
Desktop.ini
86+
87+
# Environment variables
88+
.env
89+
.env.local
90+
.env.*.local
91+
.env.development
92+
.env.test
93+
.env.production
94+
95+
# Project specific
96+
test-results/
97+
.ruff_cache/
98+
.mypy_cache/
99+
100+
# Documentation
101+
docs/_build/
102+
site/
103+
104+
# Virtual Environment
105+
.venv/
106+
venv/
107+
ENV/
108+
109+
# Poetry
110+
poetry.lock
111+
dist/
112+
113+
# Misc
114+
*.bak
115+
*.swp
116+
*.swo
117+
*~

CONTRIBUTING.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Contributing to CaptchAI
2+
3+
First off, thanks for taking the time to contribute! 🎉
4+
5+
## Table of Contents
6+
- [Code of Conduct](#code-of-conduct)
7+
- [How Can I Contribute?](#how-can-i-contribute)
8+
- [Work Coordination](#work-coordination)
9+
- [Reporting Bugs](#reporting-bugs)
10+
- [Suggesting Features](#suggesting-features)
11+
- [Pull Requests](#pull-requests)
12+
- [Development Setup](#development-setup)
13+
- [Style Guidelines](#style-guidelines)
14+
15+
## Code of Conduct
16+
17+
This project follows a Code of Conduct that all contributors are expected to follow. Please read [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) before contributing.
18+
19+
## How Can I Contribute?
20+
21+
### Work Coordination
22+
23+
Before starting any work, please:
24+
25+
1. **Check Existing Issues**: Look through open issues to see if someone is already working on what you plan to do
26+
2. **Create or Comment on Issues**:
27+
- If you plan to work on something, create an issue or comment on an existing one
28+
- Clearly state what you plan to work on and when you expect to start
29+
- This helps avoid duplicate work and allows for better coordination
30+
3. **Update Issue Status**:
31+
- Comment on the issue when you start working
32+
- Keep the issue updated with your progress
33+
- If you stop working on it, please let others know
34+
35+
This coordination helps everyone work efficiently and avoids wasted effort.
36+
37+
### Reporting Bugs
38+
39+
Before creating bug reports, please check the issue list as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible:
40+
41+
* Use a clear and descriptive title
42+
* Describe the exact steps to reproduce the problem
43+
* Provide specific examples to demonstrate the steps
44+
* Describe the behavior you observed after following the steps
45+
* Explain which behavior you expected to see instead and why
46+
* Include any error messages or logs
47+
48+
### Suggesting Features
49+
50+
We welcome feature suggestions! When suggesting a feature:
51+
52+
* Use a clear and descriptive title
53+
* Provide a detailed explanation of how the feature would work
54+
* Explain why this feature would be useful
55+
* List some examples of how it would be used
56+
57+
### Pull Requests
58+
59+
1. Fork the repo and create your branch from `main`
60+
2. If you've added code that should be tested, add tests
61+
3. If you've changed APIs, update the documentation
62+
4. Make sure your code follows our style guidelines
63+
5. Run the test suite
64+
6. Create the pull request!
65+
66+
## Development Setup
67+
68+
1. Clone the repository
69+
```bash
70+
git clone https://github.com/yourusername/captchai.git
71+
cd captchai
72+
```
73+
74+
2. Create a virtual environment and activate it
75+
```bash
76+
python -m venv .venv
77+
source .venv/bin/activate # On Windows use: .venv\Scripts\activate
78+
```
79+
80+
3. Install dependencies
81+
```bash
82+
pip install -e ".[dev]"
83+
```
84+
85+
4. Set up pre-commit hooks
86+
```bash
87+
pre-commit install
88+
```
89+
90+
## Style Guidelines
91+
92+
We use `ruff` for code formatting and linting. Our code style follows these principles:
93+
94+
- Use type hints for all function parameters and return values
95+
- Follow PEP 8 guidelines
96+
- Use descriptive variable names
97+
- Write docstrings for all public functions and classes
98+
- Keep functions focused and small
99+
- Add comments for complex logic
100+
101+
### Code Formatting
102+
103+
We use `ruff` for code formatting. You can format your code by running:
104+
```bash
105+
ruff format .
106+
```
107+
108+
### Type Checking
109+
110+
We use type hints throughout the codebase. Make sure to add proper type hints to your code.
111+
112+
### Testing
113+
114+
- Write tests for all new features
115+
- Maintain or improve test coverage
116+
- Run the test suite before submitting:
117+
```bash
118+
pytest
119+
```
120+
121+
## License
122+
123+
By contributing to CaptchAI, you agree that your contributions will be licensed under its MIT License.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Captchai
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)