コンテンツにスキップ

カテゴリ目次へ戻る / コマンド全体目次へ戻る

対象の Windows 端末がスタンドアロン、ドメインメンバー、Domain Controller のどれかを調べ、ドメインやフォレストの情報を表示します。

項目内容
実装examples/machine_role.py
カテゴリActive Directory / LDAP / アカウント管理
規模176 行
配布setup.py の scripts=examples/*.py によりスクリプトとしてインストール

オプションの最新の定義は python examples/machine_role.py -h で確認できます。

引数説明
target[[domain/]username[:password]@]
-tsAdds timestamp to every logging output
-debugTurn DEBUG output ON
-dc-ipIP Address of the domain controller. If ommited it use the domain part (FQDN) specified in the target parameter
-target-ipIP Address of the target machine. If ommited it will use whatever was specified as target. This is useful when target is the NetBIOS name and you cannot resolve it
-portDestination port to connect to SMB Server(選択肢: 139, 445、既定値: 445)
-hashesNTLM hashes, format is LMHASH:NTHASH
-no-passdon’t ask for password (useful for -k)
-kUse Kerberos authentication. Grabs credentials from ccache file (KRB5CCNAME) based on target parameters. If valid credentials cannot be found, it will use the ones specified in the command line
-aesKeyAES key to use for Kerberos Authentication (128 or 256 bits)

SMB named pipe \pipe\lsarpc 上の MS-DSSP interface へ接続し、DsRolerGetPrimaryDomainInformation の応答を取得して、machine role、NetBIOS/DNS domain 名、forest 名、domain GUID を表示します。

MS-DSSP の DsRolerGetPrimaryDomainInformation は、host が認識している primary domain と machine role を一つの構造体で返します。このコマンドは SMB 上の \pipe\lsarpc へ DCE/RPC 接続し、DSSP interface に bind して basic domain information level を要求します。

応答の machine role enum は standalone workstation/server、member workstation/server、backup/primary DC を区別します。さらに flat NetBIOS domain 名、DNS domain 名、forest 名、domain GUID を取り出します。単なる OS product type 判定ではなく、domain membership と DC role の確認に使う 情報である点が重要です。

名前解決用の remoteName と実接続先 remoteHost は分離されています。 Kerberos 利用時は SPN に host 名が必要なため、-target-ip へ IP を指定しても 論理名を失ってはいけません。未知 enum や NULL domain field は将来版・ standalone host で起こり得るので、辞書の直接 index だけに依存しない実装が 望まれます。

シンボル位置責務を追う入口
MachineRole34__init__()、print_info()
モジュール使用する主な名前
impacket.exampleslogger
impacket.examples.utilsparse_target
impacketversion
impacket.uuidbin_to_string
impacket.dcerpc.v5dssp, transport
  • 照会や認証の試行が中心です。実行回数が多いと監査ログやアカウントロック、対象の負荷に影響します。
  • 失敗時は、名前解決、接続、認証、サービスの状態、権限のどこで止まったかを、プロトコルのステータスから切り分けます。

dcerpc.v5.transport と dcerpc.v5.dssp、共通 target/auth parser に依存します。MachineRole が request と表示を担当します。enum や flag を追加する場合は未知値でも表示が破綻しないようにしてください。