Load from SQLite database and filter for SSH ports.
(self)
| 112 | self.scan = pd.DataFrame(data) |
| 113 | if "Ports" not in self.scan.columns: |
| 114 | self.scan["Ports"] = None |
| 115 | # Ensure Ports column is string type before using .str accessor |
| 116 | self.scan["Ports"] = self.scan["Ports"].astype(str) |
| 117 | self.scan = self.scan[self.scan["Ports"].str.contains("22", na=False)] |
| 118 | |
| 119 | def ssh_connect(self, adresse_ip, user, password): |
| 120 | """Attempt to connect to SSH using only the supplied credentials. |
| 121 | Retries up to 3 times on banner/connection errors with backoff.""" |
| 122 | max_retries = 3 |
| 123 | for attempt in range(max_retries): |
| 124 | ssh = paramiko.SSHClient() |
| 125 | ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) |
| 126 | try: |
| 127 | ssh.connect( |
no test coverage detected