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.173 lib/pwn/plugins/ocr.rb
pwn-0.5.172 lib/pwn/plugins/ocr.rb
pwn-0.5.171 lib/pwn/plugins/ocr.rb
pwn-0.5.170 lib/pwn/plugins/ocr.rb
pwn-0.5.169 lib/pwn/plugins/ocr.rb
pwn-0.5.168 lib/pwn/plugins/ocr.rb
pwn-0.5.167 lib/pwn/plugins/ocr.rb
pwn-0.5.166 lib/pwn/plugins/ocr.rb
pwn-0.5.165 lib/pwn/plugins/ocr.rb
pwn-0.5.164 lib/pwn/plugins/ocr.rb
pwn-0.5.163 lib/pwn/plugins/ocr.rb
pwn-0.5.162 lib/pwn/plugins/ocr.rb
pwn-0.5.161 lib/pwn/plugins/ocr.rb
pwn-0.5.160 lib/pwn/plugins/ocr.rb
pwn-0.5.159 lib/pwn/plugins/ocr.rb
pwn-0.5.158 lib/pwn/plugins/ocr.rb
pwn-0.5.157 lib/pwn/plugins/ocr.rb
pwn-0.5.156 lib/pwn/plugins/ocr.rb
pwn-0.5.155 lib/pwn/plugins/ocr.rb
pwn-0.5.154 lib/pwn/plugins/ocr.rb