| 74 | This class manages the FTP connection attempts using different usernames and passwords. |
| 75 | """ |
| 76 | def __init__(self, shared_data): |
| 77 | self.shared_data = shared_data |
| 78 | |
| 79 | # Read from SQLite via shared_data (no more CSV) |
| 80 | try: |
| 81 | data = shared_data.read_data() |
| 82 | self.scan = pd.DataFrame(data) |
| 83 | if "Ports" not in self.scan.columns: |
| 84 | self.scan["Ports"] = None |
| 85 | except Exception as e: |
| 86 | logger.warning(f"Could not read data from database: {e}") |
| 87 | self.scan = pd.DataFrame(columns=['MAC Address', 'IPs', 'Hostnames', 'Ports', 'Alive']) |
| 88 | # Ensure Ports column is string type before using .str accessor |
| 89 | self.scan["Ports"] = self.scan["Ports"].astype(str) |
| 90 | self.scan = self.scan[self.scan["Ports"].str.contains("21", na=False)] |
| 91 | |
| 92 | self.users = open(shared_data.usersfile, "r").read().splitlines() |
| 93 | self.passwords = open(shared_data.passwordsfile, "r").read().splitlines() |
| 94 | |
| 95 | self.lock = threading.Lock() |
| 96 | self.ftpfile = shared_data.ftpfile |
| 97 | if not os.path.exists(self.ftpfile): |
| 98 | logger.info(f"File {self.ftpfile} does not exist. Creating...") |
| 99 | with open(self.ftpfile, "w") as f: |
| 100 | f.write("MAC Address,IP Address,Hostname,User,Password,Port\n") |
| 101 | self.results = [] |
| 102 | self.queue = Queue() |
| 103 | self.console = Console() |
| 104 | |
| 105 | def load_scan_file(self): |
| 106 | """ |