MAC vendor lookup: Difference between revisions

Content added Content deleted
(added Tcl)
(→‎{{header|Ruby}}: Added Ruby)
Line 213: Line 213:
FC:FB:FB:01:FA:21 Cisco Systems, Inc
FC:FB:FB:01:FA:21 Cisco Systems, Inc
D4:F4:6F:C9:EF:8D Apple, Inc.</pre>
D4:F4:6F:C9:EF:8D Apple, Inc.</pre>
=={{header|Ruby}}==
<lang ruby>require 'net/http'

arr = ['88:53:2E:67:07:BE', 'FC:FB:FB:01:FA:21', 'D4:F4:6F:C9:EF:8D', '23:45:67']

arr.each do |addr|
vendor = Net::HTTP.get('api.macvendors.com', "/#{addr}/") rescue nil
puts "#{addr} #{vendor}"
end</lang>
{{out}}
<pre>88:53:2E:67:07:BE Intel Corporate
FC:FB:FB:01:FA:21 Cisco Systems, Inc
D4:F4:6F:C9:EF:8D Apple, Inc.
23:45:67 Vendor not found
</pre>


=={{header|Tcl}}==
=={{header|Tcl}}==