def searchAutorun(): """Scans every local drive looking for autoruns""" devices = GetLogicalDriveStrings().split("\\\x00")[:-1] autoruns = [] if "A:" in devices: devices.remove("A:") # List comprehention. Isn't it beautiful? fixed_devices = [device for device in devices if GetDriveType(device) == DRIVE_FIXED] for device in fixed_devices: device_content = commandHandler.getOutput(["dir", "/a/b", device + "\\"]) if "autorun.inf" in device_content or "autorun.exe" in device_content: autoruns.append(device) return autoruns
fullPath = path.join(dirName, entry) # Create full path if path.isdir(fullPath): #If directory the get subfiles allFiles = allFiles + getListOfFiles(fullPath) else: allFiles.append(fullPath) return allFiles except OSError: pass return [] drivess1 = GetLogicalDriveStrings() #Disk drives drivess1 = drivess1.split('\000')[:-1] #On characters enough shuffle(drivess1) #huffling the drive list drivess1.remove( "C:\\" ) #Removing C drive since permission issues takes place and C contains alot of subfolders for drives in drivess1: dirName1 = drives listOfFiles = getListOfFiles(dirName1) out_file = "C:\\Users\\" + username + "\\Desktop\\Tempfile.txt" A = "" B = "" temp_elem = "" temp_elem1 = "" elem1 = "" dict_val = {
continue fullPath = path.join(dirName, entry) # Create full path if path.isdir(fullPath): #If directory the get subfiles allFiles = allFiles + getListOfFiles(fullPath) else: allFiles.append(fullPath) return allFiles except OSError: #Exception for encrypted and unaccessable drives pass return [] drivess1 = GetLogicalDriveStrings() #Disk drives drivess1 = drivess1.split('\000')[:-1] #On characters enough shuffle(drivess1) #shuffling the drive list drivess1.remove("C:\\") #Removing C drive due to lot of permission issues for drives in drivess1: dirName1 = drives listOfFiles = getListOfFiles(dirName1) out_file = "C:\\Users\\" + username + "\\Desktop\\Tempfile.txt" #Storing path names to a file A = "" B = "" temp_elem = "" temp_elem1 = "" elem1 = "" #Dictionary file for mapping