Skip to content

Instantly share code, notes, and snippets.

@gadgetmies
Created July 29, 2025 17:42
Show Gist options
  • Select an option

  • Save gadgetmies/09ebeea4918655c0040ffbea814be316 to your computer and use it in GitHub Desktop.

Select an option

Save gadgetmies/09ebeea4918655c0040ffbea814be316 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Scanning network for devices..."
ips=$(arp -a | awk '{print $2}' | tr -d '()')
echo "Testing for SSH (port 22)..."
for ip in $ips; do
timeout 1s nmblookup -A ${ip}
python3 -c "
import socket
s = socket.socket()
s.settimeout(1)
try:
s.connect(('${ip}', 22))
print('SSH open: ${ip}')
except:
pass
s.close()
"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment