16 lines
528 B
Python
16 lines
528 B
Python
import paramiko
|
|
|
|
def main():
|
|
for ip in ['140.44.4.71', '140.44.4.72']:
|
|
ssh = paramiko.SSHClient()
|
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
ssh.connect(ip, username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
|
stdin, stdout, stderr = ssh.exec_command('sudo ss -tulpn | grep -E ":80 |:443 |:81 " || true')
|
|
print(f"=== PORTS ON {ip} ===")
|
|
print(stdout.read().decode())
|
|
ssh.close()
|
|
|
|
if __name__ == '__main__':
|
|
main()
|
|
|