Coder Social home page Coder Social logo

Implement a PDFRip GUI App about pdfrip HOT 6 OPEN

mufeedvh avatar mufeedvh commented on May 18, 2024
Implement a PDFRip GUI App

from pdfrip.

Comments (6)

Pommaq avatar Pommaq commented on May 18, 2024

Easiest would probably be to add a REST API-like interface to engine instead of the current CLI implementation, then write a simple frontend in vue/whatever

from pdfrip.

Pommaq avatar Pommaq commented on May 18, 2024

Consider using macros to allow compiling PDFRip in two modes, cli and UI/REST since it would probably simplify argument parsing logic since the different interfaces would have widely different parameters. This would be easiest if all user interactions (read: Parameter parsing) is separated to a separated layer from the rest of the application.

Alternatively just add a new mode to the arguments that starts the REST api, but it would make the binary pretty big to run both cli and REST at once.

Running Axum + utoipa for Swagger documentation would be neat imo if this is the chosen approach

from pdfrip.

ApprenticeofEnder avatar ApprenticeofEnder commented on May 18, 2024

I like the idea of this! Seems like something that could pretty easily be broken down into a handful of issues.

from pdfrip.

mufeedvh avatar mufeedvh commented on May 18, 2024

Yep, a webview approach sounds good.

@Pommaq One implementation detail I am curious to know your input on is the progress bar. To implement a progress bar in the GUI that works in the same way as the indicatif progress bar in the console stdout, we would have to pass it on each channel message increments, which would affect performance since it involves network calls. We could show progress per 1000 (or n) increments which should solve it but I am curious to know if you have a better idea since you implemented the current channel-based cracker.

from pdfrip.

Pommaq avatar Pommaq commented on May 18, 2024

Engine.rs takes a callback now, one way would be to add an API endpoint where we can "poll" the progress similarly to what you've already thought of, which returns e.g. how many passwords have been consumed from the producer + it's size, then the UI simply uses that periodically (for example, once a second wouldn't be too much of a performance hit).

The callback can likely just increment an atomic (thread safety, race conditions) integer which said endpoint uses to track the progress.

I've only put like 5 seconds of thought into how this could be done, but I believe the borrow checker could be angry about this approach since the api and engine are likely to run in different threads, a solution is to just wrap the integer in an Arc.

from pdfrip.

Pommaq avatar Pommaq commented on May 18, 2024

Alternatively, open a websocket and send the progress through it to avoid polling but it would then have the performance issues you've already thought of. Unless that websocket was to be run in a separate and very slim thread from the crackers.
Said socket would have the benefit that when the cracking has finished the results can be pushed to the UI instead of it being polled.

A future thing to keep in mind is that some crackers might be unable to estimate the number of passwords they will produce, an example would be a future implementation that simply reads passwords from a socket (This would allow a distributed producer approach) would be unable to know how many passwords it could get unless one were to implement some weird clunky protocol I think.
The easiest solution would be that those types of producers don't show a progress bar, instead it just shows a spinner + time elapsed

from pdfrip.

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.