Skip to content

Commit db1b79d

Browse files
committed
Initial commit
0 parents  commit db1b79d

16 files changed

+965
-0
lines changed

.gitignore

+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
105+
__pypackages__/
106+
107+
# Celery stuff
108+
celerybeat-schedule
109+
celerybeat.pid
110+
111+
# SageMath parsed files
112+
*.sage.py
113+
114+
# Environments
115+
.env
116+
.venv
117+
env/
118+
venv/
119+
ENV/
120+
env.bak/
121+
venv.bak/
122+
123+
# Spyder project settings
124+
.spyderproject
125+
.spyproject
126+
127+
# Rope project settings
128+
.ropeproject
129+
130+
# mkdocs documentation
131+
/site
132+
133+
# mypy
134+
.mypy_cache/
135+
.dmypy.json
136+
dmypy.json
137+
138+
# Pyre type checker
139+
.pyre/
140+
141+
# pytype static type analyzer
142+
.pytype/
143+
144+
# Cython debug symbols
145+
cython_debug/
146+
147+
# PyCharm
148+
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
149+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
150+
# and can be added to the global gitignore or merged into this file. For a more nuclear
151+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
152+
#.idea/

README.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<div align="center">
2+
3+
<img src="assets/header.gif" width="150" height="auto">
4+
5+
**Recaptcha-V3** is a bypasser Google Recaptcha V3 with URL.
6+
7+
</div>
8+
9+
## **Installation**
10+
11+
**Using** `poetry`
12+
13+
```
14+
git clone https://github.com/x404xx/Recaptcha-V3.git
15+
cd Recaptcha-V3
16+
poetry shell
17+
poetry install
18+
```
19+
20+
**Using** `pip`
21+
22+
```
23+
git clone https://github.com/x404xx/Recaptcha-V3.git
24+
cd Recaptcha-V3
25+
virtualenv env
26+
env/scripts/activate
27+
pip install -r requirements.txt
28+
```
29+
30+
## Url
31+
32+
```
33+
https://antcpt.com/score_detector/
34+
https://2captcha.com/demo/recaptcha-v3-enterprise
35+
```
36+
37+
## Usage
38+
39+
```
40+
python main.py
41+
```
42+
43+
## Output
44+
45+
<div align="center">
46+
47+
**antcpt.com**
48+
49+
<img src="assets/ant.png" width="500" height="auto">
50+
51+
**2captcha.com**
52+
53+
<img src="assets/twocap.png" width="500" height="auto">
54+
55+
</div>
56+
57+
## Todo
58+
59+
- [x] Correct get api type
60+
61+
> Sometimes the API type is not shown in the HTML. We need to implement it correctly to retrieve the API type.
62+
63+
## **Legal Disclaimer**
64+
65+
> This was made for educational purposes only, nobody which directly involved in this project is responsible for any damages caused. **_You are responsible for your actions._**

assets/ant.png

94.8 KB
Loading

assets/header.gif

293 KB
Loading

assets/twocap.png

342 KB
Loading

endpoints/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .ant import ant_endpoint
2+
from .twocap import twocap_endpoint

endpoints/ant.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
def ant_endpoint(client, captcha_token, page_action, user_agent, ip_address):
2+
"""
3+
Send a POST request to an endpoint with a captcha token and additional information.
4+
5+
Args:
6+
client: The HTTP client used to make the POST request.
7+
captcha_token (str): The captcha token to be sent in the request.
8+
page_action (str): The action related to the page.
9+
user_agent (str): The user agent string.
10+
ip_address (str): The IP address of the client.
11+
12+
Returns:
13+
dict: A dictionary containing the response JSON merged with additional information.
14+
"""
15+
response = client.post(
16+
"https://antcpt.com/score_detector/verify.php",
17+
headers={"Content-Type": "application/json"},
18+
json={"g-recaptcha-response": captcha_token},
19+
)
20+
response_json = response.json()
21+
response_json.update(
22+
{"action": page_action, "user_agent": user_agent, "ip_address": ip_address}
23+
)
24+
return response_json

endpoints/twocap.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
def twocap_endpoint(
2+
client, sitekey, captcha_token, page_action, user_agent, ip_address
3+
):
4+
"""
5+
Send a POST request to the 2captcha endpoint with the provided data and return the updated JSON response.
6+
7+
Args:
8+
client: The HTTP client used to make the POST request.
9+
sitekey: The site key for the captcha.
10+
captcha_token: The token generated for the captcha.
11+
page_action: The action associated with the page.
12+
user_agent: The user agent string.
13+
ip_address: The IP address used for the request.
14+
15+
Returns:
16+
dict: The updated JSON response including additional data like action, user_agent, and ip_address.
17+
"""
18+
19+
response = client.post(
20+
"https://2captcha.com/api/v1/captcha-demo/recaptcha-enterprise/verify",
21+
headers={"Content-Type": "application/json"},
22+
json={
23+
"siteKey": sitekey,
24+
"token": captcha_token,
25+
},
26+
)
27+
response_json = response.json()
28+
response_json.update(
29+
{"action": page_action, "user_agent": user_agent, "ip_address": ip_address}
30+
)
31+
return response_json

main.py

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
from endpoints import ant_endpoint, twocap_endpoint
2+
from src import CaptchaSolver, HttpClient, RichConsole
3+
4+
# * PROXY URL examples
5+
# "http://username:password@host:port"
6+
# "socks5://username:password@host:port"
7+
8+
VERBOSE = True
9+
LOG_HANDLER = True
10+
PROXY_URL = None
11+
12+
ANT_URL = "https://antcpt.com/score_detector/"
13+
TWO_URL = "https://2captcha.com/demo/recaptcha-v3-enterprise"
14+
15+
16+
def get_ip(client):
17+
"""
18+
Retrieves the public IP address using the provided HTTP client.
19+
20+
Args:
21+
client: The HTTP client used to make the request.
22+
23+
Returns:
24+
str: The public IP address extracted from the JSON response.
25+
"""
26+
response = client.get("https://jsonip.com/")
27+
return response.json()["ip"]
28+
29+
30+
# TODO: Implement this section below based on the website that needs to be bypassed.
31+
def solve_v3(is_ant=False, is_two=False):
32+
BASE_URL = ANT_URL if is_ant else TWO_URL if is_two else None
33+
34+
if BASE_URL is None:
35+
raise ValueError("Either 'is_ant' or 'is_two' must be True")
36+
37+
solver = CaptchaSolver(BASE_URL, VERBOSE)
38+
39+
with HttpClient(PROXY_URL, LOG_HANDLER) as client:
40+
ip_address = get_ip(client)
41+
user_agent = client.base_agent["User-Agent"]
42+
captcha_token = solver.solve_captcha(client)
43+
page_action = solver.page_action
44+
45+
if is_two:
46+
sitekey = solver.sitekey
47+
return twocap_endpoint(
48+
client, sitekey, captcha_token, page_action, user_agent, ip_address
49+
)
50+
elif is_ant:
51+
return ant_endpoint(
52+
client, captcha_token, page_action, user_agent, ip_address
53+
)
54+
55+
56+
if __name__ == "__main__":
57+
RichConsole.clear()
58+
RichConsole.print(solve_v3(is_ant=True))

0 commit comments

Comments
 (0)