Skip to content

Instantly share code, notes, and snippets.

@fnordomat
Last active November 7, 2023 16:58
Show Gist options
  • Save fnordomat/db16a1357a55d7410d15c1a2a724b336 to your computer and use it in GitHub Desktop.
Save fnordomat/db16a1357a55d7410d15c1a2a724b336 to your computer and use it in GitHub Desktop.
Automatic negotiation of a captive portal: connect to icomera wifi in CD trains without having to jump through hoops.
# I believe this is the necessary and sufficient step to get internet access on board the Czech long distance trains (e.g. EuroCity which runs from Prague to Kiel)
curl -vLA '' 'http://cdwifi.cz/portal/api/vehicle/gateway/user/authenticate'
# It says "500 internal server error" but that doesn't keep it from working.
# check with this request, answer should contain "authenticated":1
curl -vLA '' 'http://cdwifi.cz/portal/api/vehicle/gateway/user'
# Also nice: GPS data (but seems outdated)
curl -vLA '' 'http://cdwifi.cz/portal/internal/api/x6/position'
# Really nice: show connectivity including the LTE uplinks
curl -vLA '' http://www.info.cdwifi.cz/api/jsonp/connectivity
@fnordomat
Copy link
Author

@bzamecnik Nice to see that my solution still works. I've linked to yours in the https://github.com/fnordomat/misc/blob/master/captive-be-gone/minisurvey.txt and hope to expand this even further, especially as travel picks up again :-)

@AElouai
Copy link

AElouai commented Sep 14, 2020

thanks

@JanC
Copy link

JanC commented May 25, 2021

Some more fun: Using the /connectivity/ endpoint, we can see the currently connected links. A command line shortcut to see those that are connected and their signal level:

curl -s  http://www.info.cdwifi.cz/api/jsonp/connectivity/ \
    | tr -d '(' | tr -d ')' | tr -d ';' |  \
    jq '.links[] | select(.link_state=="available")'

{
  "index": "104",
  "device_type": "modem",
  "device_subtype": "sierra-7710",
  "device_state": "up",
  "link_state": "available",
  "rssi": "-55",
  "technology": "lte",
  "operator_id": "26201",
  "apninfo": "railnet.telekom,-1,-1",
  "umts_info": {
    "net_status": "1",
    "lac": "FFFE",
    "cellid": "0231E502"
  }
}
{
  "index": "105",
  "device_type": "modem",
  "device_subtype": "sierra-7710",
  "device_state": "up",
  "link_state": "available",
  "rssi": "-81",
  "technology": "lte",
  "operator_id": "26202",
  "apninfo": "fv1.deutschebahn.com,-1,-1",
  "umts_info": {
    "net_status": "1",
    "lac": "FFFE",
    "cellid": "002AE302"
  }
}

or show only some fields using

curl -s  http://www.info.cdwifi.cz/api/jsonp/connectivity/ \
    | tr -d '(' | tr -d ')' | tr -d ';' |  \
    jq '.links[] | select(.link_state=="available") | {rssi, apninfo, technology}''

{
  "rssi": "-51",
  "apninfo": "railnet.telekom,-1,-1",
  "technology": "lte"
}
{
  "rssi": "-70",
  "apninfo": "fv1.deutschebahn.com,-1,-1",
  "technology": "lte"
}

@fnordomat
Copy link
Author

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment