Skip to content

Instantly share code, notes, and snippets.

@fourdollars
Created January 25, 2010 04:53
Show Gist options
  • Save fourdollars/285644 to your computer and use it in GitHub Desktop.
Save fourdollars/285644 to your computer and use it in GitHub Desktop.
#! /usr/bin/env sh
for master in $(nmblookup -M -- - | grep -v '^querying' | awk '{ print $1 }'); do
smbclient -U% -L $master 2>&1 1>/dev/null | grep '^Domain=' | head -n 1 | awk '{ split( $1, field, /[\[\]]/); print field[2] }'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment