LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

machine_role.py

determine a remote Windows host's domain role (Impacket)

TLDR

Query a host with domain credentials
$ machine_role.py [domain]/[user]:[password]@[target]
copy
Use pass-the-hash authentication
$ machine_role.py -hashes [LMHASH]:[NTHASH] [domain]/[user]@[target]
copy
Use Kerberos from a ccache (no password prompt)
$ machine_role.py -k -no-pass [domain]/[user]@[target]
copy
Set the domain controller IP for Kerberos
$ machine_role.py -dc-ip [192.168.1.1] [domain]/[user]:[password]@[target]
copy
Set the target IP when the name does not resolve
$ machine_role.py -target-ip [192.168.1.10] [domain]/[user]:[password]@[hostname]
copy

SYNOPSIS

machine_role.py [options] [[domain/]username[:password]@]target

DESCRIPTION

machine_role.py is an Impacket example that retrieves a Windows host's machine role and primary domain information through MS-DSSP (`DsRolerGetPrimaryDomainInformation`) on the `lsarpc` pipe.It prints one of: standalone workstation, domain-joined workstation, standalone server, domain-joined server, backup domain controller, or primary domain controller, plus NetBIOS domain name, DNS domain name, forest name, and domain GUID.Distro packages often install the same tool as impacket-machine_role. The two names share the same script and options.

PARAMETERS

target

Target in Impacket form: `[[domain/]username[:password]@]targetName or address`.
-target-ip IP
IP address of the target. Defaults to the host in target.
-dc-ip IP
Domain controller IP used for Kerberos.
-port {139,445}
SMB port (default: `445`).
-hashes LMHASH:NTHASH
NTLM hashes instead of a password.
-no-pass
Do not prompt for a password (use with -k or -hashes).
-k
Kerberos authentication from `KRB5CCNAME` when possible.
-aesKey HEX
AES-128 or AES-256 key for Kerberos (implies -k).
-debug
Enable debug output.
-ts
Prefix log lines with a timestamp.

INSTALL

sudo apk add py3-impacket
copy

CAVEATS

Needs SMB access (typically TCP 445) and credentials the target accepts. Not a general Unix/Samba inventory tool. For authorized security testing only.

HISTORY

Part of the Impacket suite, originally by SecureAuth and now maintained by Fortra. Written by Simon Decosse.

SEE ALSO

RESOURCES

Copied to clipboard
Kai