Resolves SafelinkU / sfl.gl ad-links to their final destination over plain HTTP.
No browser, no JavaScript execution, no timers.
| File | Runtime | Lines | Chars | Time* |
|---|---|---|---|---|
solver.pl |
Perl 5.14+ (core modules only) | 9 | 786 | ~3.4s |
solver.mjs |
Bun | 5 | 747 | ~1.8-2.7s |
solver.php |
PHP 8 + curl | 13 | 922 | ~2.6-3.9s |
solver.py |
Python 3 + requests |
38 | 1334 | ~1.7s |
* same link, same machine. Timing on this host varies with Cloudflare edge latency; the ordering is stable.
Pick by what you care about: Perl is the shortest to read, Bun is the fastest, Python is the most portable. PHP and Perl trade speed for brevity.
perl solver.pl https://sfl.gl/cgcpp
bun solver.mjs https://sfl.gl/cgcpp
php solver.php https://sfl.gl/cgcpp
python solver.py https://sfl.gl/cgcppEach prints the destination URL.
| Step | Request | Purpose |
|---|---|---|
| 1 | GET sfl.gl/<alias> |
Page carries ray_id + alias in a hidden form |
| 2 | GET app.khaddavi.net/redirect.php?ray_id&alias |
Sets __session |
| 3 | GET <302 target> |
Sets XSRF-TOKEN, SESSION, tt |
| 4 | POST /api/verify |
{"_a": 0} with content-type: application/json |
| 5 | POST /api/go |
Returns the sfl.gl/ready/go ticket |
| 6 | GET <ticket> |
Destination is in a window.location.href string |
/api/sessionand the 10s + 3s waits the front-end uses.Referer,Origin,X-Requested-With.- The
X-XSRF-TOKENheader itself. The cookie alone is accepted. - URL-decoding the
XSRF-TOKENcookie.
ray_idmust be the real one from step 1. A fabricated value returns{"message":"Page expired"}.- Step 3 cannot be skipped: it is the only response that issues
XSRF-TOKEN. __sessioncan be set by hand toray_id, which lets step 2 and 3 collapse into a single auto-followed request./api/verifymust run before/api/go, and the POST body must be sent withcontent-type: application/json, or the server returns HTML.
Windows builds ship without a CA bundle, so curl fails with
unable to get local issuer certificate. Download cacert.pem from
https://curl.se/ca/cacert.pem and point curl.cainfo at it in php.ini,
and enable extension=curl.
- Link-specific:
app.khaddavi.netis the ad host for this SafelinkU instance. - Gated links (passcode / Turnstile) return no
urland the script fails loudly. curlon Windows builds linked against schannel cannot reach the shortener at all (http_code=000). Bun, Python and PHP-curl use OpenSSL-family stacks and work.
GPL-3.0 — see LICENSE.