prey/prey-node-client

View on GitHub

Showing 551 of 551 total issues

Function get_firmware_info has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.get_firmware_info = function(callback) {

  var get_value = function(output, string) {
    var regex = new RegExp(string + ": (.*)");
    var matches = output.toString().match(regex);
Severity: Minor
Found in lib/agent/providers/hardware/linux.js - About 1 hr to fix

    Function create_server has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var create_server = (cb) => {
      os_name = os.platform().replace('darwin', 'mac').replace('win32', 'windows');
      if (os_name == 'linux') return cb(new Error('Service only available for mac and windows'));
    
      check_service((valid) => {
    Severity: Minor
    Found in lib/agent/control-panel/long-polling/server.js - About 1 hr to fix

      Function get_update_data has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      package.get_update_data = (cb) => {
        var location  = require('./agent/triggers/location'),
            data = {public_ip: null, country: null, location: {lat: null, lon: null}},
            loc = location.current;
      
      
      Severity: Minor
      Found in lib/package.js - About 1 hr to fix

        Function check_hostname has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var check_hostname = () => {
          if (checking) return;
          checking = true;
        
          var done = (err) => {
        Severity: Minor
        Found in lib/agent/triggers/hostname/index.js - About 1 hr to fix

          Function start has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.start = (id, opts, cb) => {
            const done = (err = null) => {
              if (err) return cb(err);
              if (!emitter) emitter = new Emitter();
              cb(err, emitter);
          Severity: Minor
          Found in lib/agent/actions/osquery/index.js - About 1 hr to fix

            Function get_encryption_status has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports.get_encryption_status = function(cb) {
              logger.info("Getting encryption status");
              system.get_as_admin_user('encryptStatus', (err, info) => {
                if (err) return cb(err);
                if (!Array.isArray(info)) return cb(new Error("Invalid encryption status information"));
            Severity: Minor
            Found in lib/agent/providers/encryption-status/index.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function start has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.start = function (cb) {
            
              var count,
                last_err,
                files_removed = [];
            Severity: Minor
            Found in lib/conf/tasks/clear_files_prey_temp.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function parse_access_points_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.parse_access_points_list = function(output) {
            
              return output.split(/Cell \d\d - /).splice(1).map(function(block) {
                var parsed = {};
            
            
            Severity: Minor
            Found in lib/agent/providers/network/linux.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function get_process_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.get_process_list = function(callback) {
            
              var processes = [],
                  cmd = 'ps axo stat,user,ppid,pid,pcpu,pmem,time,comm | egrep -v " ps|grep"';
            
            
            Severity: Minor
            Found in lib/agent/providers/processes/mac.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function parse_access_points_list_netsh has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.parse_access_points_list_netsh = (out) => {
              // eslint-disable-next-line prefer-const
              let list = [];
              const blocks = out.split(/\nSSID \d{1,2}\s:/);
            
            
            Severity: Minor
            Found in lib/agent/providers/network/windows.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function start has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.start = function (cb) {
            
              var count,
                last_err,
                folders_removed = [];
            Severity: Minor
            Found in lib/conf/tasks/clear_folders.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function get_process_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.get_process_list = function(callback) {
            
              var processes = [],
                  cmd = 'ps axo stat,user,ppid,pid,pcpu,pmem,time,comm | egrep -v " ps|grep"';
            
            
            Severity: Minor
            Found in lib/agent/providers/processes/linux.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function get_encryption_keys has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports.get_encryption_keys = function(cb) {
              logger.info("Getting encryption keys");
              system.get_as_admin_user('recoveryKeys', (err, info) => {
                if (err) return cb(err);
                if (!Array.isArray(info)) return cb(new Error("Invalid encryption keys information"));
            Severity: Minor
            Found in lib/agent/providers/encryption-keys/index.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function check_service has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.check_service = function(data, cb) {
              if (exports.monitoring_service_go) {
                if (typeof cb !== 'function')
                  return;
                return cb(null, data);
            Severity: Minor
            Found in lib/system/windows/index.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function RemoteDesktop has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            var RemoteDesktop = function(options){
            
                var self = this;
                var options = options || {};
            
            
            Severity: Minor
            Found in lib/agent/actions/remote-desktop/index.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function move has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            var move = function(from, to, cb) {
              if (process.platform != 'win32')
                return fs.rename(from, to, cb);
            
              // on windows, antivirus softwares lock new folders until all files are scanned
            Severity: Minor
            Found in lib/package.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function verificationPreyConfiguration has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            const verificationPreyConfiguration = (callback) => {
              try {
                clearIntervalDbPreyConf();
                saveDataVerify(() => {});
                dbPreyConfInterval = setIntervalDbPreyConf();
            Severity: Minor
            Found in lib/agent/utils/prey-configuration/validationpreyconf.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function notify_action has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.notify_action = function (status, id, name, opts, err, out) {
              if (name === 'geofencing' || name === 'triggers') return; // geofencing and triggers needs to send custom notification
            
              let body = {
                command: 'start',
            Severity: Minor
            Found in lib/agent/control-panel/sender.js - About 1 hr to fix

              Function get_access_points_list has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.get_access_points_list = (callback) => {
                let cmd;
                let parser;
                let list = [];
              
              
              Severity: Minor
              Found in lib/agent/providers/network/windows.js - About 1 hr to fix

                Function osQueryModeData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const osQueryModeData = (opts, done) => {
                  let args = null;
                  const data = {
                    key: 'device-key',
                    token: 'token',
                Severity: Minor
                Found in lib/agent/actions/osquery/index.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language