cracker0dks / CaptchaSolver

JDownload 2 Offline Captcha Solver
282 stars 23 forks source link

Synology : work manually but not inside jdownloader #30

Closed Nihilus2130 closed 7 months ago

Nihilus2130 commented 7 months ago

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
  ]
}
cracker0dks commented 7 months ago

Dont see a obvious error here. You could try to add some debug output like pwd and ls into the "keep2share.cc.sh" file (after the first "sleep1" so you may get in witch dir you are at the time and whats in it?

Nihilus2130 commented 7 months ago

Well I really don't understand what's going on. With the modification of "keep2share.cc.sh", I get a totally normal output :

/config/tools/offlineCaptchaSolver
@eaDir
checkdeps.bat
checkdeps.sh
darknet64
filejoker.bat
filejoker.sh
input.gif
keep2share.cc.bat
keep2share.cc.sh
log.txt
node.exe
node_modules
ocr.js
package-lock.json
package.json
result.txt

So I tried directly on the ocr.js file, to see what it got after the cd, and that's what I get, which again is what is expected :

Running -> keep2share.cc
keep2share.cc
/config/tools/offlineCaptchaSolver/darknet64
total 26788
-rwxr-xr-x    1 root     root          3652 Mar 10 13:07 3vyEyi.png
drwxrwxrwx    1 root     root            66 Apr  8 12:10 @eaDir
-rwxr-xr-x    1 root     root         32379 Mar 10 13:07 bad.list
-r-xr-xr-x    1 root     root       1063616 Mar 10 13:07 darknet
-rwxr-xr-x    1 root     root       1031680 Mar 10 13:07 darknet.dll
-rwxr-xr-x    1 root     root         12206 Mar 10 13:07 darknet.exp
-rwxr-xr-x    1 root     root         20700 Mar 10 13:07 darknet.lib
-rwxr-xr-x    1 root     root       1033728 Mar 10 13:07 darknet_no_gpu.exe
drwxr-xr-x    1 root     root            46 Mar 10 13:07 data
-rwxr-xr-x    1 root     root         11628 Apr  8 13:52 predictions.jpg
-rwxr-xr-x    1 root     root         82944 Mar 10 13:07 pthreadVC2.dll
-rwxr-xr-x    1 root     root         20033 Apr 10 12:09 temp.jpg
-rwxr-xr-x    1 root     root           128 Mar 10 13:07 test.bat
-rwxr-xr-x    1 root     root         37376 Mar 10 13:07 uselib.exe
-rwxr-xr-x    1 root     root          3026 Mar 10 13:07 yolov4-tiny-custom.cfg
-rwxr-xr-x    1 root     root      24084956 Mar 10 13:07 yolov4-tiny-custom_last.weights

/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:75: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: 1220,
  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
  ]
}

So it sees the file, but when trying to execute, it doesn't see it anymore ...

fredo-47 commented 7 months ago

Btw, in my scripts bash is used instead of sh. Not sure if I myself changed that some time ago.

It may depend on what shell your Synology uses, or your Docker image...

Nihilus2130 commented 7 months ago

Okay I think that's spot on ! I found this :

So I need to find a way to use bash inside the container, or modify the scripts.

Nihilus2130 commented 7 months ago

I may have been too enthousiatic with this solution, and I should have seen that the scripts were already starting with #!/bin/sh. Nonetheless, I tried adding bash inside the container, but it didn't help.

The only other thing I could think of was to recompile darknet, but it was strange to me because it was running fine on the NAS through ssh. That was before reading more carefully this previous issue https://github.com/cracker0dks/CaptchaSolver/issues/14 So recompiling was the way to go, I should have tried this way earlier.

Thanks for the help guys !

Now I have a new question / problem (feel free to close this thread if you want me to open a new issue for this), is the solver not working when starting multiple downloads at once ? Like I had 10 downloads requiering the same type of captcha, and only the first one worked, the other 9 were stuck in the starting phase until I stopped them (roughly one hour later). And when starting them manually one by one, everything was fine.

Nihilus2130 commented 7 months ago

You can forget the last bit, seems to be a jd problem when handling a certain number of launch while using multiple proxies.