IMcPwn/browser-backdoor

View on GitHub

Showing 714 of 714 total issues

Method has too many lines. [11/10]
Open

    def self.writeResult(msg, ws, log, outLoc)
        begin
            file = File.open(outLoc + "/bb-result-#{Time.now.to_f}.txt", "w")
            file.write(msg)
            Bbs::PrintColor.print_notice("Response received but is too large to display (#{msg.length} characters). Saved to #{file.path}")
Severity: Minor
Found in server/lib/bbs/websocket.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [11/10]
Open

    def Command.rmCommand(log, cmdIn)
        if cmdIn.length < 2
            Bbs::PrintColor.print_error("Usage is rm FILE_PATH. Type help for help.")
        else
            begin
Severity: Minor
Found in server/lib/bbs/commands.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [11/10]
Open

    def self.sendCommand(cmd, ws)
        command = ""\
            "setTimeout((function() {"\
            "try {"\
            "#{cmd}"\
Severity: Minor
Found in server/lib/bbs/websocket.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method cmdLine has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def cmdLine(log, wss, configfile, commands, infoCommands)
    log.info("Command line started.")
    begin
        while cmdIn = Readline::readline("\nbbs > ".colorize(:cyan))
            case cmdIn.split()[0]
Severity: Minor
Found in server/bbsconsole.rb - 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

Method execCommand has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def Command.execCommand(log, wss, uglify, cmdIn)
        selected = wss.getSelected()
        wsList = wss.getWsList()
        if cmdIn.length < 2
            execCommandLoop(log, wss)
Severity: Minor
Found in server/lib/bbs/commands.rb - About 1 hr to fix

    Method startEM has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def startEM(log, host, port, secure, priv_key, cert_chain, response_limit, outLoc)
            log.info("Listening on host #{host}:#{port}")
            EM.run {
                EM::WebSocket.run({
                    :host => host,
    Severity: Minor
    Found in server/lib/bbs/websocket.rb - About 1 hr to fix

      Function createWindow has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function createWindow() {
          // You can change CommandOrControl+Alt+\ to the shortcut to manage the application.
          globalShortcut.register('CommandOrControl+Alt+\\', function () {
              let result = dialog.showMessageBox({
                  type: 'info',
      Severity: Minor
      Found in client/main.js - About 1 hr to fix

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

            fs.writeFile(fullPath, data, encoding, { flag: "wx" }, function(err) {
                if (err) {
                    ws.send("Error creating file: " + err.toString());
                } else {
                    ws.send("Created " + fullPath);
        Severity: Major
        Found in server/modules/createFileForce.js and 1 other location - About 1 hr to fix
        server/modules/createFile.js on lines 20..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 55.

        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

        Method startEM has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def startEM(log, host, port, secure, priv_key, cert_chain, response_limit, outLoc)
        Severity: Major
        Found in server/lib/bbs/websocket.rb - About 1 hr to fix

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

              fs.writeFile(fullPath, data, function(err) {
                  if (err) {
                      ws.send("Error creating file: " + err.toString());
                  }
                  else {
          Severity: Major
          Found in server/modules/createFile.js and 1 other location - About 1 hr to fix
          server/modules/createFileForce.js on lines 21..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 55.

          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

              fs.readdir(fullPath, 'utf8', function (err, data) {
                  if (err) {
                      ws.send("Error reading directory: " + err.toString());
                  } else {
                      ws.send(data);
          Severity: Minor
          Found in server/modules/readDir.js and 1 other location - About 50 mins to fix
          server/modules/downloadFile.js on lines 20..26

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

          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

              fs.readFile(fullPath, encoding, function (err, data) {
                  if (err) {
                      ws.send("Error downloading file: " + err.toString());
                  } else {
                      ws.send(data);
          Severity: Minor
          Found in server/modules/downloadFile.js and 1 other location - About 50 mins to fix
          server/modules/readDir.js on lines 19..25

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

          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

          Block has too many lines. [31/25]
          Open

                  EM.run {
                      EM::WebSocket.run({
                          :host => host,
                          :port => port,
                          :secure => secure,
          Severity: Minor
          Found in server/lib/bbs/websocket.rb by rubocop

          This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

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

          moveToTrash = function (fullPath) {
              electron.shell.moveItemToTrash(fullPath);
              ws.send("Moved " + fullPath + " to trash");
          }
          Severity: Minor
          Found in server/modules/moveToTrash.js and 1 other location - About 40 mins to fix
          server/modules/writeClipboard.js on lines 17..20

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

          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

          writeClipboard = function (data) {
              electron.clipboard.writeText(data);
              ws.send("Wrote " + data + " to clipboard");
          }
          Severity: Minor
          Found in server/modules/writeClipboard.js and 1 other location - About 40 mins to fix
          server/modules/moveToTrash.js on lines 17..20

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

          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

          Method cmdLine has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def cmdLine(log, wss, configfile, commands, infoCommands)
          Severity: Minor
          Found in server/bbsconsole.rb - About 35 mins to fix

            Method detectResult has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def self.detectResult(msg, ws, log, response_limit, outLoc)
            Severity: Minor
            Found in server/lib/bbs/websocket.rb - About 35 mins to fix

              Method loadConfig has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def Config.loadConfig
                      @@configfile = YAML.load_file("config.yml")
                      if @@configfile['secure']
                          if !File.exist?(@@configfile['priv_key'])
                              abort("Fatal error: Private key (#{@@configfile['priv_key']}) does not exist but is configured in config.yml.")
              Severity: Minor
              Found in server/lib/bbs/config.rb - About 35 mins 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

              Avoid parameter lists longer than 5 parameters. [8/5]
              Open

                  def startEM(log, host, port, secure, priv_key, cert_chain, response_limit, outLoc)
              Severity: Minor
              Found in server/lib/bbs/websocket.rb by rubocop

              This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

              Avoid too many return statements within this method.
              Open

                      return true
              Severity: Major
              Found in server/lib/bbs/websocket.rb - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language