Class: TeamCymru::Malware
- Inherits:
-
Object
- Object
- TeamCymru::Malware
- Defined in:
- lib/teamcymru/malware.rb
Instance Method Summary collapse
-
#initialize(server = 'hash.cymru.com', port = 43) ⇒ Malware
constructor
A new instance of Malware.
- #lookup(hashes) ⇒ Object
Constructor Details
#initialize(server = 'hash.cymru.com', port = 43) ⇒ Malware
Returns a new instance of Malware.
14 15 16 17 |
# File 'lib/teamcymru/malware.rb', line 14 def initialize(server='hash.cymru.com', port=43) @server = server @port = port end |
Instance Method Details
#lookup(hashes) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/teamcymru/malware.rb', line 19 def lookup(hashes) if hashes.class == Array hashes = hashes.join("\n") end res = [] t = TCPSocket.new(@server,@port) t.write("begin\nverbose\n#{hashes}\nend\n") t.each_line do |l| next if l =~ /^#/ res << MalwareResult.new(*(l.chomp.split(/\s+/,3))) end res end |