Sha256: fb892cfe0b01174089d8de06f9cfa29a176a9ed61bb56a1082a35135e997c20e

Contents?: true

Size: 1002 Bytes

Versions: 721

Compression:

Stored size: 1002 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. <request.pentest@0dayinc.com>

      public_class_method def self.authors
        "AUTHOR(S):
          0day Inc. <request.pentest@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

721 entries across 721 versions & 1 rubygems

Version Path
pwn-0.5.104 lib/pwn/plugins/ocr.rb
pwn-0.5.103 lib/pwn/plugins/ocr.rb
pwn-0.5.102 lib/pwn/plugins/ocr.rb
pwn-0.5.101 lib/pwn/plugins/ocr.rb
pwn-0.5.100 lib/pwn/plugins/ocr.rb
pwn-0.5.99 lib/pwn/plugins/ocr.rb
pwn-0.5.98 lib/pwn/plugins/ocr.rb
pwn-0.5.97 lib/pwn/plugins/ocr.rb
pwn-0.5.96 lib/pwn/plugins/ocr.rb
pwn-0.5.95 lib/pwn/plugins/ocr.rb
pwn-0.5.94 lib/pwn/plugins/ocr.rb
pwn-0.5.93 lib/pwn/plugins/ocr.rb
pwn-0.5.92 lib/pwn/plugins/ocr.rb
pwn-0.5.91 lib/pwn/plugins/ocr.rb
pwn-0.5.90 lib/pwn/plugins/ocr.rb
pwn-0.5.89 lib/pwn/plugins/ocr.rb
pwn-0.5.88 lib/pwn/plugins/ocr.rb
pwn-0.5.87 lib/pwn/plugins/ocr.rb
pwn-0.5.86 lib/pwn/plugins/ocr.rb
pwn-0.5.85 lib/pwn/plugins/ocr.rb