hackedteam/vector-offline2

View on GitHub

Showing 64 of 176 total issues

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

    def check_devices(self):
        devs = os.listdir('/dev/')
        hds = []

        print("Searching hd devices...")
Severity: Minor
Found in offline-linux/offline-install/offline_gui.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

Avoid deeply nested control flow statements.
Open

                            if len(mountpoint) != 0:
                                print("  Found: " + j[0] + " -> /dev/" + j[1] + " -> " + j[2] + " -> " + uuid_sup + ' -> ' + mountpoint)
                                self.exslin = True
                                tablemount.append([j[0], j[1], j[2], mountpoint])

Severity: Major
Found in offline-linux/offline-install/offline_gui.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if os.path.exists("/mnt/RCSPE/files/LINUX/") == False:
                                self.stalin = False
                                self.liclin = False
    
                                print("  Not found: Linux license")
    Severity: Major
    Found in offline-linux/offline-install/offline_gui.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if svalue == True:
                                      self.crylin = True
      
      
      Severity: Major
      Found in offline-linux/offline-install/offline_gui.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if ret != 0:
                                        uuid_sup = "UUID"
                                        uuid = subprocess.check_output("blkid | grep -i '{}' | awk '{{print $2}}'".format(j[1]), shell=True)[6:-2].decode('utf-8')
                                        mountpoint = subprocess.check_output("cat /mnt/etc/fstab 2> /dev/null | grep -v '#' | grep -i {} | egrep ' / | /home | /var ' | awk '{{print $2}}'".format(uuid), shell=True)[:-1].decode('utf-8')
        
        
        Severity: Major
        Found in offline-linux/offline-install/offline_gui.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if subprocess.check_output("ls -l /mnt2/ | grep '{}' | grep -i '^d' | wc -l".format(line[0]), shell=True).decode('utf-8')[:-1] == '0':
                                      break
          
          
          Severity: Major
          Found in offline-linux/offline-install/offline_gui.py - About 45 mins to fix

            Consider simplifying this complex logical expression.
            Open

                        if is_dir == False and is_temp_dir == False:
                            print("        " + i['username'] + " status is: not infected") 
                            i['status'] = None 
                        elif is_temp_file1 == True and is_temp_file2 == True and is_dir == False:
                            print("        " + i['username'] + " status is: infected")
            Severity: Major
            Found in offline-linux/offline-install/offline_gui.py - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                      if osversion.find("10.5") != -1 or osversion.find("10.6") != -1 or osversion.find("10.7") != -1 or osversion.find("10.8") != -1 or osversion.find("10.9") != -1 or osversion.find("10.10") != -1:
                          ossupport = True
              
              
              Severity: Major
              Found in offline-linux/offline-install/offline_gui.py - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                            if i[0] == 'linux' and i[3] == '/':
                                tablelinux.update({'rootdisk': i[1]})
                                tablelinux.update({'rootfs': i[2]})
                                tablelinux.update({'rootmount': i[3]})
                            elif i[0] == 'linux' and i[3] == ('/home' or '/home/'):
                Severity: Major
                Found in offline-linux/offline-install/offline_gui.py - About 40 mins to fix

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

                      def check_ossystems(self):
                          tablemount = self.check_mount()
                          tableosx = {}
                          tablelinux = {}
                  
                  
                  Severity: Minor
                  Found in offline-linux/offline-install/offline_gui.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 [False, False]
                  Severity: Major
                  Found in offline-linux/offline-install/offline_gui.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return [True, False]
                    Severity: Major
                    Found in offline-linux/offline-install/offline_gui.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return True
                      Severity: Major
                      Found in offline-linux/offline-install/offline_gui.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return False
                        Severity: Major
                        Found in offline-linux/offline-install/offline_gui.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return True
                          Severity: Major
                          Found in offline-linux/offline-install/offline_gui.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return False
                            Severity: Major
                            Found in offline-linux/offline-install/offline_gui.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return True
                              Severity: Major
                              Found in offline-linux/offline-install/offline_gui.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return True
                                Severity: Major
                                Found in offline-linux/offline-install/offline_gui.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return False
                                  Severity: Major
                                  Found in offline-linux/offline-install/offline_gui.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                return False
                                    Severity: Major
                                    Found in offline-linux/offline-install/offline_gui.py - About 30 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language