Compare commits

..

No commits in common. "4f1a638b64e00b4b5e0e76b64539fdc3d27e1dba" and "0917adccbaa18430e4e1a7e54690101155746145" have entirely different histories.

3 changed files with 25 additions and 37 deletions

View file

@ -41,15 +41,6 @@ const textInputs = document.querySelectorAll('input[type="text"]')
const captcha = document.querySelectorAll('.captcha') const captcha = document.querySelectorAll('.captcha')
const captchaInput = document.querySelectorAll('.captcha-input') const captchaInput = document.querySelectorAll('.captcha-input')
const captchaVerifyButton = document.querySelectorAll('.captcha-verify') const captchaVerifyButton = document.querySelectorAll('.captcha-verify')
const botBadge = document.createElement('div')
if (debugEnabled) {
botBadge.className = 'bot-badge'
document.body.appendChild(botBadge)
botBadge.setAttribute(
'style',
'position: fixed; top: 0; right: 0; z-index: 9999; background-color: red; color: white; font-weight: bold; height:20px; width:20px'
)
}
// Utility variables // Utility variables
let startTime = Date.now() let startTime = Date.now()
@ -80,7 +71,6 @@ function setUserInteracted() {
lastInteractionTime = currentTime lastInteractionTime = currentTime
userInteracted = true userInteracted = true
interactionCount++ interactionCount++
checkForBotBehavior()
} }
function handleMouseMove(event) { function handleMouseMove(event) {
@ -120,31 +110,26 @@ function checkForBotBehavior() {
honeypotInput2.value !== '' || honeypotInput2.value !== '' ||
verifyEmailInput.value !== '' verifyEmailInput.value !== ''
if (debugEnabled) if (debugEnabled)
if (!botDetected) { console.log(
botBadge.style.backgroundColor = 'green' 'Bot Detected: ' +
} else { botDetected +
botBadge.style.backgroundColor = 'red' ' userInteracted:' +
} userInteracted +
console.log( ' interactionCount:' +
'Bot Detected: ' + interactionCount +
botDetected + ' timeSpent:' +
' userInteracted:' + timeSpent +
userInteracted + ' isStraightLine:' +
' interactionCount:' + isStraightLine +
interactionCount + ' mousePositions:' +
' timeSpent:' + mousePositions.length +
timeSpent + ' honeypotInput1:' +
' isStraightLine:' + honeypotInput1.value +
isStraightLine + ' honeypotInput2:' +
' mousePositions:' + honeypotInput2.value +
mousePositions.length + ' verifyEmailInput:' +
' honeypotInput1:' + verifyEmailInput.value
honeypotInput1.value + )
' honeypotInput2:' +
honeypotInput2.value +
' verifyEmailInput:' +
verifyEmailInput.value
)
} }
function handleSubmit(e) { function handleSubmit(e) {
e.preventDefault() e.preventDefault()

View file

@ -73,7 +73,7 @@ kommentar = 'age und hobbies sind honeypots'
<input type="email" id="email" name="email" requir > <input type="email" id="email" name="email" requir >
</div> </div>
<div> <div>
<input type="verify_email" id="verify_email" name="verify_email" > <input type="verify_email" id="verify_email" value="someValue" name="verify_email" >
</div> </div>
<div id="zsr-tooltip" data-tooltip="Bitte geben Sie eine gültie ZSR-Nummer, oder 'beantragt' ein."> <div id="zsr-tooltip" data-tooltip="Bitte geben Sie eine gültie ZSR-Nummer, oder 'beantragt' ein.">
<label for="zsr_nummer">ZSR Nummer</label> <label for="zsr_nummer">ZSR Nummer</label>

View file

@ -23,7 +23,10 @@ try {
$bot = $_POST['tra'] ; $bot = $_POST['tra'] ;
if ($bot == 'true') { // Überprüfe, ob der Nutzer mit der Seite interagiert hat
$userInteracted = filter_input(INPUT_POST, 'userInteracted');
if ($bot) {
// Es handelt sich wahrscheinlich um einen Bot // Es handelt sich wahrscheinlich um einen Bot
$subject = 'Botverdacht - ' . $subject; $subject = 'Botverdacht - ' . $subject;
} }