Class: SshGuard::Core::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/ssh_guard.rb

Instance Method Summary collapse

Instance Method Details

#parse_line(line) ⇒ Object



10
11
12
13
14
15
16
# 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