Sha256: 08ff81e14f3d426ac1b59e748b4526597a7705b46a9f42479fec09b9b6192e58

Contents?: true

Size: 986 Bytes

Versions: 86

Compression:

Stored size: 986 Bytes

Contents

# frozen_string_literal: true

require 'rtesseract'

module PWN
  module Plugins
    # This plugin processes images into readable text
    module OCR
      # Supported Method Parameters::
      # PWN::Plugins::OCR.process(
      #   file: 'required - path to image file',
      # )

      public_class_method def self.process(opts = {})
        file = opts[:file].to_s.scrub.strip.chomp if File.exist?(opts[:file].to_s.scrub.strip.chomp)
        image = RTesseract.new(file)
        image.to_s
      rescue StandardError => e
        raise e
      end

      # Author(s):: 0day Inc. <support@0dayinc.com>

      public_class_method def self.authors
        "AUTHOR(S):
          0day Inc. <support@0dayinc.com>
        "
      end

      # Display Usage for this Module

      public_class_method def self.help
        puts "USAGE:
          #{self}.process(
            file: 'required - path to image file'
          )

          #{self}.authors
        "
      end
    end
  end
end

Version data entries

86 entries across 86 versions & 1 rubygems

Version Path
pwn-0.5.153 lib/pwn/plugins/ocr.rb
pwn-0.5.152 lib/pwn/plugins/ocr.rb
pwn-0.5.151 lib/pwn/plugins/ocr.rb
pwn-0.5.150 lib/pwn/plugins/ocr.rb
pwn-0.5.106 lib/pwn/plugins/ocr.rb
pwn-0.5.105 lib/pwn/plugins/ocr.rb