Last active
March 19, 2020 08:19
-
-
Save sergioska/e3d8d31a8ae9755f2f31f6c223438697 to your computer and use it in GitHub Desktop.
Honeypot (js bot trap)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>test bot trap</title> | |
<script type="text/javascript"> | |
// Set cookie. | |
function setCookie(name, value, expires, path, domain, secure) { | |
document.cookie = name + "=" + escape(value) + | |
((expires) ? "; expires=" + expires : "") + | |
((path) ? "; path=" + path : "") + | |
((domain) ? "; domain=" + domain : "") + | |
((secure) ? "; secure" : ""); | |
} | |
// Get cookie. | |
function getCookie(name) { | |
var cookie = " " + document.cookie; | |
var search = " " + name + "="; | |
var setStr = null; | |
var offset = 0; | |
var end = 0; | |
if (cookie.length > 0) { | |
offset = cookie.indexOf(search); | |
if (offset != -1) { | |
offset += search.length; | |
end = cookie.indexOf(";", offset) | |
if (end == -1) { | |
end = cookie.length; | |
} | |
setStr = unescape(cookie.substring(offset, end)); | |
} | |
} | |
return(setStr); | |
} | |
// Delete cookie. | |
function delCookie(name) { | |
document.cookie = name + "=" + "; expires=Thu, 01 Jan 1970 00:00:01 GMT"; | |
} | |
// Set cookie for 1 hour: | |
date = new Date(); | |
date.setHours(date.getHours() + 1); | |
setCookie('i_m_a_bro', 'yes', date.toUTCString()); | |
function redir() { | |
var cookieCheck = getCookie('i_m_a_bro'); | |
if (cookieCheck == 'yes') { | |
delCookie('i_m_a_bro'); | |
} | |
else | |
alert ("YOU ARE A FUCKING BOT!"); | |
} | |
</script> | |
</head> | |
<body onload="setTimeout(redir(), 300);"> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment