Skip to content

Instantly share code, notes, and snippets.

@simonkuang
Last active July 29, 2019 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonkuang/70ac44d4f49a2901ebece4d35d497c0f to your computer and use it in GitHub Desktop.
Save simonkuang/70ac44d4f49a2901ebece4d35d497c0f to your computer and use it in GitHub Desktop.
to resolve the windows names of PCs in local network
#!/bin/bash
# Only for MacOS
brew install nmap
for i in $(nmap -p3389 192.168.1.0/24 | grep -B5 "3389/tcp open" | grep "report for" | awk "{print \$5}"); do
echo $i: $(smbutil status $i | awk '!(NR%3){print $2}')
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment