class SshGuard::Core::Parser

Public Instance Methods

parse_line(line) click to toggle source
# File lib/ssh_guard.rb, line 10
def parse_line(line)
  if line =~ /Did not receive identification string/ || line =~ /invalid user/i || line =~ /authentication error/
    ip_address = line.match(/\d+\.\d+.\d+.\d+/).to_s
    timestamp = Time.parse(line.match(/(^.+) mini/)[1])
    {:ip_address => ip_address, :timestamp => timestamp}
  end
end