class PTJ::Parser::PassThreeColons
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:
- something :
- pass :
-
something
- something :
- pass :
-
something
- something :
- pass :
-
something
@param line
Individual line from a text file
@return Hash Password
, Password
Hash
# File lib/ptj/parser/fileparser/passthreecolons.rb, line 16 def parse_line(line) if line =~ /\s*\S*\s*:::\s*(\S+)\s*:::/ pass = $~[1] hash = nil 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/passthreecolons.rb, line 32 def total_count(file) file_obj = File.new(file,'r') file_obj.readlines.size end