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.236 lib/pwn/plugins/ocr.rb
pwn-0.5.235 lib/pwn/plugins/ocr.rb
pwn-0.5.234 lib/pwn/plugins/ocr.rb
pwn-0.5.233 lib/pwn/plugins/ocr.rb
pwn-0.5.232 lib/pwn/plugins/ocr.rb
pwn-0.5.231 lib/pwn/plugins/ocr.rb
pwn-0.5.230 lib/pwn/plugins/ocr.rb
pwn-0.5.229 lib/pwn/plugins/ocr.rb
pwn-0.5.228 lib/pwn/plugins/ocr.rb
pwn-0.5.227 lib/pwn/plugins/ocr.rb
pwn-0.5.226 lib/pwn/plugins/ocr.rb
pwn-0.5.225 lib/pwn/plugins/ocr.rb
pwn-0.5.224 lib/pwn/plugins/ocr.rb
pwn-0.5.223 lib/pwn/plugins/ocr.rb
pwn-0.5.222 lib/pwn/plugins/ocr.rb
pwn-0.5.221 lib/pwn/plugins/ocr.rb
pwn-0.5.220 lib/pwn/plugins/ocr.rb
pwn-0.5.219 lib/pwn/plugins/ocr.rb
pwn-0.5.217 lib/pwn/plugins/ocr.rb
pwn-0.5.216 lib/pwn/plugins/ocr.rb