Module: PWN::Plugins::PDFParse
- Defined in:
- lib/pwn/plugins/pdf_parse.rb
Overview
This plugin is used for parsing and interacting with PDF files
Class Method Summary collapse
-
.authors ⇒ Object
- Author(s)
-
0day Inc.
-
.help ⇒ Object
Display Usage for this Module.
-
.read_text(opts = {}) ⇒ Object
- Supported Method Parameters
-
PWN::Plugins::PDFParse.read_text( pdf_path: ‘optional path to dir defaults to .’ ).
Class Method Details
.authors ⇒ Object
- Author(s)
-
0day Inc. <[email protected]>
34 35 36 37 38 |
# File 'lib/pwn/plugins/pdf_parse.rb', line 34 public_class_method def self. "AUTHOR(S): 0day Inc. <[email protected]> " end |
.help ⇒ Object
Display Usage for this Module
42 43 44 45 46 47 48 49 50 |
# File 'lib/pwn/plugins/pdf_parse.rb', line 42 public_class_method def self.help puts "USAGE: pdf_pages_hash = #{self}.read_text( pdf_path: 'required path to pdf file' ) #{self}.authors " end |
.read_text(opts = {}) ⇒ Object
- Supported Method Parameters
-
PWN::Plugins::PDFParse.read_text(
pdf_path: 'optional path to dir defaults to .'
)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pwn/plugins/pdf_parse.rb', line 14 public_class_method def self.read_text(opts = {}) pdf_path = opts[:pdf_path].to_s.scrub if File.exist?(opts[:pdf_path].to_s.scrub) raise "PWN Error: Invalid Directory #{pdf_path}" if pdf_path.nil? pdf_pages_hash = {} page_no = 1 reader = PDF::Reader.new(pdf_path) reader.pages.each do |page| print '.' pdf_pages_hash[page_no] = page.text page_no += 1 end print "\n" pdf_pages_hash rescue StandardError => e raise e end |