Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

agentx

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

agentx - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

lib/error_parser.js

31

lib/agent.js

@@ -27,3 +27,2 @@ 'use strict';

this.reconnectDelay = config.reconnectDelay * 1000;
this.logdir = config.logdir;
this.reportInterval = config.reportInterval * 1000;

@@ -33,2 +32,4 @@ if (this.reportInterval < 60000) {

}
this.config = config;
this.handleMonitor();
};

@@ -45,3 +46,2 @@

this.handleConnection();
this.handleMonitor();
};

@@ -290,3 +290,3 @@

if (typeof order.init === 'function') {
order.init(that.logdir);
order.init(that.config);
}

@@ -300,14 +300,19 @@ var latestReport = new Date().getTime();

}
if (that.state === AgentState.WORK) {
if (that.state === AgentState.WORK) { // 未连接时忽略执行
latestReport = new Date();
order.run(function (err, params) {
var message = {
type: 'log',
params: params,
appid: that.appid,
agentid: os.hostname(),
timestamp: new Date().getTime(),
id: utils.uid()
};
that.sendMessage(message);
if (err) {
console.log(utils.errorFormat(err));
return;
}
if (params) { // 忽略空数据
that.sendMessage({
type: 'log',
params: params,
appid: that.appid,
agentid: os.hostname(),
timestamp: new Date().getTime(),
id: utils.uid()
});
}
});

@@ -314,0 +319,0 @@ }

@@ -98,4 +98,4 @@ 'use strict';

exports.init = function (logdir) {
exports.logdir = logdir;
exports.init = function (config) {
exports.logdir = config.logdir;
var currentPath = getCurrentLogPath();

@@ -107,7 +107,9 @@ map.set('currentFile', currentPath);

exports.run = function (callback) {
if (!exports.logdir) {
return callback(new Error("Not specific logdir in agentx config file"));
}
readLog(function (err) {
if (err) {
console.log("read node log");
console.log(err.message);
console.log(err.stack);
return callback(err);
}

@@ -114,0 +116,0 @@

'use strict';
var os = require('os');
var crypto = require('crypto');
var execFile = require('child_process').execFile;
var util = require('util');

@@ -23,3 +25,3 @@ exports.sha1 = function (str, key) {

exports.pad = function (num) {
exports.pad2 = function (num) {
if (num < 10) {

@@ -31,7 +33,37 @@ return '0' + num;

exports.pad3 = function (num) {
if (num < 10) {
return '00' + num;
} else if (num < 100) {
return '0' + num;
}
return '' + num;
};
exports.getYYYYMMDD = function (date) {
var YYYY = date.getFullYear();
var MM = exports.pad(date.getMonth() + 1);
var DD = exports.pad(date.getDate());
var MM = exports.pad2(date.getMonth() + 1);
var DD = exports.pad2(date.getDate());
return '' + YYYY + MM + DD;
};
exports.formatError = function (err) {
var now = new Date();
var YYYY = now.getFullYear();
var MM = exports.pad2(now.getMonth() + 1);
var DD = exports.pad2(now.getDate());
var hh = exports.pad2(now.getHours());
var mm = exports.pad2(now.getMinutes());
var ss = exports.pad2(now.getSeconds());
var sss = exports.pad3(now.getMilliseconds());
var time = util.format('%s-%s-%s %s:%s:%s.%s', YYYY, MM, DD, hh, mm, ss, sss);
var format = ['%s %s: %s', 'pid: %s', 'host: %s', '%s'].join(os.EOL) + os.EOL;
return util.format(format, time, err.name, err.stack, process.pid, os.hostname(), time);
};
exports.resolveYYYYMMDD = function (str) {
var now = new Date();
return str.replace('#YYYY#', now.getFullYear())
.replace('#MM#', exports.pad2(now.getMonth() + 1))
.replace('#DD#', exports.pad2(now.getDate()));
};
{
"name": "agentx",
"version": "1.1.0",
"version": "1.2.0",
"description": "agentx is powered by alinode",

@@ -5,0 +5,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc