Skip to content
Back to skills

Srt

ASecurity

Korean SRT (Super Rapid Train) search, reservation, and booking management

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
businesspythonbashgitapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned November 11, 2026

npx -y skills add johnalbertini14-glitch/openclaw-skills --skill srt --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Srt?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Srt
[![Security: A β€” Skills Directory](https://www.skillsdirectory.com/api/skills/johnalbertini14-glitch-srt/badge)](https://www.skillsdirectory.com/skills/johnalbertini14-glitch-srt)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: srt
description: Korean SRT (Super Rapid Train) search, reservation, and booking management
homepage: https://github.com/khj809/openclaw-srt-skill
user-invocable: true
metadata:
  {
    "openclaw":
      {
        "emoji": "πŸš…",
        "requires": { "bins": ["python3", "uv"], "env": ["SRT_PHONE", "SRT_PASSWORD"] },
        "install": [
          {"id": "uv", "kind": "uv", "package": "SRTrain", "label": "Install SRTrain from PyPI (uv) β€” source: https://pypi.org/project/SRTrain / https://github.com/ryanking13/SRT"}
        ]
      },
  }
---

# SRT Korean Train Service Skill

## Prerequisites

- Environment variables `SRT_PHONE` (format: `010-XXXX-XXXX`) and `SRT_PASSWORD` must be set before running scripts.

## Reference

**Environment variables:**
| Variable | Required | Description |
|----------|----------|-------------|
| `SRT_PHONE` | βœ… | SRT account phone number (hyphens required: `010-XXXX-XXXX`) |
| `SRT_PASSWORD` | βœ… | SRT account password |
| `SRT_DATA_DIR` | optional | Directory for logs, cache, and state files. Defaults to system temp dir (`/tmp/srt`). |

**Station names** (Korean only):
μˆ˜μ„œ, λΆ€μ‚°, λ™λŒ€κ΅¬, λŒ€μ „, μ²œμ•ˆμ•„μ‚°, μ˜€μ†‘, 광주솑정, μšΈμ‚°, 포항, κ²½μ£Ό, κΉ€μ²œκ΅¬λ―Έ, 읡산, μ „μ£Ό, λͺ©ν¬, μ‹ κ²½μ£Ό

**Date:** `YYYYMMDD` Β· **Time:** `HHMMSS` (e.g. `200000` = 20:00)

---

## Commands

### Search Trains
```bash
cd <project_dir> && uv run --with SRTrain python3 scripts/srt_cli.py train search \
  --departure "μˆ˜μ„œ" --arrival "λ™λŒ€κ΅¬" --date "20260227" --time "200000"
```
Search params and results are cached (in `SRT_DATA_DIR`) and required by `reserve`.

### Reserve (one-shot)
```bash
cd <project_dir> && uv run --with SRTrain python3 scripts/srt_cli.py reserve one-shot --train-id "1"
```
`--train-id` is the 1-based index from search results. Must run `train search` first.

### View Reservations
```bash
cd <project_dir> && uv run --with SRTrain python3 scripts/srt_cli.py reserve list --format json
```

### Cancel Reservation
```bash
cd <project_dir> && uv run --with SRTrain python3 scripts/srt_cli.py reserve cancel \
  --reservation-id "RES123456" --confirm
```

---

## Continuous Monitoring (μ·¨μ†Œν‘œ λͺ¨λ‹ˆν„°λ§)

For "keep trying until a seat opens" requests, **do not loop inside a cron job**.
Instead: run `srt_cli.py reserve retry` as a persistent background process, then create a separate cron job to read the log and report.

### Step 1: Search (populate cache)
```bash
cd <project_dir> && uv run --with SRTrain python3 scripts/srt_cli.py train search \
  --departure "μˆ˜μ„œ" --arrival "λ™λŒ€κ΅¬" --date "20260227" --time "200000"
```
Note the `train_id` of the target train from the results.

### Step 2: Start background retry process
```bash
LOG_FILE=<choose_any_path>.log
PID_FILE=<choose_any_path>.pid
cd <project_dir> && nohup uv run --with SRTrain python3 scripts/srt_cli.py reserve retry \
  --train-id <id> --timeout-minutes 1440 --wait-seconds 10 \
  --log-file "$LOG_FILE" > /dev/null 2>&1 &
echo $! > "$PID_FILE"
```

The script prints `LOG_FILE: <path>` on startup β€” capture this to know exactly where logs are written.
You may also set `SRT_DATA_DIR` to control where auto-generated logs and cache files are placed.

> **Path safety:** `SRT_DATA_DIR` and `--log-file` are validated at runtime to resolve within the user's home directory or system temp dir only. Paths that escape these boundaries (e.g. via `../`) are rejected.

**`reserve retry` options:**
| Option | Default | Description |
|--------|---------|-------------|
| `--train-id` | (all) | 1-based index from search; comma-separated for multiple |
| `--timeout-minutes` | 60 | Total duration. Use 1440 for 24h |
| `--wait-seconds` | 10 | Delay between attempts |
| `--log-file` | auto | Explicit log file path (overrides `SRT_DATA_DIR` default) |

Log markers to watch for:
- `=== μ‹œλ„ #N` β€” attempt number
- `SUCCESS` β€” reservation succeeded (contains μ˜ˆμ•½λ²ˆν˜Έ, μ’Œμ„)
- `TIMEOUT` β€” timed out without success

### Step 3: Create periodic reporting cron job
Create an **isolated agentTurn** cron job (every 15 min) with **`--no-deliver`** (delivery mode: none).
The agent must use the `message` tool to post directly to the Discord channel β€” do **not** use `--announce` (the announce queue can fail with a gateway pairing error in isolated sessions).

CLI:
```bash
openclaw cron add \
  --agent srt \
  --name "SRT λͺ¨λ‹ˆν„°λ§ 보고 (15λΆ„λ§ˆλ‹€)" \
  --every 15m \
  --session isolated \
  --no-deliver \
  --message "..."
```

Agent message must instruct:
1. Check process status:
   ```bash
   cd <project_dir> && uv run --with SRTrain python3 scripts/srt_cli.py reserve status --pid-file <pid_file>
   ```
2. Read log tail: `tail -50 <log_file>`
3. Summarise attempt count, last attempt time, success/failure
4. **Send report via `message` tool** (`channel=discord`, `target=<channel_id>`)
5. On `SUCCESS` in log β†’ include μ˜ˆμ•½λ²ˆν˜Έ/μ’Œμ„ in message, then remove this cron job and termination job
6. On `NOT_RUNNING` without `SUCCESS` β†’ report crash, remove this cron job

The message payload must include this job's own ID and the termination job ID so it can self-remove.

### Step 4: Create termination job
Create an **isolated agentTurn** `at`-schedule cron job (`--no-deliver`, `--delete-after-run`) at the deadline.

CLI:
```bash
openclaw cron add \
  --agent srt \
  --name "SRT λͺ¨λ‹ˆν„°λ§ μ’…λ£Œ" \
  --at "<ISO UTC time>" \
  --session isolated \
  --no-deliver \
  --delete-after-run \
  --message "..."
```

Agent message must instruct:
1. Stop the process:
   ```bash
   cd <project_dir> && uv run --with SRTrain python3 scripts/srt_cli.py reserve stop --pid-file <pid_file>
   ```
2. Remove the reporting cron job by ID
3. Read final log and **send outcome via `message` tool** to Discord channel

---

## JSON Output

**Search result item:**
```json
{
  "train_number": "369",
  "departure_time": "200000",
  "arrival_time": "213600",
  "departure_station": "μˆ˜μ„œ",
  "arrival_station": "λ™λŒ€κ΅¬",
  "seat_available": false,
  "general_seat": "λ§€μ§„",
  "special_seat": "λ§€μ§„",
  "train_id": "1"
}
```

**Reservation result:**
```json
{
  "success": true,
  "data": {
    "reservation_id": "RES123456",
    "train_number": "369",
    "seat_number": "3A",
    "payment_required": true
  }
}
```

Exit codes: `0` = success Β· `1` = retryable (no seats) Β· `2` = fatal

---

## Error Handling

| Error | Cause | Resolution |
|-------|-------|-----------|
| `AuthenticationFailed` | Wrong credentials | Check `SRT_PHONE` / `SRT_PASSWORD` |
| `NoSeatsAvailable` | Sold out | Use `--retry` or try different train |
| `StationNotFound` | Invalid name | Use Korean station names above |
| `NoTrainsFound` | No trains found | Try different date/time |
| `RateLimitExceeded` | Too many attempts | Wait a few minutes |

---

## Natural Language Handling

Extract from Korean input:
- Stations β†’ Korean names (μˆ˜μ„œ, λ™λŒ€κ΅¬, etc.)
- Date β†’ relative ("내일", "λ‹€μŒμ£Ό κΈˆμš”μΌ") to YYYYMMDD
- Time β†’ ("20μ‹œ 이후", "μ˜€ν›„ 2μ‹œ") to HHMMSS
- Passenger count β†’ default 1 if not specified

**Patterns:**
- "κ²€μƒ‰ν•΄μ€˜" β†’ `train search`
- "μ˜ˆμ•½ν•΄μ€˜" (one-shot) β†’ `train search` then `reserve one-shot`
- "μ·¨μ†Œν‘œ λ‚˜μ˜€λ©΄ μž‘μ•„μ€˜ / 될 λ•ŒκΉŒμ§€ 돌렀쀘" β†’ Continuous Monitoring flow above
- "λ‚΄ μ˜ˆμ•½ ν™•μΈν•΄μ€˜" β†’ `reserve list`
- "μ·¨μ†Œν•΄μ€˜" β†’ `list` then `cancel`

## Payment Note
Reservations must be paid via SRT app or <https://etk.srail.kr> within ~20 minutes of reservation.

Files in this skill

  • SKILL.md7.4 KB
  • _meta.json964 B
  • scripts/reserve.py15.5 KB
  • scripts/srt_cli.py6.9 KB
  • scripts/train.py5.2 KB
  • scripts/utils.py13.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in business β†’

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.