Greasy Fork

Greasy Fork is available in English.

Anti-Hack Detector

Detects and reports hackers in the game.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Anti-Hack Detector
// @namespace    https://www.example.com
// @version      1.0
// @description  Detects and reports hackers in the game.
// @author       Your Name
// @match        https://www.example.com/game
// @grant        GM_xmlhttpRequest
// ==/UserScript==

// Monitor player actions and detect suspicious behavior
function monitorPlayerActions() {
  // Record the initial state of relevant player attributes
  let initialHealth = getPlayerHealth();
  let initialScore = getPlayerScore();

  // Check for changes in player attributes periodically
  setInterval(() => {
    const currentHealth = getPlayerHealth();
    const currentScore = getPlayerScore();

    // Detect suspicious behavior (e.g., rapid health regeneration, instant high scores)
    if (currentHealth > initialHealth * 2) {
      reportHacker('Health hacking detected!');
    }

    if (currentScore - initialScore > 1000) {
      reportHacker('Score hacking detected!');
    }

    // Update the initial state for the next check
    initialHealth = currentHealth;
    initialScore = currentScore;
  }, 5000); // Adjust the interval as needed
}

// Get the player's current health from the game's DOM or API
function getPlayerHealth() {
  // Implement logic to retrieve the player's health
  // For example: return document.getElementById('health').innerText;
}

// Get the player's current score from the game's DOM or API
function getPlayerScore() {
  // Implement logic to retrieve the player's score
  // For example: return document.getElementById('score').innerText;
}

// Report a hacker to the server
function reportHacker(reason) {
  const hackerData = {
    player: getPlayerName(),
    reason: reason
  };

  // Send a POST request to your server to report the hacker
  GM_xmlhttpRequest({
    method: 'POST',
    url: 'https://www.example.com/report',
    headers: { 'Content-Type': 'application/json' },
    data: JSON.stringify(hackerData),
    onload: function (response) {
      console.log('Hacker reported:', response.responseText);
    }
  });
}

// Get the player's name from the game's DOM or API
function getPlayerName() {
  // Implement logic to retrieve the player's name
  // For example: return document.getElementById('player-name').innerText;
}

// Entry point
(function () {
  monitorPlayerActions();
})();