Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save silversword411/9ed836b0674ee6cc391f81569b539860 to your computer and use it in GitHub Desktop.
Save silversword411/9ed836b0674ee6cc391f81569b539860 to your computer and use it in GitHub Desktop.
web page based port knocker
<!DOCTYPE html>
<html>
<head>
<title>Load URLs in iframes</title>
<script type="text/javascript">
window.onload = function() {
// Load the first URL immediately in the first iframe
// Note1: Make port numbers greater than 10000 so you're up in the random ranges
// Note2: Make first port bigger than 2nd port. So port scanners scanning 1-65535 don't hit them in sequence
document.getElementById('frame1').src = "https://myurl.com:32999";
// Wait for 2 seconds then load the second URL in the second iframe
setTimeout(function(){
document.getElementById('frame2').src = "https://myurl.com:18343";
}, 2000); // Time is in milliseconds
// Initialize countdown
var countdown = document.getElementById('countdown');
var timeLeft = 3;
countdown.innerHTML = 'Redirecting in ' + timeLeft + ' seconds...';
// Update countdown every second
var countdownInterval = setInterval(function() {
timeLeft--;
if (timeLeft < 0) {
clearInterval(countdownInterval);
// Wait for 2 seconds then redirect to the new URL
window.location.href = "https://google.com";
} else {
countdown.innerHTML = 'Redirecting in ' + timeLeft + ' seconds...';
}
}, 1000);
};
</script>
</head>
<body>
<iframe id="frame1" width="1" height="1"></iframe>
<iframe id="frame2" width="1" height="1"></iframe>
<p id="countdown"></p>
<a href='https://google.com'>GO</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment