viper-framework / viper-web

BSD 3-Clause "New" or "Revised" License
8 stars 10 forks source link

API Modules Run #13

Open n3l5 opened 3 years ago

n3l5 commented 3 years ago

Having a devil of a time figuring out how to run a module against a sample.

I am using the v3 api and can see the Modules listed in API , but I can't seem to find the ability to actually run them against a sample. Can someone give me a hint?

acd62081 commented 3 years ago

If you have an Office document like Word or Excel, then you would go to the modules tab and select Office -Office Document Parser. Then you need pick something along the lines of MetaData or Document Streams in the sub module and then click Run.

For a PDF file, you can select the PDF - PDF Document Parser or Strings.

You might also need to make sure you have installed all of the requirements listed in the requirements.txt file located in the viper-modules repo if you haven't done so already. https://github.com/viper-framework/viper-modules/blob/master/requirements.txt

n3l5 commented 3 years ago

If you have an Office document like Word or Excel, then you would go to the modules tab and select Office -Office Document Parser. Then you need pick something along the lines of MetaData or Document Streams in the sub module and then click Run.

For a PDF file, you can select the PDF - PDF Document Parser or Strings.

You might also need to make sure you have installed all of the requirements listed in the requirements.txt file located in the viper-modules repo if you haven't done so already. https://github.com/viper-framework/viper-modules/blob/master/requirements.txt

I understand how to do this manually via the web interface, I am wondering if it is possible to do via the API.

acd62081 commented 3 years ago

Sorry, it was a late night and apparently my reading comprehension wasn't working . You may have figured this out already, but it doesn't appear that running modules is supported from the API yet. The API docs at http:\\viper url/api/v3/docs/ are only showing list operations and if you look at the viperapi/views.py you can see the run_module functions located at the bottom are commented out with the notes of: TODO(frennkie) check whether and how to run modules

https://github.com/viper-framework/viper-web/blob/5fa2b55afe3606785302284eefd01810ca227c0b/viper_web/viperapi/views.py

I may be wrong, but I am not seeing a way to run them using the API. Hopefully someone else will chime in shortly with a definite answer.

frennkie commented 3 years ago

@n3l5 @acd62081 Yes, you are right - currently the V3 API does not support running modules.

If you want to contribute a Pull Request I'm happy to give you some hints and do a review. The link to https://github.com/viper-framework/viper-web/blob/5fa2b55afe3606785302284eefd01810ca227c0b/viper_web/viperapi/views.py#L804 is already a good start. The code there is from the viper code before the migration to V3 and would need to be adapted. This shouldn't be too complicated. :-D

acd62081 commented 3 years ago

@frennkie Probably not too complicated for you based on what I have seen you do. I have no experience with web development but I will look through and see if I can figure out what needs to be done. I would imagine that is something along the lines of:

  1. Create a Serializer
  2. Create a module in the views.py called run-module that calls the serializer
  3. Update the urls.py file.

Feel free to send me any hints that you know about. It may take a little while for the pull request to be submitted.

n3l5 commented 3 years ago

I won't be of any help, at least not immediately, to help build this; but I'll take a peek and see if I can come up with something. Can for sure help with any testing.