diff --git a/app/controllers/macs_controller.rb b/app/controllers/macs_controller.rb index 05e6271..887dfd6 100644 --- a/app/controllers/macs_controller.rb +++ b/app/controllers/macs_controller.rb @@ -224,7 +224,7 @@ end def arp_lookup @ip = request.env['REMOTE_ADDR'] - @arp = %x(/usr/sbin/arp -a | grep #{@ip}) + @arp = /([0-9A-F]{2}[:-]){5}([0-9A-F]{2})/i.match(%x(arp -a | grep #{@ip})) end def scan diff --git a/app/views/macs/index.html.erb b/app/views/macs/index.html.erb index b6866e7..d93c444 100644 --- a/app/views/macs/index.html.erb +++ b/app/views/macs/index.html.erb @@ -2,14 +2,22 @@ <% if @mac_time_start_date.present? %> Most Active Machine Last <%= distance_of_time_in_words DateTime.now, @mac_time_start_date %>: "> - <%= @most_active_mac.user.name unless @most_active_mac.user.blank? %> + <% if @most_active_mac.user.blank? %> + <%= @most_active_mac.mac %> + <% else %> + <%= @most_active_mac.user.name %> + <% end %> <%= "("+@most_active_mac.note+")" unless @most_active_mac.note.blank? %> - <%= (@most_active.last[:time] / 1.hour).round %> hrs
Runner Up: "> - <%= @runner_up_mac.user.name unless @runner_up_mac.user.blank? %> + <% if @runner_up_mac.user.blank? %> + <%= @runner_up_mac.mac %> + <% else %> + <%= @runner_up_mac.user.name %> + <% end %> <%= "("+@runner_up_mac.note+")" unless @runner_up_mac.note.blank? %> - <%= (@runner_up.last[:time] / 1.hour).round %> hrs