class PTJ::Parser::HashPassOnlyColon

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

Public Instance Methods

parse_line(line) click to toggle source

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

@param line

Individual line from a text file

@return Hash Password, Password Hash

# File lib/ptj/parser/fileparser/hashpassonlycolon.rb, line 16
def parse_line(line)
  if line =~ /^(\S+):(\S+)/
    pass = $~[2]
    hash = $~[1]
  end
  {:mypass => pass, :myhash => hash}
end
total_count(file) click to toggle source

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

@param file

File path which will be read

@return Integer

# File lib/ptj/parser/fileparser/hashpassonlycolon.rb, line 32
def total_count(file)
  file_obj = File.new(file,'r')
  file_obj.readlines.size
end