byt3bl33d3r/MITMf

View on GitHub
core/netcreds.py

Summary

Maintainability
F
6 days
Test Coverage

File netcreds.py has 703 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
import binascii
import struct
import base64
import threading
Severity: Major
Found in core/netcreds.py - About 1 day to fix

    Function mail_logins has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
    Open

    def mail_logins(full_load, src_ip_port, dst_ip_port, ack, seq):
        '''
        Catch IMAP, POP, and SMTP logins
        '''
        # Handle the first packet of mail authentication
    Severity: Minor
    Found in core/netcreds.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 other_parser has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
    Open

    def other_parser(src_ip_port, dst_ip_port, full_load, ack, seq, pkt, verbose):
        '''
        Pull out pertinent info from the parsed HTTP packet data
        '''
        user_passwd = None
    Severity: Minor
    Found in core/netcreds.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 pkt_parser has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def pkt_parser(pkt):
        '''
        Start parsing packets here
        '''
        global pkt_frag_loads, mail_auths
    Severity: Minor
    Found in core/netcreds.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 ParseMSKerbv5UDP has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def ParseMSKerbv5UDP(Data):
        '''
        Taken from Pcredz because I didn't want to spend the time doing this myself
        I should probably figure this out on my own but hey, time isn't free why reinvent the wheel?
        Maybe replace this eventually with the kerberos python lib
    Severity: Minor
    Found in core/netcreds.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

    Function frag_remover has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def frag_remover(ack, load):
        '''
        Keep the FILO OrderedDict of frag loads from getting too large
        3 points of limit:
            Number of ip_ports < 50
    Severity: Minor
    Found in core/netcreds.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

    Function ParseMSKerbv5TCP has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def ParseMSKerbv5TCP(Data):
        '''
        Taken from Pcredz because I didn't want to spend the time doing this myself
        I should probably figure this out on my own but hey, time isn't free, why reinvent the wheel?
        Maybe replace this eventually with the kerberos python lib
    Severity: Minor
    Found in core/netcreds.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

    Function get_http_searches has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_http_searches(http_url_req, body, host):
        '''
        Find search terms from URLs. Prone to false positives but rather err on that side than false negatives
        search, query, ?s, &q, ?q, search?p, searchTerm, keywords, command
        '''
    Severity: Minor
    Found in core/netcreds.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

    Function telnet_logins has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def telnet_logins(src_ip_port, dst_ip_port, load, ack, seq):
        '''
        Catch telnet logins and passwords
        '''
        global telnet_stream
    Severity: Minor
    Found in core/netcreds.py - About 55 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 other_parser has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def other_parser(src_ip_port, dst_ip_port, full_load, ack, seq, pkt, verbose):
    Severity: Major
    Found in core/netcreds.py - About 50 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if len(http_url_req) > 98:
                              http_url_req = http_url_req[:99] + '...'
                      printer(src_ip_port, None, http_url_req)
      Severity: Major
      Found in core/netcreds.py - About 45 mins to fix

        Function get_login_pass has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_login_pass(body):
            '''
            Regex out logins and passwords from a string
            '''
            user = None
        Severity: Minor
        Found in core/netcreds.py - About 45 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 parse_basic_auth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def parse_basic_auth(src_ip_port, dst_ip_port, headers, authorization_header):
            '''
            Parse basic authentication over HTTP
            '''
            if authorization_header:
        Severity: Minor
        Found in core/netcreds.py - About 45 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 telnet_logins has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def telnet_logins(src_ip_port, dst_ip_port, load, ack, seq):
        Severity: Minor
        Found in core/netcreds.py - About 35 mins to fix

          Function parse_netntlm has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def parse_netntlm(authenticate_header, authorization_header, headers, ack, seq):
          Severity: Minor
          Found in core/netcreds.py - About 35 mins to fix

            Function mail_logins has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def mail_logins(full_load, src_ip_port, dst_ip_port, ack, seq):
            Severity: Minor
            Found in core/netcreds.py - About 35 mins to fix

              Avoid too many return statements within this function.
              Open

                          return
              Severity: Major
              Found in core/netcreds.py - About 30 mins to fix

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

                def parse_ntlm_resp(msg3, seq):
                    '''
                    Parse the 3rd msg in NTLM handshake
                    Thanks to psychomario
                    '''
                Severity: Minor
                Found in core/netcreds.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 parse_ftp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def parse_ftp(full_load, dst_ip_port):
                    '''
                    Parse out FTP creds
                    '''
                    print_strs = []
                Severity: Minor
                Found in core/netcreds.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 frag_joiner has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def frag_joiner(ack, src_ip_port, load):
                    '''
                    Keep a store of previous fragments in an OrderedDict named pkt_frag_loads
                    '''
                    for ip_port in pkt_frag_loads:
                Severity: Minor
                Found in core/netcreds.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 get_http_line has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def get_http_line(header_lines, http_methods):
                    '''
                    Get the header with the http command
                    '''
                    for header in header_lines:
                Severity: Minor
                Found in core/netcreds.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