(pid: int)
| 284 | |
| 285 | @staticmethod |
| 286 | def _get_ports_by_pid(pid: int) -> List[int]: |
| 287 | try: |
| 288 | res = set() |
| 289 | for con in psutil.Process(pid).connections(): |
| 290 | if con.status == 'LISTEN': |
| 291 | res.add(con.laddr.port) |
| 292 | return list(res) |
| 293 | except: |
| 294 | return [] |
| 295 | |
| 296 | def get_info(self) -> Dict[str, Any]: |
| 297 | if not self.env: |