Skip to content

Instantly share code, notes, and snippets.

@gbaptista
Last active May 19, 2021 16:36
Show Gist options
  • Save gbaptista/0bcc5968dbfc4bfd0f1b94a41febe67c to your computer and use it in GitHub Desktop.
Save gbaptista/0bcc5968dbfc4bfd0f1b94a41febe67c to your computer and use it in GitHub Desktop.
Ensure Captive Portal for Wi-Fi in Hotels
const DEBUG = true;
const urls = [
'https://login.globalsuite.net',
'http://neverssl.com',
'http://neverssl.com',
'https://login.globalsuite.net',
'http://neverssl.com',
'http://neverssl.com',
'https://login.globalsuite.net',
'http://neverssl.com',
'http://neverssl.com',
'https://login.globalsuite.net'
];
const domain = window.location.hostname;
const url = urls[Math.floor(Math.random() * urls.length)];
setTimeout(() => {
if(DEBUG) console.log('Hotel Wi-Fi |', 'Fallback.', domain);
window.location.href = url;
}, 60 * 1000);
$(document).ready(function() {
if(DEBUG) console.log('Hotel Wi-Fi |', 'Loaded!', domain);
const minWaitTime = 1 * 1000;
const maxWaitTime = 5 * 1000;
const waitFor = Math.floor(
Math.random() * (maxWaitTime - minWaitTime + 1) + minWaitTime
);
setTimeout(() => {
if(DEBUG) console.log('Hotel Wi-Fi |', 'Reloading...', domain);
setTimeout(() => { window.location.href = url; }, waitFor);
}, waitFor);
});
{
"manifest_version": 2,
"name": "Hotel Wi-Fi",
"short_name": "Hotel Wi-Fi",
"description": "Hotel Wi-Fi fixer.",
"version": "0.0.1",
"author": "Guilherme Baptista",
"developer": {
"name": "Guilherme Baptista",
"url": "http://gbaptista.com"
},
"applications": {
"gecko": {
"id": "hotel-wifi@gbaptista.com"
}
},
"permissions": [
"*://*.globalsuite.net/*",
"*://*.hiltonwifi.com/*",
"*://neverssl.com/*"
],
"content_scripts": [
{
"run_at": "document_start",
"matches": [
"*://*.globalsuite.net/*",
"*://*.hiltonwifi.com/*",
"*://neverssl.com/*"
],
"all_frames": false,
"js": [
"jquery-3.6.0.slim.min.js",
"content.js"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment