ldap

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package ldap implements LDAP ingestion functionality for Active Directory queries and data collection.

Index

Constants

This section is empty.

Variables

View Source
var FUNCTIONAL_LEVELS = map[string]string{
	"0": "2000 Mixed/Native",
	"1": "2003 Interim",
	"2": "2003",
	"3": "2008",
	"4": "2008 R2",
	"5": "2012",
	"6": "2012 R2",
	"7": "2016",
}
View Source
var OBJECT_TYPE_GUID_MAP = map[string]string{
	"user":                     "bf967aba-0de6-11d0-a285-00aa003049e2",
	"computer":                 "bf967a86-0de6-11d0-a285-00aa003049e2",
	"container":                "bf967a8b-0de6-11d0-a285-00aa003049e2",
	"domain":                   "19195a5a-6da0-11d0-afd3-00c04fd930c9",
	"group":                    "bf967a9c-0de6-11d0-a285-00aa003049e2",
	"organizational-unit":      "bf967aa5-0de6-11d0-a285-00aa003049e2",
	"group-policy-container":   "f30e3bc2-9ff0-11d1-b603-0000f80367c1",
	"pki-enrollment-service":   "ee4aa692-3bba-11d2-90cc-00c04fd91ab1",
	"pki-certificate-template": "e5209ca2-3bba-11d2-90cc-00c04fd91ab1",
	"certification-authority":  "3fdfee50-47f4-11d1-a9c3-0000f80367c1",
	"ms-pki-enterprise-oid":    "37cfd85c-6719-4ad8-8f9e-8678ba627563",
}
View Source
var WELLKNOWN_SIDS = GetWellKnownSIDsData()

Functions

func BytesToGUID

func BytesToGUID(b []byte) string

func ConvertGUID

func ConvertGUID(portion string) string

func ConvertSID

func ConvertSID(hexSID string) (SID string)

func DistinguishedNameToDomain

func DistinguishedNameToDomain(dn string) string

func EncodeGUID

func EncodeGUID(guid string) (string, error)

func EndianConvert

func EndianConvert(sd string) (newSD string)

func FormatTime1 added in v0.2.0

func FormatTime1(whenCreatedStr string) int64

Converts time in format 20060102150405.0Z into Unix epoch seconds.

func FormatTime2 added in v0.2.0

func FormatTime2(fileTimeStr string) int64

Converts a Windows FILETIME to Unix epoch seconds.

func GetWellKnownSIDsData

func GetWellKnownSIDsData() map[string]WksDesc

GetWellKnownSIDsData returns the map of well-known SIDs

func HexToDecimalString

func HexToDecimalString(hex string) (decimal string)

func PagedSearchWorker

func PagedSearchWorker(
	ctx context.Context,
	conn *ldap.Conn,
	job QueryJob,
	updates chan<- ProgressUpdate,
	entries chan<- *ldap.Entry,
	wg *sync.WaitGroup,
)

Types

type LDAPEntry

type LDAPEntry struct {
	DN            string
	Attributes    map[string][]string
	RawAttributes map[string][][]byte
}

func (*LDAPEntry) GetAttrRawVal

func (l *LDAPEntry) GetAttrRawVal(attrName string, defValue []byte) []byte

func (*LDAPEntry) GetAttrRawVals

func (l *LDAPEntry) GetAttrRawVals(attrName string, defValue [][]byte) [][]byte

Raw

func (*LDAPEntry) GetAttrVal

func (l *LDAPEntry) GetAttrVal(attrName string, defValue string) string

func (*LDAPEntry) GetAttrVals

func (l *LDAPEntry) GetAttrVals(attrName string, defValue []string) []string

Normal

func (*LDAPEntry) GetDomainFromDN

func (l *LDAPEntry) GetDomainFromDN() string

func (*LDAPEntry) GetDomainSID

func (l *LDAPEntry) GetDomainSID() (string, error)

func (*LDAPEntry) GetGUID

func (l *LDAPEntry) GetGUID() string

func (*LDAPEntry) GetParentDN

func (l *LDAPEntry) GetParentDN() string

func (*LDAPEntry) GetSID

func (l *LDAPEntry) GetSID() string

func (*LDAPEntry) GetUAC

func (l *LDAPEntry) GetUAC() int64

func (*LDAPEntry) HasLAPS

func (l *LDAPEntry) HasLAPS() bool

Useful

func (*LDAPEntry) Init

func (l *LDAPEntry) Init(e *ldap.Entry)

func (*LDAPEntry) IsDC

func (l *LDAPEntry) IsDC() bool

type ProgressUpdate

type ProgressUpdate struct {
	Row      int
	Page     int
	Total    int
	Speed    float64
	AvgSpeed float64
	Done     bool
	Aborted  bool
	Err      error
	Elapsed  time.Duration
}

type QueryJob

type QueryJob struct {
	Name       string
	BaseDN     string
	Filter     string
	Attributes []string
	PageSize   uint32
	Row        int
	OutputFile string
	BufferSize int // number of entries to buffer before flushing
}

type WksDesc

type WksDesc struct {
	Name string
	Type string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL