IMcPwn/browser-backdoor

View on GitHub

Showing 714 of 714 total issues

Assignment Branch Condition size for startEM is too high. [22.36/15]
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 by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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

    Assignment Branch Condition size for writeResult is too high. [21.12/15]
    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 that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Assignment Branch Condition size for loadConfig is too high. [20.71/15]
    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 by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    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 has too many lines. [15/10]
    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 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 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 has too many lines. [15/10]
    Open

        def Command.sessionsCommand(selected, wsList)
            if wsList.length < 1
                puts "No sessions"
                return
            end
    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.

    Assignment Branch Condition size for modulesCommand is too high. [19.52/15]
    Open

        def Command.modulesCommand()
            puts "Modules with a star (*) afterwords are interactive modules."
            puts
            modules = Dir.glob("modules/*.js").select{ |e| File.file? e }
            modules.each do |currModule|
    Severity: Minor
    Found in server/lib/bbs/commands.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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

        def self.validSession?(selected, wsList)
            if selected == -2
                Bbs::PrintColor.print_error("That session has been closed.")
                return false
            elsif selected < -1
    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. [14/10]
    Open

        def self.writeScreenshot(msg, ws, log, outLoc)
            begin
                encodedImage = msg.gsub(/Screenshot data URL: data:image\/png;base64,/, "")
                if encodedImage == "" then raise "Screenshot is empty" end
                image = Base64.strict_decode64(encodedImage)
    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.

    Perceived complexity for execCommand is too high. [10/7]
    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 by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Method has too many lines. [13/10]
    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 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. [13/10]
    Open

        def Command.catCommand(log, cmdIn)
            if cmdIn.length < 2
                Bbs::PrintColor.print_error("Usage is cat 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.

    Perceived complexity for cmdLine is too high. [9/7]
    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 by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Cyclomatic complexity for execCommandLoop is too high. [8/6]
    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 by rubocop

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Cyclomatic complexity for execCommand is too high. [8/6]
    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 by rubocop

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Perceived complexity for execCommandLoop is too high. [9/7]
    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 by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

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

        def Command.targetCommand(wss, cmdIn)
            if cmdIn.length < 2
                Bbs::PrintColor.print_notice("Currently targeted session is #{wss.getSelected()}.")
                return
            end
    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 Command.getCertCommand()
            if File.file?("./getCert.sh")
                system("./getCert.sh")
                return
            end
    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.

    Severity
    Category
    Status
    Source
    Language