prey/prey-node-client

View on GitHub

Showing 551 of 551 total issues

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

var send_update_event = (type, status, old_version, new_version, attempt, error, cb) => {
  const config = require('./utils/configfile');
  var shared = require('./conf/shared');

  shared.keys.verify_current(function(err) {
Severity: Minor
Found in lib/package.js - About 1 hr to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      if (dataFromName) {
        if (!dataFromName[0].possiblevalues.test(dataToSave)) {
          return cb(new Error(`${dataToSave} is not an acceptable value for key: ${key}`));
        }
      }
    Severity: Major
    Found in lib/conf/settings.js and 1 other location - About 1 hr to fix
    lib/conf/settings.js on lines 24..28

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        if (out.indexOf('File succesfuly uploaded') != -1) {
          logger.debug(`Removing file_id from DB: ${options.file_id}`);
          storage.do('del', { type: 'files', id: options.file_id });
          return;
        }
    Severity: Major
    Found in lib/agent/actions/fileretrieval/index.js and 1 other location - About 1 hr to fix
    lib/agent/actions/fileretrieval/index.js on lines 121..125

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

              if (Object.keys(dates).length === 0
              || date.getTime() < dates.from || date.getTime() > dates.until) return;
    Severity: Major
    Found in lib/agent/actions/triggers/index.js and 1 other location - About 1 hr to fix
    lib/agent/actions/triggers/index.js on lines 448..448

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        if (res.statusCode == 404) {
          logger.debug(`Removing file_id from DB: ${options.file_id}`);
          storage.do('del', { type: 'files', id: options.file_id });
          return;
        }
    Severity: Major
    Found in lib/agent/actions/fileretrieval/index.js and 1 other location - About 1 hr to fix
    lib/agent/actions/fileretrieval/index.js on lines 89..93

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      sys_win.get_winsvc_version((err, service_version) => {
        if (err) return cb(false);
    
        if (service_version && gte(service_version, "1.2.0"))
          return cb(true)
    Severity: Major
    Found in lib/agent/control-panel/long-polling/server.js and 1 other location - About 1 hr to fix
    lib/agent/control-panel/websockets/server.js on lines 22..27

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

          if (Object.keys(dates).length === 0 || date.getTime() < dates.from || date.getTime() > dates.until) return;
    Severity: Major
    Found in lib/agent/actions/triggers/index.js and 1 other location - About 1 hr to fix
    lib/agent/actions/triggers/index.js on lines 213..214

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            Object.keys(this.permissionData).forEach((key) => {
              if (data[key]) this.permissionData[key] = data[key];
            });
    Severity: Major
    Found in lib/utils/permissionfile.js and 1 other location - About 1 hr to fix
    lib/utils/configfile.js on lines 94..96

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      sysWin.get_winsvc_version((err, serviceVersion) => {
        if (err) return cb(false);
    
        if (serviceVersion && gte(serviceVersion, '1.2.0')) return cb(true);
        cb(false);
    Severity: Major
    Found in lib/agent/control-panel/websockets/server.js and 1 other location - About 1 hr to fix
    lib/agent/control-panel/long-polling/server.js on lines 17..23

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      if (dataFromName) {
        if (!dataFromName[0].possiblevalues.test(val)) {
          return cb(new Error(`${val} is not an acceptable value for key: ${key}`));
        }
      }
    Severity: Major
    Found in lib/conf/settings.js and 1 other location - About 1 hr to fix
    lib/conf/settings.js on lines 50..54

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          Object.keys(this.preyConfiguration).forEach((key) => {
            if (data[key]) this.preyConfiguration[key] = data[key];
          });
    Severity: Major
    Found in lib/utils/configfile.js and 1 other location - About 1 hr to fix
    lib/utils/permissionfile.js on lines 30..32

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function load_hooks has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function load_hooks() {
      storage.do('query', { type: 'keys', column: 'id', data: 'last_connection' }, (err, stored) => {
        if (err) logger.info('Error getting the last connection data');
        if (stored && stored.length > 0) {
          last_stored = stored[0];
    Severity: Minor
    Found in lib/agent/control-panel/long-polling/index.js - About 1 hr to fix

      Function get_process_list has 26 lines of code (exceeds 25 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

        Function get_killswitch_compatible has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.get_killswitch_compatible = (cb) => {
          const data = {
            key: 'device-key',
            token: 'token',
            logged: false,
        Severity: Minor
        Found in lib/agent/providers/hardware/windows.js - About 1 hr to fix

          Function get_ram_module_list has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.get_ram_module_list = (cb) => {
            const list = [];
            const file = join(__dirname, 'ramcheck.vbs');
          
            // eslint-disable-next-line consistent-return
          Severity: Minor
          Found in lib/agent/providers/hardware/windows.js - About 1 hr to fix

            Function setUpVersion has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const setUpVersion = function (version, cb) {
              const finish = () => {
                log(`Setting permissions on ${paths.current}`);
                exports.chmodr(paths.current, 0o755, function (err) {
                  if (err) return cb(err);
            Severity: Minor
            Found in lib/conf/tasks/index.js - About 1 hr to fix

              Function get_process_list has 26 lines of code (exceeds 25 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

                Function parse_access_points_list has 26 lines of code (exceeds 25 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

                  Function get has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const get = (reportName, options, callback) => {
                    let cb;
                    let optionsGet;
                    if (typeof options === 'function') {
                      cb = options;
                  Severity: Minor
                  Found in lib/agent/reports.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                        if (reportName === 'specs' && osName === 'windows' && gte(system.os_release, '10.0.0')
                          && data.os_edition && editions.includes(data.os_edition)
                          && data.winsvc_version && gte(data.winsvc_version, '2.0.0')) {
                          providers.get('tpm_module', (err, output) => {
                            if (!err) data.tpm_module = output;
                    Severity: Major
                    Found in lib/agent/reports.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language