Giter VIP home page Giter VIP logo

ad-dfs-decode's Introduction

In case of a desaster recovery e.g. Ransomware you might be able to fetch a ldifde export from one of your Active Directory servers. This dump may help you to find a lot of informations.

For example the AD dump contains the DFS (Distributed FileSystem) Namespaces, targets etc.

Its a bit tricky to decode that information as Microsoft choose to make it extra hard as they have a base64 encoder bug (Misplacing \ and /) and other strange ideas of putting a UTF-16 XML (with BOM) as base64 into an AD objects key.

LDIF example

dn: CN=DEHR,CN=DEHR,CN=Dfs-Configuration,CN=System,DC=domain,DC=de
changetype: add
objectClass: top
objectClass: msDFS-Namespacev2
cn: DEHR
[ ... ]
msDFS-GenerationGUIDv2:: 1iC7RgVKU4Hk0lgAkz4q==
msDFS-NamespaceIdentityGUIDv2:: OuDrOqrec0x0mP5KW47G==
msDFS-LastModifiedv2: 20221209084040.0Z
msDFS-Ttlv2: 300
msDFS-Propertiesv2: ABDE=on
msDFS-Propertiesv2: ReferralSiteCosting=on
msDFS-Propertiesv2: State=okay
msDFS-TargetListv2::
 //48ad8aabTagWaiab2auaCGbZagKaBWbUad0aiGaXac4amaaIaAAZQBuAGMAbBkAGkAbgBnAD
 [ ... ]

Installation

apt-get install libfile-slurp-perl libgetopt-long-descriptive-perl \
	libxml-simple-perl libtext-iconv-perl

Extract DFS Namespace and Targets

./decode-dfs --ldif adds/ad.ldf
DEHR;/HR;0;siteCostNormal;\\SVFS12\DEHR;
DEHR;/HR;0;siteCostNormal;\\SVFS1\DEHR;

Extract shared mailboxes access

./shared-mailboxes -l adds/ad.ldf
Boss, Big;CN=Boss\, Big,OU=User,OU=Elite,DC=domain,DC=de;;
;;CN=Secretary\, My,OU=Organisation,DC=Domain,DC=de;
[ ... ]

Extract mailbox quota

./mailquota -l adds/ad.ldif
samaccountname;dn;company;msExchArchiveQuota;msExchArchiveWarnQuota;msExchDumpsterQuota;msExchDumpsterWarningQuota;Addresses
Boss, Big,CN=Boss\, Big,DC=domain,DC=de;;104857600;94371840;31457280;20971520;,,,,,,,,,,,,,,,,,,,,,,,,,,

Extract DN SID pairs

./dnsid -l adds/ad.ldif \
	| sort -t- -n -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 \
	>dnsid.csv

ad-dfs-decode's People

Contributors

flohoff avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.