trying out custom command

This commit is contained in:
Aryan Singh committed 2026-09-09 01:21:49 -05:00
1 parent 69974badd0
commit 13799144cb
2 files changed
+39

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env python3
import socket
PORT = 5055
ALL_IPS = [
"172.22.156.3",
"172.22.158.2",
"172.22.94.2",
"172.22.156.4",
"172.22.158.3",
"172.22.94.3",
"172.22.156.5",
"172.22.158.4",
"172.22.94.4",
"172.22.156.6"
]
def grep_all_ips(ips):
for ip in ips:
try:
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect((ip, PORT))
print(f"Connected to server at {ip}:{PORT}")
client_socket.sendall("ls -la".encode())
data = client_socket.recv(65536)
print("Received:", data.decode())
except Exception as e:
print(f"Failed to connect to {ip}:{PORT} - {e}")
finally:
client_socket.close()
grep_all_ips(ALL_IPS)