Created
March 25, 2015 20:18
-
-
Save WilliamSalusky/d81cb2ea7624324fffc4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var util = require('util') | |
, wiseSource = require('./wiseSource.js') | |
; | |
var elasticsearch = require('elasticsearch'); | |
var date = new Date(); | |
var client = new elasticsearch.Client({ | |
host : 'localhost:9200', | |
log: 'trace' | |
}); | |
////////////////////////////////////////////////////////////////////////////////// | |
function HOD (api, section) { | |
HOD.super_.call(this, api, section); | |
} | |
util.inherits(HOD, wiseSource); | |
////////////////////////////////////////////////////////////////////////////////// | |
HOD.prototype.init = function() { | |
// this.hod_server = this.api.getConfig(this.section, "hodserver","localhost"); | |
this.getDomain = function(domain, cb) { | |
console.log ("HOD2 : ", domain ); | |
client.create({ | |
index: 'hod', | |
type: 'domain', | |
id: domain, | |
body:{ | |
domain: domain, | |
// first_seen: date.toISOString(), | |
// last_seen: date.toISOString(), | |
count: 1 | |
} | |
}); | |
return cb(null, undefined); | |
}; | |
this.api.addSource(this.section, this); | |
var section = this.section; | |
}; | |
////////////////////////////////////////////////////////////////////////////////// | |
exports.initSource = function(api) { | |
var source = new HOD(api, "hod"); | |
source.init(); | |
}; | |
////////////////////////////////////////////////////////////////////////////////// | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment