#!/usr/bin/env ruby require 'Common/RogueScannerDriver' require 'Common/evidence' require 'pp' #CERT = '/netchem/sandbox/scanner/ClassificationServer/certificates/RootCert.pem' #obj = RogueScannerPort.new("http://roguescanner.networkchemistry.net/api/classification") #obj.options['protocol.http.ssl_config.ca_file'] = CERT obj = RogueScannerPort.new("http://localhost:85/") # run ruby with -d to see SOAP wiredumps. obj.wiredump_dev = STDERR if $DEBUG # # Read evidence from stdin in YAML format. # stdin = IO.new(0,"r") data = YAML::load(stdin.read) device = Evidence::Device.new(data) # # Convert the evidence into SOAP format. # evidence_gathered = [] device.evidence.each do |clue| p = [] if clue.params clue.params.each do |key,value| p << Map.new(key, value) end end v = [] if clue.values clue.values.each do |key,value| v << Map.new(key, value) end end evidence_gathered << CharacteristicValue.new(clue.characteristic, p, v) end obj.reloadDatabase result = obj.classifyDevice(evidence_gathered) if result puts pp(result) else puts "No result returned" end