Giter VIP home page Giter VIP logo

Comments (22)

NoahCardoza avatar NoahCardoza commented on August 11, 2024

It looks like there is an error loading the SSL cert. Since it's happening when you are starting a new thread, could you provide some sample code that I could mess around with?

I'm not sure why this would be happening unless you are changing the cwdir maybe? But I'm pretty sure it shouldn't matter since it's all packaged in the module.

from captchaharvester.

NoahCardoza avatar NoahCardoza commented on August 11, 2024

Wait, are you saying this error occurs when you package the Python program into a .exe?

from captchaharvester.

Antonji-py avatar Antonji-py commented on August 11, 2024

yes it's only in exe file, code is your example.py

from captchaharvester.

NoahCardoza avatar NoahCardoza commented on August 11, 2024

Hmm, well I don’t really have access to a Windows computer, so it would be hard for me to test. I’m assuming it has to do with the way it’s packing the files. For some reason the ssl library can’t find the certs when it loads.

Do you get the same error even when you aren’t multithreading?

from captchaharvester.

Antonji-py avatar Antonji-py commented on August 11, 2024

but this is error from your example.py and I have to use threading there

from captchaharvester.

Antonji-py avatar Antonji-py commented on August 11, 2024

I mean I could do it without threading but then it will be useless

from captchaharvester.

NoahCardoza avatar NoahCardoza commented on August 11, 2024

Ah! That’s true 😂. Could you take the threading out (even though it would make it useless) and see if the error still occurs. I’m guess it will, but I want to make sure it’s not the threading library that’s causing the errors.

from captchaharvester.

Antonji-py avatar Antonji-py commented on August 11, 2024

without threading it doesnt work hah, in case im still on discord bro

from captchaharvester.

NoahCardoza avatar NoahCardoza commented on August 11, 2024

Ok, that's good to know. I'd encourage you to try and look into it yourself since I don't have a Windows machine, but I'll look over the code to see if I can find anything that might break in an exe. What are you using to package he exe?

from captchaharvester.

Antonji-py avatar Antonji-py commented on August 11, 2024

actually I use pyarmor but pyarmor uses pyinstaller

from captchaharvester.

NoahCardoza avatar NoahCardoza commented on August 11, 2024

I'm wondering if they are not including the ssl certs in the .exe package...

from captchaharvester.

Antonji-py avatar Antonji-py commented on August 11, 2024

idk, but for me as an developer it isnt big deal but for ppl who want to use my bot is is :(

from captchaharvester.

NoahCardoza avatar NoahCardoza commented on August 11, 2024

Try adding print(__dir__) under

__dir__ = path.dirname(path.abspath(__file__))
, package the .exe again, run it, then use the command line to navigate to the directory path that got printed out and list the files to check if the server.key and server.crt are present.

from captchaharvester.

Antonji-py avatar Antonji-py commented on August 11, 2024

ill do it like in 8h bcs im going sleep, ill let you know here or on discord

from captchaharvester.

NoahCardoza avatar NoahCardoza commented on August 11, 2024

Sounds good!

from captchaharvester.

Antonji-py avatar Antonji-py commented on August 11, 2024

so this is path i got C:\Users\hardc\AppData\Local\Temp_MEI159402\harvester\server
there is no any of files you mentioned, here is ss of files that are there
image

from captchaharvester.

NoahCardoza avatar NoahCardoza commented on August 11, 2024

What's weird is that I don't even see the file structure of the CaptchaHarvester. But, I think you should look into how to include those files because it looks like it's not properly packaging the server.key and server.crt.

I'd suggest you either look at the pyarmor/pyinstaller documentation. There might be some special argument you have to pass you include non-python files.

Otherwise, you might want to manually package the files into the exe.

I don't think this is an issue with my module thought. I'll leave this open for a little bit if you have any questions.

from captchaharvester.

Antonji-py avatar Antonji-py commented on August 11, 2024

ive found that https://pyinstaller.readthedocs.io/en/stable/spec-files.html
i think its nice to mention about that in readme or smth like that to be available to see for everyone

from captchaharvester.

Antonji-py avatar Antonji-py commented on August 11, 2024

ok, so this is how my .spec file looks like right now. it still gives same error, idk maybe im doing smth wrong
image

from captchaharvester.

NoahCardoza avatar NoahCardoza commented on August 11, 2024

Well it might not be packaging them correctly because they are outside of the project...

Maybe try copying them to the project directory and add function parameters to the server.setup function like this:

def setup(server_address: Tuple[str, int], domain: str, captcha_kind: CaptchaKindEnum, sitekey: str,
          data_action: str = None, keyfile: str = None, certfile: str = None) -> ThreadingHTTPServer:
    MITM_CAHCE[domain] = MITMRecord(captcha_kind, sitekey, data_action)
    httpd = ThreadingHTTPServer(server_address, ProxyHTTPRequestHandler)
    httpd.domain = domain
    httpd.socket = ssl.wrap_socket(httpd.socket,
                                   keyfile=keyfile or path.join(
                                       __dir__, 'server.key'),
                                   certfile=certfile or path.join(__dir__, 'server.crt'), server_side=True)
    return httpd

If it fixes the problem I can submit update the project to include those parameters.

from captchaharvester.

Antonji-py avatar Antonji-py commented on August 11, 2024

server.setup? where is that file?

from captchaharvester.

NoahCardoza avatar NoahCardoza commented on August 11, 2024

It's a function in /harvester/server/__init__.py.

from captchaharvester.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.