Skip to content

Commit a30cdb4

Browse files
committed
v3.16b
1 parent 66043bc commit a30cdb4

File tree

6 files changed

+113
-54
lines changed

6 files changed

+113
-54
lines changed

docker-compose.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ services:
77
dockerfile: ./solver.Dockerfile
88
restart: always
99
ports:
10-
- 8088:8088 # turnstile_solver server
11-
- 3389:3389 # RDP
10+
- ${SOLVER_SERVER_PORT:-8088}:${SOLVER_SERVER_PORT:-8088}
11+
- ${VNC_PORT:-5901}:${VNC_PORT:-5901}
12+
- ${XRDP_PORT:-3389}:${XRDP_PORT:-3389}
1213
networks:
1314
- solver
1415
environment:
@@ -17,9 +18,21 @@ services:
1718
- LANGUAGE=en_US:en
1819
- LC_ALL=en_US.UTF-8
1920
- TZ=${TZ:-America/New_York}
21+
22+
- SOLVER_SERVER_PORT=${SOLVER_SERVER_PORT:-8088}
23+
- SOLVER_BROWSER=${SOLVER_BROWSER:-chrome}
2024
- START_SERVER=${START_SERVER:-false}
2125

26+
- REMOTE_DESKTOP_PROTOCOL=${REMOTE_DESKTOP_PROTOCOL:-VNC}
27+
# VNC Server
28+
- VNC_PORT=${VNC_PORT:-5901}
29+
- VNC_PASSWORD=${VNC_PWD:-12345678}
30+
- VNC_GEOMETRY=${VNC_GEOMETRY:-1280x720}
31+
- VNC_DPI=${VNC_DPI:-70}
32+
- VNC_DEPTH=${VNC_DEPTH:-24}
33+
# Xrdp
34+
- XRDP_PORT=${XRDP_PORT:-3389}
2235
networks:
2336
solver:
24-
name: solver
37+
# name: solver # Explicit name declaration can cause conflicts, let docker manage names unless required
2538
driver: bridge

docker/README.md

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,29 @@ docker compose build --no-cache --pull
2929

3030
#### 3. Start the Container
3131

32-
**Set-up optional .env file**:
32+
##### Set-up optional .env file at `docker-compose.yml` level:
3333

34-
- `TZ`: Set your [IANA timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
35-
*(Example: Europe/London, Asia/Dubai)* Default: America/New_York
34+
- `TZ`: Set your [IANA timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Example: Europe/London, Asia/Dubai). Default: **_America/New_York_**
3635
- `START_SERVER`:
37-
- `true` = Auto-start with default config
38-
- `false` = Manual start required (default)
36+
- **false** - Manual start required (default)
37+
- **true** - Auto-start with default config
38+
- `SOLVER_SERVER_PORT` - Turnstile Solver server port. Default: **_8088_**
39+
- `SOLVER_BROWSER` - Patchright browser to install and use on auto-start build.
40+
- **chrome** (default and recommended)
41+
- **chromium**
42+
- **msedge**
43+
- `REMOTE_DESKTOP_PROTOCOL`:
44+
- **RDP** - Xrdp
45+
- **VNC** - VNC/TightVNC
46+
- [any] - No start remote desktop server
47+
- TightVNC Server:
48+
- `VNC_PASSWORD` - Password. Default: **_12312312_**
49+
- `VNC_PORT` - Port. Default: **_5901_**
50+
- `VNC_GEOMETRY` - Geometry. Default: **_1280x720_**
51+
- `VNC_DPI` - DPI. Default: **_70_**
52+
- `VNC_DEPTH` - Depth. Default: **_24_**
53+
- Xrdp:
54+
- `XRDP_PORT` - Xrdp port. Default: **_3389_**
3955

4056
**Command**:
4157

@@ -45,32 +61,45 @@ docker compose up -d
4561

4662
### 🔌 Remote Access Configuration
4763

48-
**Current Protocol (RDP)**:
64+
**RDP**:
4965

5066
1. **Client Software**:
5167
- Windows: Built-in Remote Desktop Connection
5268
- Linux: `Remmina` or `FreeRDP`
5369
- macOS: Microsoft Remote Desktop
5470

5571
2. **Connection Details**:
56-
- Address: `localhost:3389`
72+
- Address (default): `localhost:3389`
5773
- Credentials:
5874
- Username: `root`
5975
- Password: `root` (❗Change after first login)
6076

77+
⚠️ **Security Notice**: Default credentials pose significant risk - change immediately after initial setup!
78+
79+
**VNC/TightVNC**:
80+
81+
1. **Client Software**:
82+
- Windows: `RealVNC Viewer`, `TightVNC` (tvnviewer.exe)
83+
- Linux: `xtightvncviewer` (vncviewer/xtightvncviewer)
84+
- macOS: `?` # TODO
85+
2. **Connection Details**:
86+
- Address (default): `localhost:5901`
87+
88+
**Example connection with TightVNC Viewer on Windows**:
89+
90+
```cmd
91+
tvnviewer.exe 2.tcp.ngrok.io:17774 -password=12345678 -useclipboard=yes -mousecursor=no -jpegimagequality=2 -compressionlevel=2
92+
```
93+
6194
3. **Post-Connection (Start server with desired parameters)**:
6295

6396
```bash
6497
python3 solver
6598
```
6699

67-
⚠️ **Security Notice**: Default credentials pose significant risk - change immediately after initial setup!
68-
69100
---
70101

71-
Do you think I should add support for VNC server/protocol for next release?
72-
73-
### 🤔 VNC vs RDP Considerations
102+
### 🤔 VNC vs RDP
74103

75104
**Protocol Comparison**:
76105

@@ -81,22 +110,3 @@ Do you think I should add support for VNC server/protocol for next release?
81110
| Cross-Platform | ✅ Excellent | ✅ Universal |
82111
| File Transfer | ✅ Built-in | ❌ Requires add-ons |
83112
| Multi-Monitor Support | ✅ Native | ✅ Possible |
84-
85-
```diff
86-
+ For Next Release: Hybrid Support
87-
- Implement both protocols (RDP+VNC) via separate ports
88-
- Add environment variable: PROTOCOL="RDP|VNC" (default: RDP)
89-
- Include VNC password configuration in docker-compose
90-
```
91-
92-
**Suggested Implementation**:
93-
94-
```yaml
95-
# docker-compose.yml
96-
environment:
97-
- PROTOCOL=${REMOTE_PROTOCOL:-RDP}
98-
- VNC_PASSWORD=${VNC_PWD:-changeme}
99-
ports:
100-
- "3389:3389" # RDP
101-
- "5900:5900" # VNC
102-
```

docker/services/solver/entrypoint.sh

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,59 @@ declare -r TARGET_USER="root"
44
#declare -r WORKSPACE="/${TARGET_USER}/Desktop"
55
declare -r REPO_URL="https://github.com/odell0111/turnstile_solver.git"
66

7-
clean_pids() {
7+
start_vnc_server() {
8+
# Kill any previous previous session
9+
vncserver -kill :1 > /dev/null 2>&1
10+
11+
# Build the base command arguments
12+
CMD="vncserver :1 \
13+
-httpport $VNC_SERVER_PORT \
14+
-geometry $GEOMETRY \
15+
-dpi $DPI \
16+
-depth $DEPTH"
17+
18+
# Generate input sequence (password x2 + confirm)
19+
INPUT_FEED=$(printf "%s\r\n%s\r\n\r\y\r\n" "$PASSWORD" "$PASSWORD")
20+
21+
# Execute and capture output
22+
eval "$CMD" <<EOF 2>&1
23+
$INPUT_FEED
24+
EOF
25+
}
26+
27+
start_xrdp() {
28+
# Clean PIDs
829
find /var/run -name '*xrdp*.pid' -delete
30+
# Update port
31+
sed -E -i "s/port=[0-9]+/port=${XRDP_PORT}/g" /etc/xrdp/xrdp.ini
32+
xrdp-sesman & xrdp -n &
933
}
1034

1135
service_init() {
12-
clean_pids
13-
xrdp-sesman & xrdp -n &
36+
37+
if [ "$REMOTE_DESKTOP_PROTOCOL" = "RDP" ]; then
38+
(start_xrdp && echo "Xrdp running on port: ${XRDP_PORT}") || {
39+
echo "Xrdp failed to start"
40+
exit 2
41+
}
42+
elif [ "$REMOTE_DESKTOP_PROTOCOL" = "VNC" ]; then
43+
(start_vnc_server && echo "TightVNC server running on port: ${VNC_SERVER_PORT}") || {
44+
echo "TightVNC server setup failed"
45+
exit 3
46+
}
47+
fi
48+
49+
# Wait up to 20s fot Xorg to start
1450
local timeout=20
1551

1652
while ((timeout-- > 0)); do
17-
pgrep -x Xorg && return 0
53+
pgrep -x Xorg && {
54+
echo "Xorg started"
55+
return 0
56+
}
1857
sleep 1
1958
done
59+
echo "Xorg not started after 20s"
2060
return 1
2161
}
2262

@@ -49,30 +89,25 @@ install_patchright() {
4989
# Install patchright (with PEP 668 workaround)
5090
pip3 install --no-cache-dir --break-system-packages patchright || {
5191
echo "Failed to install patchright"
52-
exit 2
92+
exit 3
5393
}
5494

5595
# Run patchright
56-
patchright install chrome || {
57-
echo "Failed to configure Chrome"
58-
exit 3
96+
patchright install $SOLVER_BROWSER || {
97+
echo "Failed to install Patchright browser: $SOLVER_BROWSER"
98+
exit 4
5999
}
60100
}
61101

62102
# Execution flow
63103
user_setup || { echo "User config failed"; exit 1; }
64-
env_config || exit 1
104+
env_config || exit 5
65105
repo_setup && echo "repo set-up"
66106
install_patchright && echo "patchright installed"
67-
if service_init; then
68-
echo "Xorg running"
69-
else
70-
echo "X server failed"
71-
exit 3
72-
fi
107+
service_init || exit 6
73108

74109
if [ "$START_SERVER" = "true" ]; then
75110
echo "Starting server in headful mode..."
76-
xvfb-run -a python3 solver --browser chrome
111+
xvfb-run -a python3 solver --browser ${SOLVER_BROWSER} --port ${SOLVER_SERVER_PORT}
77112
# xvfb-run -a python3 "${WORKSPACE}/turnstile_solver/main.py"
78113
fi

docker/services/solver/solver.Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ RUN apt-get update && \
2020
python3-pip \
2121
xorgxrdp \
2222
xrdp \
23+
tightvncserver \
2324
xvfb \
2425
wget \
2526
screen \
@@ -42,8 +43,8 @@ COPY ./entrypoint.sh /usr/local/bin/
4243
RUN chmod +x /usr/local/bin/entrypoint.sh
4344

4445
# Healthcheck (adjust as needed)
45-
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
46-
CMD netstat -an | grep 3389 >/dev/null || exit 1
46+
#HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
47+
# CMD netstat -an | grep $XRDP_PORT >/dev/null || exit 1
4748

4849
# Set entrypoint
4950
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66
#dynamic = ["version"]
77
dynamic = ["dependencies"]
88
name = "turnstile_solver"
9-
version = "3.15"
9+
version = "3.16"
1010
description = "Python server to automatically solve Cloudflare Turnstile CAPTCHA with an average solving time of two seconds"
1111
readme = "README.md"
1212
authors = [{ name = "OGM" }]

src/turnstile_solver/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
# mdata = metadata.metadata(__pname__)
3636
# __version__ = mdata['Version']
37-
__version__ = "3.15b"
37+
__version__ = "3.16b"
3838
__homepage__ = "https://github.com/odell0111/turnstile_solver" # mdata['Home-page']
3939
__author__ = "OGM" # mdata['Author']
4040
__summary__ = "Automatically solve Cloudflare Turnstile captcha" # mdata['Summary']

0 commit comments

Comments
 (0)