its cool, i posted this a while back i got one now. just gotta work on cleaning up my gmab script then i may release it.
I was working on one that uses the canvas tag. It should be easy but I can't really wrap my mind around it yet. There's a GM script that uses canvas to solve the megaupload captcha. For neopets, most people embed a swf that "decodes" image
Code (Text): // Create the canvas element var canvas = document.createElement("canvas"); canvas.width = image.width; canvas.height = image.height; // Draw the image onto the canvas var ctx = canvas.getContext("2d"); ctx.drawImage(image, 0, 0); // Get the pixel data var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); // Loop through imageData.data - an array with 4 values per pixel: red, green, blue, and alpha for (int x = 0; x < imageData.width; x++) { for (int y = 0; y < imageData.height; y++) { var index = 4 * (y * imageData.width + x); var r = imageData.data[index]; var g = imageData.data[index + 1]; var b = imageData.data[index + 2]; var a = imageData.data[index + 3]; // Do whatever you need to do with the rgba values } }
This is posted by Belaarx though he mentioned that he found it somewhere. Code (Text): // Last Updated: 2nd Feb 2009 // Lead Programmer: Laser Wave // // ==UserScript== // @name Neopets Auto Haggle // @namespace http://www.neofriends.net/ // @description Auto haggle in main shops // @include http://neopets.com/haggle.phtml* // @include http://www.neopets.com/haggle.phtml* // @include www.neopets.com/haggle.phtml* // @include neopets.com/haggle.phtml* // ==/UserScript== function run_cap() { if (document.location.href.match('haggle.phtml') && (document.body.innerHTML.indexOf("captcha_show.phtml") > -1)) { if(document.body.innerHTML.indexOf("I wont take less than ") > -1) { start_pos = document.body.innerHTML.indexOf("I wont take less than ") + 22; end_pos = document.body.innerHTML.indexOf(" Neopoints for it"); raw_price = document.body.innerHTML.substr(start_pos,end_pos-start_pos); raw_price = raw_price.replace(",",""); document.body.innerHTML = document.body.innerHTML.replace("value=\"0\"","value=\""+haggle_price(raw_price)+"\""); } if(document.body.innerHTML.indexOf("I want at least ") > -1) { start_pos = document.body.innerHTML.indexOf("I want at least ") + 16; end_pos = document.body.innerHTML.indexOf(" Neopoints for this great item"); raw_price = document.body.innerHTML.substr(start_pos,end_pos-start_pos); raw_price = raw_price.replace(",",""); document.body.innerHTML = document.body.innerHTML.replace("value=\"0\"","value=\""+haggle_price(raw_price)+"\""); } allForms = document.evaluate("//form[@name='haggleform']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null); for (var i = 0; i < allForms.snapshotLength; i++) { thisForm = allForms.snapshotItem(i); allImgs = document.evaluate("//input[@type='image']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null); for (var i = 0; i < allImgs.snapshotLength; i++) { var image = allImgs.snapshotItem(i); if(image) { var newImg = document.createElement("img"); newImg.src = image.src; var canvas = unsafeWindow.document.createElement("canvas"); canvas.width = newImg.width; canvas.height = newImg.height; canvas.getContext("2d").drawImage(newImg, 0, 0); var image_data = canvas.getContext("2d").getImageData(0, 0, newImg.width, newImg.height); var lowy = 999; var lowx = 999; var low = 999; for (var x = 0; x < image_data.width; x++) { for (var y = 0; y < image_data.height; y++) { var i = x*4+y*4*image_data.width; var avg = Math.floor((image_data.data[i]+image_data.data[i+1]+image_data.data[i+2])/3); if (avg < low) { low = avg; lowx = x; lowy = y; } } } var newInput = document.createElement("input"); newInput.type="hidden"; newInput.name="x"; newInput.value=lowx; thisForm.appendChild(newInput); var newInput = document.createElement("input"); newInput.type="hidden"; newInput.name="y"; newInput.value=lowy; thisForm.appendChild(newInput); thisForm.submit(); }else{ alert("Image error"); } } } } } function haggle_price(raw_price) { var iVal = new Array(2); iVal[0] = raw_price.substr(0,1); iVal[1] = raw_price.substr(1,1); var x = 0; var end_price = ""; for(x=0; x<raw_price.length; x++) { end_price += iVal[(x%2)]; } return end_price; } window.addEventListener('load', run_cap, false); I've tried it, it works very well.