Jump to content
  • Entries

    16114
  • Comments

    7952
  • Views

    863545073

Contributors to this blog

  • HireHackking 16114

About this blog

Hacking techniques include penetration testing, network security, reverse cracking, malware analysis, vulnerability exploitation, encryption cracking, social engineering, etc., used to identify and fix security flaws in systems.

0x00はじめに

Microsoftは、Windows Server 2008 R2(およびその後)に複数のActive Directory PowerShell CMDLetsを提供します。

Windowsクライアントでは、リモートサーバー管理ツール(RSAT)をインストールし、Active Directory PowerShellモジュールがインストールされていることを確認する必要があります。 Windows Server(2008 R2以降)で、PowerShellコンソールで次のコマンドを実行します(管理者として):Import-Module ServerManager。 add-windowsfeature rsat-ad-powershell。

kna4j5osd1h8964.jpg

0x01広告ディレクトリプレビュー

AD PowerShell CMDLETSは、次の方法と同じ効果があります。

インポートモジュールアクティブディレクトリ

$ userid="joeuser"

get-aduser $ userid –property *

PowerShell V3バージョンとより高いバージョンでは、PowerShellが必要なモジュールを認識して自動的にロードするため、コマンドの最初の行を実行する必要はないことに注意してください。 Active Directory PowerShellモジュールがロードされたら、ファイルシステムを閲覧するのと同じように広告を閲覧できます。コマンドは次のとおりです。

PS Import-Module ActiveDirectory

PSDIR AD:

PSSET-Location AD:

PSセットロケーション "dc=lab、dc=adsecurity、dc=org"

psdir

plelhvfgeeu8965.gif

0x02便利なコマンド(cmdlets)

を見つけます

1。利用可能なPowerShellモジュールの基本的なモジュールと統計的発見:Get-Module -Listavailable

PowerShellモジュールでCMDLETを発見:Get -Command -Module ActiveDirectory

PowerShell ADモジュールのcmdletsの数:

(Get -Command -Module ActiveDirectory).Count

Windows Server 2008 R2: 76 CMDLETS

Windows Server 2012: 135 cmdlets

Windows Server 2012 R2: 147 CMDLETS

Windows Server 20163360147 CMDLETS

Windows Server 2008 R2メインCMDLETS:

•get/set-adforest

•get/set-addomain

•get/set-addomaincontroller

•get/set-aduser

•get/set-adcomputer

•get/set-adgroup

•get/set-adgroupMember

•get/set-adobject

•Get/Set-AdorganizationalUnit

•enable-adoptionalfeature

•無効化/有効化- アダクカウント

•move-addirectoryserveroperationmasterrole

•新しい虐待者

•new-adcomputer

•new-Adggroup

•new-adobject

•new-adorganizationalUnit

Windows Server 2012には、いくつかの新しいcmdlets:が含まれています

• *-ADRESOURCEPROPERTYLISTMEMBER

• *-adeuthenticationPolicy

• *-adeuthenticationPolicysilo

• *-adcentralaccesspolicy

• *-adcentralAccessrule

• *-AdresourceProperty

• *-ADRESOURCEPROPERTYLIST

• *-ADRESOURCEPROPERTYVALUEETYPE

• *-ADDCCLONECONFIGFILE

• *-adreplicationAttributeMetadata

• *-ADREPLICATIONCONNECTION

• *-ADREPLICATIONFAILURE

• *-ADREPLICATIONPARTNERMETADATA

• *-ADREPLICITIONQUEUOOPERATION

• *-ADREPLICESSITE

• *-ADREPLICATIONSITELINK

• *-ADREPLICATIONSITELINKBRIDGE

• *-ADREPLICATIONSUBNET

• *-ADREPLICATIONUPTODATENESSEVECTORTABLE

•sync-adobject

2。グローバルディレクトリを発見するグローバルカタログ(GCS)•Forest GCS(Forest Global Directory):

インポートモジュールアクティブディレクトリ

$ adforest=get-adforest

$ adforestglobalcatalogs=$ adforest.globalcatalogs

•GCSであるドメインDC(ドメインDCのグローバルディレクトリとして):

インポートモジュールアクティブディレクトリ

$ dcsnotgcs=get -addomaincontroller -filter {isglobalcatalog -eq $ true}

•GCSではないドメインDC(非ドメインDCのグローバルディレクトリとして):

インポートモジュールアクティブディレクトリ

$ dcsnotgcs=get -addomaincontroller -filter {isglobalcatalog -eq $ false}}

3. Active Directory Flexible Single Host操作(FSMO)役割Active Directoryモジュールを見つけます。

(get-adforest).schemamaster

(get-adforest).domainnamingmaster

(get-addomain).infrastructuremaster

(get-addomain).pdcemulator

(get-addomain).ridmaster

.NETコール:

•現在のドメイン:を取得します

[System.DirectoryServices.activedirectory.domain] :GetCurrentDomain()。名前

[System.DirectoryServices.activedirectory.domain] :GetComputerDomain()。名前

•コンピューターのsite: [system.directoryservices.activedirectory.activedirectorysite] :getComputerSite()を取得します

•すべてのドメインコントローラーをドメイン: [System.DirectoryServices.Activedirectory.domain] :GetCurrentDomain()。ドメインコントロラーにリストします

•Active Directory Domain Mode: [System.DirectoryServices.Activedirectory.Domain] :GetCurrentDomain()。ドメインモードを取得します

•Active Directory FSMOS:([system.directoryservices.activedirectory.forest] :getCurrentforest())

([system.directoryservices.activedirectory.forest] :getCurrentforest())

([system.directoryservices.activedirectory.domain] :getCurrentDomain())

([system.directoryservices.activedirectory.domain] :getCurrentDomain())

([system.directoryservices.activedirectory.domain] :getCurrentDomain())

•Active Directory Forest Name:を取得します

[System.DirectoryServices.Activedirectory.Forest] :GetCurrentForest()。名前

•アクティブのサイトのリストを取得します

ディレクトリフォレスト:

[配列] $ adsites=

[System.DirectoryServices.Activedirectory.Forest] :GetCurrentForest()。サイト

•Active Directory Forest Domains:を取得します

[System.DirectoryServices.Activedirectory.Forest] :GetCurrentForest()。ドメイン

•Active Directory Forest Globalを取得します

カタログ:

[System.DirectoryServices.Activedirectory.Forest] :GetCurrentForest()。GlobalCatalogs

•Active Directory Forest Mode:を取得します

[System.DirectoryServices.Activedirectory.Forest] :GetCurrentForest()。ForestMode

•アクティブディレクトリフォレストルートを取得します

domain3360

[System.DirectoryServices.Activedirectory.Forest] :GetCurrentForest()。rootdomain

4。FSMOの役割は、あるDCから別のDCGet-Commandに移動します

-module Activedirectory -Noun *Master *

•移動FSMOロール:

move-addirectoryserveroperationmasterrole

-identity $ dcname -operationmasterrole ridmaster

move-addirectoryserveroperationmasterrole

- アイデンティティ$ dcname-

OperationMasterrole

DomainNamingMaster

move-addirectoryserveroperationmasterrole

-identity $ dcname -operationmasterrole pdcemulato

•FSMOロールの押収:

move-addirectoryserveroperationmasterrole

-identity $ dcname -operationmasterrole pdcemulator -force

0x03 Active Directory PowerShell Module Cmdletの例

1.Get-Rootdse LDAPサーバー(ドメインコントローラー)に関する情報を取得し、その内容を表示します。結果には、DCが実行するオペレーティングシステム情報など、いくつかの興味深い情報が含まれています。

wztmdvd5rja8966.gif

2.Get-Adforestは、このコマンドを実行しているコンピューターでアクティブに提供します

ディレクトリフォレスト情報。

jijbhsawdm58967.gif

3。Get-Addomainは、現在のドメインに関する情報を提供します

svccw3fimfv8968.gif

4.Get-AddomainControllerは、ドメインコントローラーに固有のコンピューター情報を提供します。 CMDLETコマンドを介して、特定のサイトですべてのDCSまたはONSバージョン情報を簡単に見つけることができます。

ytp0fzagqqt8969.gif

5.Get-AdComputerは、ADのほとんどのコンピューターオブジェクトに関する情報を提供します。 「-Prop *」パラメーターで実行されるコマンドは、すべての標準属性情報を表示できます。

h4tbdoc4gr48970.gif

6。広告コンピューターの統計$ time=(測定コマンド `

{[array] $ allcomputers=

get -adcomputer -filter * -properties

名前、canonicalName、enabled、passwordlastset、samaccountname、lastlogontimest

AMP、DistinguishedName、OperatingSystem

})。トータルミニュート

$ allcomputerscount=

$ allcomputers.count

書き込み出力「ありました

$ allcomputerscountコンピューターで発見されました

$ domaindns in $ time分… `r"

7.Get-Aduserは、広告ユーザーに関するコンテンツのほとんどに関する情報を提供します。 「-Prop *」パラメーターを使用してコマンド実行は、すべての標準属性情報を表示できます。

aaksbgbljlz8971.gif

8。広告ユーザー統計インポートモジュールActive Directory

$ domaindns=

[System.DirectoryServices.activedirectory.domain] :GetCurrentDomain()。名前

[array] $ allusers=get-aduser

-filter * -properties

名前、distinguedname、enabled、lastlogondate、lastlogontimestamp、lockedout、msexchhom

eservername、samaccountname

$ alluserscount=$ allusers.count

書き込み出力「ありました

$ aldomaindnsrootで発見されたユーザーオブジェクト… "

[array] $ disabledusers=

$ Allusers | where -object {$ _。enabled -eq $ false}

$ DisabledUserScount=

$ disabledusers.count

[array] $ enabledusers=$ allusers

| where -object {$ _。enabled -eq $ true}

$ enableduserscount=

$ enabledusers.count

書き込み出力「あります

$ enableduserscountはユーザーを有効にし、$ disableduserscountがあります

$ domaindnsの無効なユーザー」

9.Get-Adgroupは広告グループに関する情報を提供し、次のコマンドを実行してすべてのセキュリティグループを見つけます。

get -adgroup -filter {groupCategory -EQ 'セキュリティ}

crkr3iuhks08972.gif

10.Get-AdgroupMemberの列挙およびグループメンバー情報を返します。 「-Recursive」パラメーターを使用して、ネストされたグループのすべてのメンバーを含めます。

Get -AdgroupMember「管理者」 - 再編成

it5j3bz5qsj8973.gif

11.非アクティブコンピューターを見つける次の例は、非アクティブな(古いバージョン)コンピューターとユーザーを探します。過去10日間にパスワードが変更されていないアカウント。これはテストの例であることに注意してください。実際の生産環境については、この推奨事項を60〜90日間のコンピューターと、ユーザー向けの180〜365日間の戦略に変更します。

hxq3qtjvuca8974.gif

12.非アクティブユーザーを見つけるvrawni4c1yx8975.gif

13。ドメイントラストynbgaii5xgb8976.gifを列挙します

14。アクティビティディレクトリの実装日を取得0tmnctsa3g48977.jpg

15.広告パスワードポリシーを取得するvbtp1tshc0a8978.jpg

16。広告サイト情報を取得するには、Windows 2012モジュールにサイトのcmdlet(get-adreplicationsite*)が含まれていることに注意してください。

41kpls5gznm8979.gif

17。TOMBSTONELIFETIME情報を取得するuua1pvylfjq8980.jpg

18.ADのリサイクル情報には、森林機能モード=が必要です

Windows Server 2008 R2

•リサイクルビンを有効にします

(エンタープライズ管理者として)

enable-adoptionalfeature

–Indidity 'CN=リサイクルビン機能、CN=オプション機能、CN=ディレクトリ

サービス、CN=Windows

nt、cn=services、cn=configuration、dc=domain、dc=com ’–Scope

ForestorConfigurationset - ターゲット

「domain.com」

•すべての削除されたユーザーを見つけます

$ deletedusers=get-adobject

-searchbase "cn=削除されたオブジェクト、dc=domain、dc=com" -filter

{objectc