├── scripts ├── background.js └── main.js ├── .gitignore ├── icon.png ├── manifest.json ├── package.json └── readme.md /scripts/background.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | chesscheat.zip -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaverinOnRails/chesscheat/HEAD/icon.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 3, 3 | "name": "Chesscheat", 4 | "version": "1.3", 5 | "icons": { "16": "icon.png", 6 | "48": "icon.png", 7 | "128": "icon.png" }, 8 | "browser_specific_settings": { 9 | "gecko": { 10 | "id": "chesscheatextension@gmail.com" 11 | } 12 | }, 13 | "description": "Always see the optimal move in any chess.com game. Guarantees wins almost 100% of the time", 14 | "content_scripts": [ 15 | { 16 | "js": ["scripts/main.js"], 17 | "matches": [ 18 | "https://www.chess.com/*", 19 | "https://chess.com/*" 20 | ] 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chesscheat", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/Eugenenoble2005/chesscheat.git" 12 | }, 13 | "author": "", 14 | "license": "ISC", 15 | "bugs": { 16 | "url": "https://github.com/Eugenenoble2005/chesscheat/issues" 17 | }, 18 | "homepage": "https://github.com/Eugenenoble2005/chesscheat#readme", 19 | "dependencies": { 20 | "stockfish.wasm": "^0.10.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 |

Chess Cheat

2 |

Chess cheat utilizes the stockfish engine and the power of your computer to show you the best move to make in any chess.com game. It guarantees you wins in atleast 90% of games you play and can greatly help you improve your chess skills. 3 | 4 | Note: this project was developed for learning purposes, I do not condone or encourage cheating in games and this project should help you get better at chess. Non fair play might result in your chess.com account being suspended if you do not use wisely. 5 |
6 | 7 | 8 | https://user-images.githubusercontent.com/71329328/221189107-244544b0-8070-4ee3-973f-c4c9bfa15067.mp4 9 | 10 | 11 |

How to install:

12 | First clone this repo if you have git installed on your machine: 13 | 14 | git clone https://github.com/Eugenenoble2005/chesscheat.git 15 | 16 | 17 | If you do not have git installed, you may download this repo as a zip by following this link: 18 | Zip Download 19 | 20 | 21 | Open google chrome and visit 'chrome://extensions'. 22 | Enable developer mode by clicking the toggle at the top right. Click 'Load Unpacked' and finally select the folder where you have cloned or extracted the repo. Activate the extension and done. -------------------------------------------------------------------------------- /scripts/main.js: -------------------------------------------------------------------------------- 1 | //this is quite possibly the most disgusting piece of code i've ever written. 2 | var hackRunning = false; 3 | var globalDepth = 15; 4 | function main() { 5 | const chessboard = document.querySelector("wc-chess-board"); 6 | var player_colour = chessboard.classList.contains("flipped") ? "b" : "w"; 7 | //generate FEN string from board, 8 | function getFenString() { 9 | let fen_string = "" 10 | for (var i = 8; i >= 1; i--) { 11 | for (var j = 1; j <= 8; j++) { 12 | let position = `${j}${i}` 13 | //for every new row on the chessboard 14 | if (j == 1 && i != 8) { 15 | fen_string += "/" 16 | } 17 | let piece_in_position = document.querySelectorAll(`.piece.square-${position}`)[0]?.classList ?? null 18 | //get piece name by shortest class 19 | if (piece_in_position != null) { 20 | for (var item of piece_in_position.values()) { 21 | if (item.length == 2) { 22 | piece_in_position = item 23 | } 24 | } 25 | } 26 | //if position is empty 27 | if (piece_in_position == null) { 28 | //if previous position is empty, sum up numbers 29 | let previous_char = fen_string.split("").pop() 30 | if (!isNaN(Number(previous_char))) { 31 | fen_string = fen_string.substring(0, fen_string.length - 1) 32 | fen_string += Number(previous_char) + 1 33 | } 34 | else { 35 | fen_string += "1" 36 | } 37 | } 38 | else if (piece_in_position?.split("")[0] == "b") { 39 | fen_string += piece_in_position.split("")[1] 40 | } 41 | else if (piece_in_position?.split("")[0] == "w") { 42 | fen_string += piece_in_position.split("")[1].toUpperCase() 43 | } 44 | 45 | } 46 | } 47 | return fen_string 48 | } 49 | let fen_string = getFenString() 50 | fen_string += ` ${player_colour}` 51 | console.log(fen_string) 52 | const engine = new Worker("/bundles/app/js/vendor/jschessengine/stockfish.asm.1abfa10c.js") 53 | engine.postMessage(`position fen ${fen_string}`) 54 | engine.postMessage('go wtime 300000 btime 300000 winc 2000 binc 2000'); 55 | engine.postMessage("go depth ${globalDepth}") 56 | //listen for when moves are made 57 | var getPlays = setInterval(() => { 58 | let new_fen_string = getFenString() 59 | new_fen_string += ` ${player_colour}` 60 | if (new_fen_string != fen_string) { 61 | fen_string = new_fen_string 62 | engine.postMessage(`position fen ${fen_string}`) 63 | engine.postMessage('go wtime 300000 btime 300000 winc 2000 binc 2000'); 64 | console.log(globalDepth); 65 | engine.postMessage("go depth ${globalDepth}") 66 | } 67 | }) 68 | engine.onmessage = function(event) { 69 | if (event.data.startsWith('bestmove')) { 70 | const bestMove = event.data.split(' ')[1]; 71 | // Use the best move in your application 72 | char_map = { "a": 1, "b": 2, "c": 3, "d": 4, "e": 5, "f": 6, "g": 7, "h": 8 } 73 | console.log('Best move:', bestMove); 74 | document.getElementById("best-move").innerHTML = ` Bestmove is ${bestMove} at depth ${globalDepth}. Tap to stop` 75 | //create cheat squares on the board 76 | previous_cheat_squares = document.querySelectorAll(".cheat-highlight").forEach((element) => { 77 | //remove all previous cheat squares 78 | element.remove() 79 | }) 80 | bestMove_array = bestMove.split("") 81 | initial_position = `${char_map[bestMove_array[0]]}${bestMove_array[1]}` 82 | final_position = `${char_map[bestMove_array[2]]}${bestMove_array[3]}` 83 | 84 | initial_highlight = document.createElement("div"); 85 | initial_highlight.className = `highlight cheat-highlight square-${initial_position}` 86 | initial_highlight.style = "background:red;opacity:0.5" 87 | 88 | final_highlight = document.createElement("div"); 89 | final_highlight.className = `highlight cheat-highlight square-${final_position}` 90 | final_highlight.style = "background:red;opacity:0.5" 91 | chessboard.appendChild(initial_highlight) 92 | chessboard.appendChild(final_highlight) 93 | } 94 | } 95 | //try to stop hack 96 | document.getElementById("hack_button").onclick = () => { 97 | if (hackRunning == false) { 98 | startHack(document.getElementById("hack_button")); 99 | return; 100 | } 101 | //stop listening for moves effectively stoping stockfish 102 | clearInterval(getPlays); 103 | //delete all cheat squares 104 | document.querySelectorAll(".cheat-highlight").forEach((element) => { 105 | element.remove(); 106 | }); 107 | //set hackRunning to false; 108 | hackRunning = false; 109 | document.getElementById("hack_button").innerHTML = "Start Hack Again"; 110 | return { status: "false" } 111 | 112 | } 113 | return { status: true } 114 | 115 | } 116 | function startHack(element) { 117 | console.log(hackRunning); 118 | if (hackRunning == true) { 119 | return; 120 | } 121 | hackRunning = true; 122 | element.innerHTML = "Please Wait.." 123 | element.disabled = true 124 | //wait until chessboard content is probably loaded 125 | let hack = main() 126 | if (hack.status == true) { 127 | element.disabled = false; 128 | element.innerHTML = `Hack running. Calculating Best move. Tap to stop` 129 | } 130 | else { 131 | element.innerHTML = "Start Hack" 132 | element.disabled = false 133 | alert(hack.error) 134 | } 135 | } 136 | var button = document.createElement("button"); 137 | var input = document.createElement("input"); 138 | input.value = globalDepth; 139 | input.placeholder = "Depth, choose anywhere under 40. Very high values can cause your browser to leak and freeze." 140 | button.className = "ui_v5-button-component ui_v5-button-primary ui_v5-button-large ui_v5-button-full" 141 | button.innerHTML = "Start Hack" 142 | input.addEventListener("input", function() { 143 | globalDepth = this.value; //i dont care 144 | }) 145 | //start hack when button is clicked 146 | button.id = "hack_button"; 147 | button.onclick = () => { startHack(button) } 148 | let main_body = document.querySelector(".board-layout-main") 149 | main_body.prepend(input); 150 | main_body.prepend(button) 151 | --------------------------------------------------------------------------------