nil0x42/phpsploit

View on GitHub

Showing 269 of 269 total issues

Avoid too many return statements within this function.
Open

                return False
Severity: Major
Found in src/ui/interface.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return True
    Severity: Major
    Found in src/ui/interface.py - About 30 mins to fix

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

              if not WORD_TOKEN.fullmatch(name):
                  raise KeyError("illegal name: %r doesn't match %s"
                                 % (name, WORD_TOKEN.pattern))
      Severity: Minor
      Found in src/metadict.py and 1 other location - About 30 mins to fix
      src/core/session/environment.py on lines 53..55

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

      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

              try:
                  script = Path(self.path, "plugin.py", mode='fr').read()
              except ValueError as e:
                  print("[#] Couldn't load plugin: «%s»" % self.path)
                  print("[#]     File error on plugin.py: %s" % e)
      Severity: Minor
      Found in src/core/plugins/Plugin.py and 1 other location - About 30 mins to fix
      src/core/plugins/Plugin.py on lines 36..42

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

      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

      Avoid too many return statements within this function.
      Open

                      return self.interpret("alias %s" % argv[1])
      Severity: Major
      Found in src/ui/interface.py - About 30 mins to fix

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

                try:
                    Path(path, mode='drx')()
                except ValueError as e:
                    print("[#] Couldn't load plugin: «%s»" % self.path)
                    print("[#]     Plugin directory error: %s" % e)
        Severity: Minor
        Found in src/core/plugins/Plugin.py and 1 other location - About 30 mins to fix
        src/core/plugins/Plugin.py on lines 48..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 32.

        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

                    for line in difflines:
                        # dont be too much verbose...
                        if line.startswith('?'):
                            continue
                        print(colorize(color[line[0]], line))
        Severity: Minor
        Found in src/core/session/__init__.py and 1 other location - About 30 mins to fix
        src/ui/color.py on lines 124..127

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

        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

                for line in difflib.Differ().compare(old, new):
                    if line.startswith('?'):
                        continue
                    print(colorize(line_types[line[0]], line))
        Severity: Minor
        Found in src/ui/color.py and 1 other location - About 30 mins to fix
        src/core/session/__init__.py on lines 226..230

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

        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

        Avoid too many return statements within this function.
        Open

                return False
        Severity: Major
        Found in src/ui/interface.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return False
          Severity: Major
          Found in src/ui/interface.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return response
            Severity: Major
            Found in src/core/tunnel/handler.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return tunnel.open()  # it raises exception if fails
              Severity: Major
              Found in src/ui/interface.py - About 30 mins to fix

                Function _sanitize_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def _sanitize_path(path):
                    """Remove unneeded path elements
                
                    >>> _sanitize_path('/foo/../bar/')
                    /bar/
                Severity: Minor
                Found in src/api/server/path.py - 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

                Function __str__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __str__(self):
                        self_str = super().__str__()
                        if self == 1:
                            return "1 byte"
                
                
                Severity: Minor
                Found in src/datatypes/ByteSize.py - 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

                Function complete_set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def complete_set(text, line, *_):
                        """Use settings as `set` completers (case insensitive)"""
                        argv = line.split()
                        if (len(argv) == 2 and line[-1] == " ") or len(argv) > 2:
                            return []
                Severity: Minor
                Found in src/ui/interface.py - 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

                Function complete_env has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def complete_env(text, line, *_):
                        """Use env vars as `env` completers (case insensitive)"""
                        argv = line.split()
                        if (len(argv) == 2 and line[-1] == " ") or len(argv) > 2:
                            return []
                Severity: Minor
                Found in src/ui/interface.py - 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

                Function complete_alias has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def complete_alias(text, line, *_):
                        """autocompletion for `alias` command"""
                        argv = line.split()
                        if (len(argv) == 2 and line[-1] == " ") or len(argv) > 2:
                            return []
                Severity: Minor
                Found in src/ui/interface.py - 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

                Function __new__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __new__(cls, value=0):
                
                        # convert to an uppercase string, and format it.
                        value = str(value)
                        if len(value.splitlines()) != 1:
                Severity: Minor
                Found in src/datatypes/ByteSize.py - 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

                Function __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __init__(self, value=None, title=None):
                        if value is None:
                            value = {}
                        self.update(value)
                
                
                Severity: Minor
                Found in src/metadict.py - 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

                Function Code has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def Code(language):
                
                    class ColoredCode(str):
                        """Piece of source code. (extends str)
                        Takes a string representing a portion of source code.
                Severity: Minor
                Found in src/datatypes/Code.py - 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