prey/prey-node-client

View on GitHub

Showing 527 of 527 total issues

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

  def enter_pressed(self, widget):
    # print "Enter pressed"
    str = self.entry.get_text()
    if self.sending or str == "" or str == self.respondable:
      return True
Severity: Major
Found in lib/agent/actions/alert/linux/flash.py and 1 other location - About 6 hrs to fix
lib/agent/actions/alert/linux/flash3.py on lines 59..69

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 101.

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

    def enter_pressed(self, widget):
        # print("Enter pressed")
        str = self.entry.get_text()
        if self.sending or str == "" or str == self.respondable:
            return True
Severity: Major
Found in lib/agent/actions/alert/linux/flash3.py and 1 other location - About 6 hrs to fix
lib/agent/actions/alert/linux/flash.py on lines 50..60

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 101.

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 request has 155 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const request = function () {
  if (current_request) {
    logger.debug('Already running request');
    return;
  }
Severity: Major
Found in lib/agent/control-panel/long-polling/index.js - About 6 hrs to fix

    File prey-config.py has 424 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/python
    # coding: utf-8
    
    ############################
    # Prey OSX Configurator
    Severity: Minor
    Found in lib/conf/gui/mac/PreyConfig.app/Contents/MacOS/prey-config.py - About 6 hrs to fix

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

            app = http.createServer((req, res) => {
              if (req.url.includes('/healthz')) {
                // Change default location strategy if native is allowed on mac
                if (osName === 'mac') req.url.includes('location=true') ? geo.set_default('native') : geo.set_default('wifi');
      
      
      Severity: Major
      Found in lib/agent/control-panel/websockets/server.js and 1 other location - About 6 hrs to fix
      lib/agent/control-panel/long-polling/server.js on lines 57..74

      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 156.

      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

            app = http.createServer((req, res) => {
              if (req.url.includes("/healthz")) {
      
                // Change default location strategy if native is allowed on mac
                if (os_name == 'mac')
      Severity: Major
      Found in lib/agent/control-panel/long-polling/server.js and 1 other location - About 6 hrs to fix
      lib/agent/control-panel/websockets/server.js on lines 57..72

      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 156.

      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 perform has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.perform = function (command, persist = 1) {
        if (!command) return handle_error(new Error('No command received'));
      
        if (typeof command.options == 'string') {
          try {
      Severity: Minor
      Found in lib/agent/commands.js - About 5 hrs 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 a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.notify_action = (status, id, action, opts, err, out, time, respId, retries = 0) => {
        if (!id || id === 'report' || action === 'triggers' || action === 'geofencing') return;
        if (retries >= retriesMax) {
          storage.do('del', { type: 'responses', id: respId });
          exports.responses_queue = exports.responses_queue.filter((x) => x.id !== respId);
      Severity: Minor
      Found in lib/agent/control-panel/websockets/index.js - About 5 hrs 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 testExistingConfigurations has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

      const testExistingConfigurations = (cb) => {
        exec(exports.existsNewPath, (_error, stdout) => {
          if (stdout && stdout.trim() !== '') {
            // look for old .plist and remove it
            // eslint-disable-next-line consistent-return
      Severity: Minor
      Found in lib/conf/tasks/prey_owl.js - About 5 hrs 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 startWebsocket has 130 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.startWebsocket = () => {
        clearAndResetIntervals();
        notifyActionInterval = setInterval(retryQueuedResponses, 5000); // <-revisar el tiempo
        notifyAckInterval = setInterval(retryAckResponses, 4 * 1000);
        getStatusInterval = setInterval(getStatusByInterval, 5 * 60 * 1000);
      Severity: Major
      Found in lib/agent/control-panel/websockets/index.js - About 5 hrs to fix

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

        var eachFileOrDirectoryMatching = function(expression, path, callback, completeHandler) {
          var files = [];
          var stats = [];
        
          eachFileOrDirectory(path, function(err, file, stat) {
        Severity: Major
        Found in lib/agent/providers/files/finder.js and 1 other location - About 5 hrs to fix
        lib/agent/providers/files/finder.js on lines 117..132

        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 139.

        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

        var eachFileMatching = function(expression, path, callback, completeHandler) {
          var files = [];
          var stats = [];
        
          eachFile(path, function(err, file, stat) {
        Severity: Major
        Found in lib/agent/providers/files/finder.js and 1 other location - About 5 hrs to fix
        lib/agent/providers/files/finder.js on lines 144..159

        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 139.

        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

            def prev_page(self, button):
                page_name = self.get_page_name()
                decrement = 1
        
                if page_name == "existing_user":
        Severity: Major
        Found in lib/conf/gui/linux/prey-config3.py and 1 other location - About 5 hrs to fix
        lib/conf/gui/linux/prey-config.py on lines 187..199

        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 86.

        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

          def prev_page(self, button):
            page_name = self.get_page_name()
            decrement = 1
        
            if page_name == 'existing_user':
        Severity: Major
        Found in lib/conf/gui/linux/prey-config.py and 1 other location - About 5 hrs to fix
        lib/conf/gui/linux/prey-config3.py on lines 205..217

        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 86.

        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 sync has 120 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.sync = (id, err, triggers, stored, cb) => {
          var watching = [];
        
          if (err) {
            logger.error('error starting async: ' + err);
        Severity: Major
        Found in lib/agent/actions/triggers/index.js - About 4 hrs to fix

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

          system.get_admin_user = remember((cb) => {
            system.find_admin_user((e, user) => {
              if (e || !user || user.trim() == '') {
                const err = new Error('No admin user detected.');
                if (e) err.message += ` ${e.message}`;
          Severity: Major
          Found in lib/system/index.js and 1 other location - About 4 hrs to fix
          lib/system/index.js on lines 92..102

          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 131.

          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

          system.get_logged_user = remember((cb) => {
            system.find_logged_user((e, user) => {
              if (e || !user || user.trim() == '') {
                const err = new Error('No logged user detected.');
                if (e) err.message += ` ${e.message}`;
          Severity: Major
          Found in lib/system/index.js and 1 other location - About 4 hrs to fix
          lib/system/index.js on lines 104..114

          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 131.

          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

            common.system.get_logged_user((err, user) => {
              if (err || !user) return done(new Error(`Unable to get logged user: ${err.toString()}`), null, callback);
              // eslint-disable-next-line consistent-return
              configurePictureUserData();
              // eslint-disable-next-line consistent-return
          Severity: Major
          Found in lib/agent/providers/webcam/mac/index.js and 1 other location - About 4 hrs to fix
          lib/agent/providers/screenshot/mac/index.js on lines 94..105

          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 130.

          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

            common.system.get_logged_user((err, user) => {
              if (err || !user) return done(new Error(`Unable to get logged user: ${err.toString()}`), null, callback);
              // eslint-disable-next-line consistent-return
              configureScreenshotUserData();
              // eslint-disable-next-line consistent-return
          Severity: Major
          Found in lib/agent/providers/screenshot/mac/index.js and 1 other location - About 4 hrs to fix
          lib/agent/providers/webcam/mac/index.js on lines 85..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 130.

          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

              def validate_existing_user_fields(self):
                  if self.text("existing_email") == "":
                      self.show_alert(_("Empty email!"), _("Please type in your email."))
                      return False
                  if self.text("existing_password") == "":
          Severity: Major
          Found in lib/conf/gui/linux/prey-config3.py and 1 other location - About 4 hrs to fix
          lib/conf/gui/linux/prey-config.py on lines 93..101

          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 83.

          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

          Severity
          Category
          Status
          Source
          Language