Skip to content

Instantly share code, notes, and snippets.

@Coxxs

Coxxs/2077.html Secret

Created October 21, 2019 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Coxxs/590e47cd4ee28aa14c671b4c6e3984ec to your computer and use it in GitHub Desktop.
Save Coxxs/590e47cd4ee28aa14c671b4c6e3984ec to your computer and use it in GitHub Desktop.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Flag of 64th Competition</title>
</head>
<body>
<main style="font-family:Monaco,Consolas,'Lucida Console','Courier New',serif">Loading ...</main>
<script>(function () {
var now = new Date().toUTCString()
var main = document.getElementsByTagName('main')[0]
var ua = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) HEICORE/49.1.2623.213 Safari/537.36'
fetch('flag.txt', {method: 'POST', headers: {'If-Unmodified-Since': now, 'User-Agent': ua}}).then(function (res) {
if (res.ok) {
res.text().then(function (text) {
main.innerText = 'The flag is "' + text + '".'
})
} else {
var lastModified = res.headers.get('Last-Modified')
setInterval(function () {
var diff = (new Date(lastModified).getTime() - Date.now()) / 1000
var diffSeconds = Math.floor(diff % 86400), diffDays = Math.floor(diff / 86400)
main.innerText = 'Not yet! The competition will start after ' + diffDays + ' days and ' + diffSeconds + ' seconds.'
}, 1000)
}
})
})()</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment