IMcPwn/browser-backdoor

View on GitHub

Showing 13 of 714 total issues

Method cmdLine has 62 lines of code (exceeds 25 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: Major
Found in server/bbsconsole.rb - About 2 hrs to fix

    Method execCommandLoop has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def Command.execCommandLoop(log, wss)
            puts "Commands are sent in anonymous functions wrapped in setTimeout(fn, 0) and the eval'd results are returned."
            puts "Commands are also automatically wrapped in ws.send(), so omit any semicolons (;)."
            puts "Enter the command to send (exit to return to the previous prompt)."
            while cmdSend = Readline::readline("\ncmd ##{wss.getSelected()} > ".colorize(:magenta))
    Severity: Minor
    Found in server/lib/bbs/commands.rb - About 2 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

    Method execCommand has a Cognitive Complexity of 17 (exceeds 5 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 2 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

    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

          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

            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 too many return statements within this method.
                Open

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

                  Method infoCommand has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def Command.infoCommand(log, info_commands, selected, wsList)
                          info_commands.each {|_key, cmd|
                              begin
                                  if selected != -1
                                      Bbs::WebSocket.sendCommand(cmd, wsList[selected])
                  Severity: Minor
                  Found in server/lib/bbs/commands.rb - About 25 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

                  Severity
                  Category
                  Status
                  Source
                  Language