Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (count <= 5) {
cooked.push({
name: vuln,
pluginId: raw[vuln]['id'],
count: raw[vuln]['data'][0],
severity: raw[vuln]['severity']
});
}
}
web.vulnCache(cooked);
console.log('PVS: Updated Top Vulnerabilities Cache');
web.io.emit('topVulns', cooked);
// Initiate a logout from the API. We need to make sure to do
// this so that we don't keep sessions running to time out
httpreq.post(host + '/logout', {parameters: {json: 1, token: token}})
}
})
}
function pvsData() {
var token = null;
// Initiate the login to the PVS API.
httpreq.post(host + '/login', {
parameters: {
login: config.Monitoring.PVS.username,
password: config.Monitoring.PVS.password,
json: 1
}
}, function(err, res) {
if (err) {
console.log('PVS: ' + err);
} else {
// As it appears that we were able to login, lets to ahead
// and set the token variable.
var data = JSON.parse(res.body);
token = data['reply']['contents']['token'];
// Here what we'll be interfacing to is the top hosts
// dashboard item. Since the New PVS WebUI has formatted
}).spread(function(image, created) {
if (created && config.Monitoring.Driftnet.nsfw_filter) {
httpreq.post(config.NSFW.address + '/score', {
parameters: {
path: 'file:///images/' + image.filename
}
}, function(err, res) {
if (err) {
console.log('Driftnet: ' + err);
} else {
if (res.statusCode == 200){
data = JSON.parse(res.body)
if (!data['error']){
image.updateAttributes({
nsfw: data['score']
}).then(function(result) {
console.log('Driftnet: ' + image.filename + ' created from ' + image.url + ' with nsfw score of ' + image.nsfw)
io.emit('images', image)
})
}).spread(function(image, created){
if (created && config.Monitoring.NGrep.nsfw_filter) {
httpreq.post(config.NSFW.address + '/score', {
parameters: {
path: 'file:///images/' + filename
}
}, function(err, res) {
if (err) {
console.log('NGrep: ' + err);
} else {
if (res.statusCode == 200){
data = JSON.parse(res.body)
if (!data['error']){
image.updateAttributes({
nsfw: data['score']
}).then(function(result) {
console.log('NGrep: ' + image.filename + ' created from ' + image.url + ' with nsfw score of ' + image.nsfw)
io.emit('images', image)
})
function apiCall(url, soapAction, callback, alternativeBody) {
let body = '';
if (alternativeBody) {
body = alternativeBody;
}
httpreq.post(url, {
headers: {
'soapaction': '"urn:samsung.com:service:MainTVAgent2:1#' + soapAction + '"',
'user-agent': "DLNADOC/1.50 SEC_HHP_Homey/1.0"
},
body: body
}, (err, res) => {
if (err) {
Homey.log(err);
typeof callback === 'function' && callback(err, res);
return;
}
xml2js.parseString(res.body, function (err, result) {
if (err) {
Homey.log(err);
}
typeof callback === 'function' && callback(err, result);