Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send version prey-user to panel #712

Merged
merged 7 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/agent/providers/hardware/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ exp.get_rp_module = os_functions.get_recovery_partition_status;
exp.get_model_name = exp.get_model_name;
exp.get_vendor_name = exp.get_vendor_name;
exp.get_processor_info = (os_name == 'mac') ? os_functions.get_processor_info : exp.get_processor_info;///////////////

exp.get_prey_user_version = os_functions.get_prey_user_version;
// even though these functions look like they belong in the network provider,
// we put them here because MAC addresses are part of the network interfaces,
// and are not subject to change (even though they can be spoofed)
Expand Down
21 changes: 17 additions & 4 deletions lib/agent/providers/hardware/mac.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
var exec = require('child_process').exec,
si = require('systeminformation'),
system = require('./../../../system/mac/index');
system = require('./../../../system/mac/index'),
common = require('./../../../common'),
logger = common.logger.prefix('hardware-mac');

var ram_vendors = {
'0x014F': 'Transcend Information',
Expand Down Expand Up @@ -85,9 +87,7 @@ exports.get_ram_module_list = function(cb) {

cb(null, list);
})
}


}
}

/////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -126,4 +126,17 @@ var get_system_profiler_data = function(type, cb) {
cb(null, obj);
});

}

exports.get_prey_user_version = function(cb) {
system.get_prey_user_version((err, prey_user_version) => {
if (err) return cb(err);
try {
logger.info("prey_user_version:"+ JSON.stringify(prey_user_version))
} catch(e) {
return cb(new Error("Error get prey_user_version: " + e.message));
}
return cb(null, prey_user_version);
})

}
1 change: 0 additions & 1 deletion lib/agent/providers/hardware/windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var exec = require('child_process').exec,
common = require('./../../../common'),
logger = common.logger.prefix('wmic'),
gte = common.helpers.is_greater_or_equal,
logger = common.logger,
wmic = require('wmic'),
si = require('systeminformation');

Expand Down
1 change: 1 addition & 0 deletions lib/agent/reports/specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ exports.includes = [
...(process.platform == 'win32'
? ['os_edition', 'winsvc_version', 'rp_module']
: []),
...(process.platform == 'darwin'? ['prey_user_version']:[])
];
10 changes: 10 additions & 0 deletions lib/system/mac/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,14 @@ exports.get_info_chip = function(){
var model = cpus[0].model.trim();
return model;

}

exports.get_prey_user_version = function(cb) {
var prey_user_version;
try {
prey_user_version = cp.execSync('/usr/local/lib/prey/versions/prey-user -v');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better if we use the path like a variable than this, I think we had the installation path in ~/lib/system/paths.js

} catch (e) {
return cb(new Error("Unable to get prey-user-version."))
}
cb(null, prey_user_version.toString().trim());
}