ainich/politraf

View on GitHub

Showing 12 of 395 total issues

Function vulners_query has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
Open

    def vulners_query(self):
        try:
            os = "None"
            os_v = "None"
            descr = "None"
Severity: Minor
Found in src/ext_cscan.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 write_iocs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def write_iocs(self):

        today = datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d')

        logging.info("Processing indicators ...")
Severity: Minor
Found in src/otxget.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 print_conversation_header has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def print_conversation_header(pkt):
    try:
        start = time.time()
        protocol = pkt.transport_layer

Severity: Minor
Found in src/constat.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 database_write has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def database_write(today, timestamp, protocol, src_addr, src_port, dst_addr, dst_port, qry_name):
Severity: Major
Found in src/constat.py - About 1 hr to fix

    Function csv_file_write has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def csv_file_write(today, timestamp, protocol, src_addr, src_port, dst_addr, dst_port, qry_name):
    Severity: Major
    Found in src/constat.py - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                                  if self.host_info.json()[hit]["ssh"]["v2"]["metadata"].get('version'):
                                      version = self.host_info.json()[hit]["ssh"]["v2"]["metadata"]["version"]
                          if self.host_info.json()[hit].get('http'):
      Severity: Major
      Found in src/ext_cscan.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if product == "httpd":
                                        product = "Apache"
                                    if self.host_info.json()[hit]["http"]["get"]["metadata"].get('version'):
        Severity: Major
        Found in src/ext_cscan.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                          for i in vulns:
                                              vulns2 = iter(vulns)
                                              for v in vulns2:
                                                  vdesc = v[0]["description"]
                                                  title = v[0]["title"]
          Severity: Major
          Found in src/ext_cscan.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if self.host_info.json()[hit]["http"]["get"]["metadata"].get('version'):
                                            version = self.host_info.json()[hit]["http"]["get"]["metadata"]["version"]
                                if self.host_info.json()[hit].get('https'):
            Severity: Major
            Found in src/ext_cscan.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if self.host_info.json()[hit]["ftp"]["banner"]["metadata"].get('version'):
                                              version = self.host_info.json()[hit]["ftp"]["banner"]["metadata"]["version"]
                                  if self.host_info.json()[hit].get('smb'):
              Severity: Major
              Found in src/ext_cscan.py - About 45 mins to fix

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

                def database_write(stats, mem, disk, timestamp, today):
                Severity: Minor
                Found in src/systat.py - About 35 mins to fix

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

                      def write_iocs(self):
                  
                          logging.info("Processing indicators ...")
                          with open(self.gs, newline='') as csvfile:
                              spamreader = csv.reader(csvfile, delimiter=',', quotechar='|')
                  Severity: Minor
                  Found in src/ioc_self_get.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