public
Last active

  • Download Gist
find_readynas.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/usr/bin/env ruby
 
# gem install oj
require 'rubygems'
require 'oj'
 
$stdin.each_line do |input|
info = Oj.load(input) rescue nil
next unless info and info['data']
data = info['data'].unpack("m*").first
if data.index('Copyright 2007, NETGEAR') and data.index('<meta http-equiv="refresh" content="0; url=/shares/">')
mod = nil
if data =~ /Last-Modified:\s+(.*)/i
mod = $1.strip
end
puts [info['ip'],mod.to_s].join("\t")
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.