byt3bl33d3r/MITMf

View on GitHub
core/servers/SMB.py

Summary

Maintainability
D
2 days
Test Coverage

Function handle has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def handle(self):
        try:
            while True:
                data = self.request.recv(1024)
                self.request.settimeout(1)
Severity: Minor
Found in core/servers/SMB.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

File SMB.py has 309 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# This file is part of Responder
# Original work by Laurent Gaffie - Trustwave Holdings
#
# This program is free software: you can redistribute it and/or modify
Severity: Minor
Found in core/servers/SMB.py - About 3 hrs to fix

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

    def Parse_Nego_Dialect(data):
        packet = data
        try:
            Dialect = tuple([e.replace('\x00','') for e in data[40:].split('\x02')[:10]])
    
    
    Severity: Minor
    Found in core/servers/SMB.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 Is_Anonymous has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def Is_Anonymous(data):
        SecBlobLen = struct.unpack('<H',data[51:53])[0]
    
        if SecBlobLen < 260:
            LMhashLen = struct.unpack('<H',data[89:91])[0]
    Severity: Minor
    Found in core/servers/SMB.py - 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

    Function handle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle(self):
            try:
                self.request.settimeout(0.5)
                data = self.request.recv(1024)
                
    Severity: Minor
    Found in core/servers/SMB.py - 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 function.
    Open

                return "\x0e\x00"
    Severity: Major
    Found in core/servers/SMB.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return "\x07\x00"
      Severity: Major
      Found in core/servers/SMB.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return "\x0f\x00"
        Severity: Major
        Found in core/servers/SMB.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return "\x06\x00"
          Severity: Major
          Found in core/servers/SMB.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return "\x0a\x00"
            Severity: Major
            Found in core/servers/SMB.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return "\x0b\x00"
              Severity: Major
              Found in core/servers/SMB.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return "\x09\x00"
                Severity: Major
                Found in core/servers/SMB.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return "\x08\x00"
                  Severity: Major
                  Found in core/servers/SMB.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return "\x0d\x00"
                    Severity: Major
                    Found in core/servers/SMB.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return "\x05\x00"
                      Severity: Major
                      Found in core/servers/SMB.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return "\x04\x00"
                        Severity: Major
                        Found in core/servers/SMB.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return "\x0c\x00"
                          Severity: Major
                          Found in core/servers/SMB.py - About 30 mins to fix

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

                            def IsNT4ClearTxt(data, client):
                                HeadLen = 36
                            
                                if data[14:16] == "\x03\x80":
                                    SmbData = data[HeadLen+14:]
                            Severity: Minor
                            Found in core/servers/SMB.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

                            There are no issues that match your filters.

                            Category
                            Status