custom command check
This commit is contained in:
1 parent
e3d1dbbbf1
commit
4ccec278bf
3 files changed
+7
-39
No files matched your search
@@ -1,33 +0,0 @@
|
||||
#!/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)
|
||||
@@ -1,6 +1,6 @@
|
||||
chmod +x grepp.py
|
||||
chmod +x ../client.py
|
||||
mkdir -p ~/bin
|
||||
cp grepp.py ~/bin/grepp
|
||||
cp ../client.py ~/bin/grepp
|
||||
chmod +x ~/bin/grepp
|
||||
export PATH="$HOME/bin:$PATH" > ~/.bashrc
|
||||
source ~/.bashrc
|
||||
Reference in new issue
Block a user