cracker0dks / captchasolver Goto Github PK
View Code? Open in Web Editor NEWJDownload 2 Offline Captcha Solver
JDownload 2 Offline Captcha Solver
Hi,
I got twice Ubuntu Desktop and Ubuntu Server (both 20.04) running.
I tried to setup the CaptchaSolver for both systems, but JD does not work with the solver.
Darknet compiled and working correctly with sample image, npm installed, scripts tried.
If I download sth from k2s, the popup always shows up for manual input.
I put the offlineSolver with darknet in it to 'tools' and k2s_linux to the methods folder, but nothing is working. A common issue at linux?
I'm aware that this site section of the site is probably considered "serious", but I have no other means of contacting you. Sorry if that's a problem.
The solver doesn't work. JD2 gets stuck in an infinite loop of "starting..." -> "captcha recognition" and that's it. Tested with Fileboom, Tezfiles and Filejoker. Tried test.bat and it didn't show any errors.
I'm using the latest versions of both your solver and JD2 on Win10. I updated to 2.0.5 a few days ago because the old version (don't know which one that was, unfortunately) stopped working a few weeks ago. Even then it only worked with Fileboom and Tezfiles, but not Filejoker.
I'd be grateful if you could help me out. Your work is very much appreciated!
It is not clear from the current instructions what steps to take to get a minimally working example. I tried to install it on Windows, but at the step restart JD2 and start downloading
I don't understand what to do.
Hi,
I'm currently running jdowloader with docker on a Synology NAS, and I can't make the solver work. Thanks to some closed issues here, I think I avoided common problems like nodejs or file permissions.
Whenever jdownloader tries to solve a captcha, it fails and in the logs, it's said that ./darknet wasn't found. But if I run the solver with the terminal (and I can confirm viewing input.gif that the captcha was succesfully pulled from jd), there is absolutely no problem.
The execution through ssh is with the same user than the one used for the jd container, and I even tried with root without success. I also tried to give the container a new volume with direct access to darnek64 directory, but it didn't work either (was thinking maybe "cd darknet64" in the code wasn't working as intended).
I don't know what to try now, and I would gladly take any ideas you could have.
Have a nice day.
logs :
Running -> keep2share.cc
keep2share.cc
/bin/sh: ./darknet: not found
node:child_process:935
throw err;
^
Error: Command failed: cd darknet64 && ./darknet detector test data/obj.data yolov4-tiny-custom.cfg yolov4-tiny-custom_last.weights -dont_show temp.jpg
/bin/sh: ./darknet: not found
at checkExecSyncError (node:child_process:861:11)
at execSync (node:child_process:932:15)
at Timeout._onTimeout (/config/tools/offlineCaptchaSolver/ocr.js:72:30)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
status: 127,
signal: null,
output: [
null,
Buffer(0) [Uint8Array] [],
Buffer(30) [Uint8Array] [
47, 98, 105, 110, 47, 115, 104,
58, 32, 46, 47, 100, 97, 114,
107, 110, 101, 116, 58, 32, 110,
111, 116, 32, 102, 111, 117, 110,
100, 10
]
],
pid: 833,
stdout: Buffer(0) [Uint8Array] [],
stderr: Buffer(30) [Uint8Array] [
47, 98, 105, 110, 47, 115, 104,
58, 32, 46, 47, 100, 97, 114,
107, 110, 101, 116, 58, 32, 110,
111, 116, 32, 102, 111, 117, 110,
100, 10
]
}
Hello,
the keep2share method is also valid for "dfiles.eu" and "fboom.me".
Could you please add these two services ("dfiles.eu" and "fboom.me") to the jacinfo.xml
files located in the JDownloader 2.0/jd/captcha/methods/keep2share_*
folders?
Thank you!
Not sure what I'm doing wrong. I believe I'm following every instruction. Granted I am a total newbie at this but I'm finding it very frustrating lol
My node.js is 14.15.5 according to node -v
when i follow that up with echo $PATH I get
I compiled darknet according to this tutorial https://pjreddie.com/darknet/install/
substituting AlexeyAB's fork instead of pjreddie's from the tutorial.
I used "make" with OpenCV since my Mac doesn't have CUDA and I succeeded in getting a bunch of windows with eagles to show up when I tested it (as per that tutorial), proving I'd compiled darknet correctly.
Then I plugged it into jDownloader 2.0 as specified in the instructions
Along with the content from the CaptchaSolver git repository
When I clone this repository, I find keep2share_linux and keep2share_win for placing in captcha -> methods, is there a missing keep2share_mac perhaps? Or keep2share_osx?
Anyway, even after multiple restarts, jDownloader 2.0 still makes me solve Captchas manually. Arg.
I will say I tried this on a Windows machine with your standalone zip "win" install method and it worked flawlessly, which is amazing, but I really need it to work on my Mac lol please help!
I need help for creating the OCR i asked for help in Stack Overflow but it got closed I don't know how :( Saw your answer in someone else's question surprised by the answer so came your to ask for help by you please try to help me
my email :- [email protected]
How can I recognize the caracteres about this image https://github.com/cracker0dks/CaptchaSolver/blob/master/docs/ksinput.gif .
MacOS: For Intel Macs (Latest)
NodeJS: Installed via Homebrew (Latest)
Tried both Precompiled then tried Compile darknet on your own method both didn't work.
Just to mention, I'm kinda nube in this territory.
But for Compile darknet on your own method it seemed complied fine for me. Here's an screenshot:
(Based on this: https://pjreddie.com/darknet/install/ it is complied correctly I guess)
Here's a video inside the JD2 app like what it's doing:
https://github.com/cracker0dks/CaptchaSolver/assets/52377889/7d54e207-ebbc-49fe-a203-1fddf3e7ad92
Hi
I downloaded and installed your Captcha solver as your instructions (my OS is Windows 11) but after that it is not working ,
So is there an another configuration should be set ? in Captches window still i select "Dialog (windows) in jdownloader" service and i don't show service as "Offline Captcha solver" , how i activate Offline Captcha solver in jdownloader?
Thanks
what is j downloader 2? btw
a downowd manager?
Hi, can you create a guide about "How to resolve one digit captcha" with tesseract.js and jimp?
I'll show you some example images of real cases:
I'm trying to extract the number from the image, but very bad results.
I thought the problem was the double background that conflicts with the digit, for this reason I created an additional function to try to unify the background color.
`
app.post(
"/api/watch_videos",
async (req, res) => {
try {
const browser = await puppeteer.launch({
headless: false,
executablePath: 'C:\Program Files\Google\Chrome\Application\chrome.exe', // Specify the path to Google Chrome
args: ['--disable-web-security', '--mute-audio'], // Disable web security
});
const videoLinks = req.body.videoLinks;
const cookies = splitCookies();
for (const link of videoLinks) {
const page = await browser.newPage();
await page.setCookie(...cookies);
// Go to the website
await page.goto(
`https://placeholder.etc/${link}`
);
if (!isCaptchaRequired(page)) {
// do my stuff
} else {
console.log("Captcha found, enter here");
// Here, you need to solve the images with tesseract.js
await page.waitForSelector('img[src^="data:image/jpeg;base64"]');
const images = await page.$$eval('img[src^="data:image/jpeg;base64"]', imgs => imgs.map(img => img.getAttribute('src')));
const imagesText = await page.$eval('.container-fluid h3.text-center', (element) => element.innerHTML);
if (images && images.length > 0) {
// Use the map() method to remove the initial part from each URL
const modifiedImages = images.map((imageUrl) => {
// Use the substring() method to remove "data:image/jpeg;base64,"
const modifiedUrl = imageUrl.substring("data:image/jpeg;base64,".length);
console.log(modifiedUrl.substring(0, 20));
return modifiedUrl;
});
let srcSx = []
let srcDx = []
switch (images.length) {
case 2:
srcSx.push(modifiedImages[0]);
srcDx.push(modifiedImages[1]);
break;
case 3:
srcSx.push(modifiedImages[0]);
const parts = imagesText.split("> + <");
const lastPart = parts[parts.length - 1];
const match = lastPart.match(/src="data:/g)
console.log(match);
if (match && match.length > 1) {
srcDx.push(modifiedImages[1]);
} else {
srcSx.push(modifiedImages[1]);
}
srcDx.push(modifiedImages[2]);
break;
case 4:
srcSx.push(modifiedImages[0]);
srcSx.push(modifiedImages[1]);
srcDx.push(modifiedImages[2]);
srcDx.push(modifiedImages[3]);
break;
default:
break;
}
if (srcSx.length > 0 && srcDx.length > 0) {
console.log("srcSx.length ", srcSx.length);
console.log("srcDx.length ", srcDx.length);
const worker = await createWorker('eng');
(async () => {
await worker.setParameters({
tessedit_char_whitelist: '0123456789',
user_defined_dpi: '300', // Set the desired resolution (300 DPI)
});
for (const base64 of srcSx) {
const imageBuffer = Buffer.from(base64, 'base64');
const imageBufferModified = await modifyBackground(imageBuffer);
const {
data: {
text
}
} = await worker.recognize(imageBufferModified, "eng");
console.log(`Text from srcSx: ${text}`);
}
for (const base64 of srcDx) {
const imageBuffer = Buffer.from(base64, 'base64');
const imageBufferModified = await modifyBackground(imageBuffer)
const {
data: {
text
}
} = await worker.recognize(imageBufferModified, "eng");
console.log(`Text from srcDx: ${text}`);
}
await worker.terminate();
})();
}
}
}
}
// Close the browser at the end
await browser.close();
res.status(200).send(
"Videos watched successfully."
);
} catch (error) {
console.error(error);
res.status(500).send(
"Error while watching the videos."
);
}
}
);
async function modifyBackground(imageBuffer) {
return new Promise((resolve, reject) => {
sharp(imageBuffer)
.raw()
.toBuffer(async (err, buffer, info) => {
if (err) {
reject(err);
return;
}
const width = info.width;
const height = info.height;
const channels = info.channels;
// Define a threshold to determine if a color is "close" to white or black
const threshold = 10; // Adjust this value as needed
// Read the color of the first pixel in the upper left
const firstPixelIndex = 0;
const firstPixelRed = buffer.readUInt8(firstPixelIndex);
const firstPixelGreen = buffer.readUInt8(firstPixelIndex + 1);
const firstPixelBlue = buffer.readUInt8(firstPixelIndex + 2);
// Calculate the opposite color
const newBackgroundColor = {
red: 255 - firstPixelRed,
green: 255 - firstPixelGreen,
blue: 255 - firstPixelBlue,
};
// Iterate through the pixels of the image
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
const pixelIndex = (y * width + x) * channels;
// Read the color channels of the pixel
const red = buffer.readUInt8(pixelIndex);
const green = buffer.readUInt8(pixelIndex + 1);
const blue = buffer.readUInt8(pixelIndex + 2);
// Check if the pixel color is close to white or black
if (
Math.abs(red - firstPixelRed) <= threshold &&
Math.abs(green - firstPixelGreen) <= threshold &&
Math.abs(blue - firstPixelBlue) <= threshold
) {
// Change the color of the pixel to the new background
buffer.writeUInt8(newBackgroundColor.red, pixelIndex); // R
buffer.writeUInt8(newBackgroundColor.green, pixelIndex + 1); // G
buffer.writeUInt8(newBackgroundColor.blue, pixelIndex + 2); // B
}
}
}
const modifiedImageBuffer = await sharp(buffer, {
raw: {
width,
height,
channels,
},
})
.toFormat('png')
.toBuffer();
// Now buffer contains the image data with the new background based on the opposite of the first pixel
resolve(modifiedImageBuffer);
// Save the resulting image to see the result (TEST)
sharp(buffer, {
raw: {
width,
height,
channels
}
})
.toFile('modified_image.png', (err) => {
if (err) {
console.error('Error saving: ", err);
} else {
console.log('Success saving');
}
});
});
});
};
`
This is the difference between per-unifying background color -> post-unifying background color
PRE:
POST:
After all this, tesseract still fails to extract the number
You might say that I'm just complicating my life, and surely the answer is "yes",
but I'm here to look for a more effective solution.
Thanks
Hi,
ive tried to compile it for my Raspberry Pi Zero w which is Arm 32, but i could´nt get it to work.
I ve never compiled something on my Raspberry pi, is there another way?
Is it easier to compile the tar.gz file?
Could you compile it for me?
Thanks
Hi there, i tried to run this but is not working on Linux, i tested installing NODEJS from debian 11 repo and for NodeJS official repos, but when jdownloader try to download from K2s its tun on a loop of getting captcha.
Any ideas? Thanks!
How to run this on Windows 32bit ?
Hello! I am kind of lost of the commands I need to run to solve an image. Please be kind to provide me with some help on the subject. Example scenario: I have an image called captcha.png. What should I run to solve it and get the letters in the captcha?
Hi, this doesn't seem to be working on k2s anymore.
Hey cracker0dks,
first of all I want to express my highest appreciation for your 6-lettercase OCR of captchas working extremely well. After having tested your script since 6 months I just discovered one challenge. Whenever the captchas did contain a lowercase letter "i" or uppercase letter "I" this would lead to double recognitions of this same letter as in your discovered font the lower & upper case letter "I" are exactly the same. Any chance you could further improve your recognition script to encounter this little challenge?
Thanks & BR,
Edgar
Hi, sorry to bother you. This looks cool. I wanted to use this for Tezfiles.com instead of keep2share and the captcha looks the same. Is there a simple thing I can do to make it use this engine for that instead of for keep2share?
Hi, I'm trying to use the captchasolver with a jdownloader2 installed on a raspberry pi 4, but it's not working and I'm getting this on the log.txt file on the offlinecaptchasolver folder:
node:internal/modules/cjs/loader:958
throw err;
^
Error: Cannot find module 'jimp'
Require stack:
Node.js v18.8.0
Hello @cracker0dks!
I'm running JD2 from jlesage as a Docker container on my QNAP NAS inside the Container Station.
Unfortunately, i haven't found anything in the web that could help me to use your "app".
Do you have any tips and tricks to use your code within my constellation?
best regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.