Module: PWN::Plugins::OCR

Defined in:
lib/pwn/plugins/ocr.rb

Overview

This plugin processes images into readable text

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. <[email protected]>



24
25
26
27
28
# File 'lib/pwn/plugins/ocr.rb', line 24

public_class_method def self.authors
  "AUTHOR(S):
    0day Inc. <[email protected]>
  "
end

.helpObject

Display Usage for this Module



32
33
34
35
36
37
38
39
40
# File 'lib/pwn/plugins/ocr.rb', line 32

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

    #{self}.authors
  "
end

.process(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::OCR.process(

file: 'required - path to image file',

)



14
15
16
17
18
19
20
# File 'lib/pwn/plugins/ocr.rb', line 14

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