Class: PTJ::Parser::PassHashOnly

Inherits:
FileParser show all
Defined in:
lib/ptj/parser/fileparser/passhashonly.rb

Overview

FileParser class which allows you to parse a file line by line.

Instance Method Summary collapse

Instance Method Details

#parse_line(line) ⇒ Object

Expecting the following format: pass, hash pass, hash pass, hash



16
17
18
19
20
21
22
# File 'lib/ptj/parser/fileparser/passhashonly.rb', line 16

def parse_line(line)
  if line =~ /^(\S+),\s(\S+)/
    pass = $~[1]
    hash = $~[2]
  end
  {:mypass => pass, :myhash => hash}
end

#total_count(file) ⇒ Object

Method used to return the total number of passwords that will be added to PTJ



32
33
34
35
# File 'lib/ptj/parser/fileparser/passhashonly.rb', line 32

def total_count(file)
  file_obj = File.new(file,'r')
  file_obj.readlines.size
end