nil0x42/phpsploit

View on GitHub

Showing 79 of 269 total issues

File interface.py has 883 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""PhpSploit shell interface

Handles general behavior of Phpsploit interactive command-line interface.
"""
# pylint: disable=too-many-lines
Severity: Major
Found in src/ui/interface.py - About 2 days to fix

    File handler.py has 637 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """Phpsploit HTTP request handler"""
    __all__ = ["Request", "new_request", "get_raw_requests"]
    
    import sys
    import re
    Severity: Major
    Found in src/core/tunnel/handler.py - About 1 day to fix

      Function __call__ has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
      Open

          def __call__(self, question=None):
      
              # use custom question, or fallback to the default one.
              if question is not None:
                  question = str(question)
      Severity: Minor
      Found in src/ui/input/expect.py - About 1 day 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 do_help has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
      Open

          def do_help(self, argv):
              """Show commands help
      
              SYNOPSIS:
                  help
      Severity: Minor
      Found in src/ui/interface.py - About 1 day 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 build_multipart_request has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          def build_multipart_request(self, method, php_payload):
              """build a multipart request for `php_payload` with HTTP `method`
      
              For infos about return format, read build_request() docstring.
              """
      Severity: Minor
      Found in src/core/tunnel/handler.py - 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 _obj_value has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          def _obj_value(self, raw=None, fatal_errors=True):
              """Restore Session() from its 'built-in types only' representation.
              Used to get back Session() from data returned by _raw_value() method
      
              >>> from core import session
      Severity: Minor
      Found in src/core/session/__init__.py - About 4 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 Build has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          def Build(self, php_payload):
              """Main request Builder:
      
              if takes the basic php payload as argument,
              and returns the apropriate request object.
      Severity: Minor
      Found in src/core/tunnel/handler.py - About 4 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

      Shell has 33 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Shell(shnake.Shell):
          """PhpSploit shell interface"""
      
          prompt = colorize('%Lined', 'phpsploit', '%Reset', ' > ')
      
      
      Severity: Minor
      Found in src/ui/interface.py - About 4 hrs to fix

        Function _build_env has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def _build_env(self, raw_vars):
                """collect the server related vars, usefull for further
                plugins usage and framework management.
                written at self.CNF['SRV'] on the interface's core.
                """
        Severity: Minor
        Found in src/core/tunnel/connector.py - About 3 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 Send has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def Send(self, request):
                """Main request Sender:
        
                if takes the concerned request object as argument
                and returns the unparsed and decapsulated phpsploit response
        Severity: Minor
        Found in src/core/tunnel/handler.py - About 3 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 run has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self, argv):
                """run current plugin
                """
                self.argv = argv
                from api import server
        Severity: Minor
        Found in src/core/plugins/Plugin.py - About 3 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 do_exit has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def do_exit(self, argv):
                """Quit current shell interface
        
                SYNOPSIS:
                    exit [--force]
        Severity: Minor
        Found in src/ui/interface.py - 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

        File linebuf.py has 278 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """Provide advanced line-buffers for phpsploit session settings"""
        
        import os
        import hashlib
        import random
        Severity: Minor
        Found in src/linebuf.py - About 2 hrs to fix

          File __init__.py has 275 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """PhpSploit Session Manager
          
          When imorted for the first time, the "session" package initializes it
          self as a PhpSploit blank session, with its default values.
          
          
          Severity: Minor
          Found in src/core/session/__init__.py - About 2 hrs to fix

            Function do_session has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def do_session(argv):
                    """phpsploit session handler
            
                    SYNOPSIS:
                        session [load|diff] [<FILE>]
            Severity: Minor
            Found in src/ui/interface.py - 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

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

                def __init__(self):
                    """Get phpsploit configuration directory,
                    by checking, in this order of preference:
                      - $PHPSPLOIT_CONFIG_DIR/ (only if env var exists)
                      - $XDG_CONFIG_HOME/phpsploit/ (only if env var exists)
            Severity: Minor
            Found in src/core/config.py - 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

            Request has 22 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Request:
                """Phpsploit HTTP Request Handler
                """
                # the list of available methods
                methods = ['GET', 'POST']
            Severity: Minor
            Found in src/core/tunnel/handler.py - About 2 hrs to fix

              Function __setitem__ has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __setitem__(self, name, value):
                      # if the set value is a *LineBuffer instance, just do it!
                      if isinstance(value, linebuf.AbstractLineBuffer):
                          return super().__setitem__(name, value)
              
              
              Severity: Minor
              Found in src/core/session/settings/__init__.py - 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

              Function _load_plugins has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _load_plugins(self, categories):
                      """Fill current plugins instance with currently available plugins.
              
                      All plugins are added to self items, with a key equal to the
                      plugin name. Each plugin value is a Plugin() instance.
              Severity: Minor
              Found in src/core/plugins/__init__.py - 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

              Function open has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  def open(self, php_payload):
                      """open a request to the server with the given php payload
                      It respectively calls the Build(), Send() and Read() methods.
                      if one of these methods returns a string, it will be considered as
                      an error, so execution will stop, and self.error will be filled.
              Severity: Minor
              Found in src/core/tunnel/handler.py - 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

              Severity
              Category
              Status
              Source
              Language