objects
import "github.com/TheManticoreProject/Manticore/network/ldap/objects"
Index
- type Computer
- type Domain
- func (domain *Domain) GetAllComputers() (map[string]*Computer, error)
- func (domain *Domain) GetDomainFunctionalityLevel() (ldap_attributes.DomainFunctionalityLevel, error)
- func (domain *Domain) IsDomainFunctionalityLevelEqualTo(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)
- func (domain *Domain) IsDomainFunctionalityLevelGreaterThan(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)
- func (domain *Domain) IsDomainFunctionalityLevelGreaterThanOrEqualTo(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)
- func (domain *Domain) IsDomainFunctionalityLevelLowerThan(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)
- func (domain *Domain) IsDomainFunctionalityLevelLowerThanOrEqualTo(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)
- type LdapSessionInterface
- type User
type Computer
type Computer struct {
// LdapSession is the LDAP session object
LdapSession LdapSessionInterface
// DistinguishedName is the distinguished name of the computer
DistinguishedName string
// DNSHostname is the DNS hostname of the computer
DNSHostname []string
}
type Domain
type Domain struct {
// LdapSession is the LDAP session object
LdapSession LdapSessionInterface
// DistinguishedName is the distinguished name of the domain
DistinguishedName string
// NetBIOSName is the NetBIOS name of the domain
NetBIOSName string
// DNSName is the DNS name of the domain
DNSName string
// SID is the SID of the domain
SID string
}
func (*Domain) GetAllComputers
func (domain *Domain) GetAllComputers() (map[string]*Computer, error)
GetAllComputers retrieves all computer objects from the LDAP directory.
This function performs an LDAP search to find all objects with the objectClass “computer” within the domain’s distinguished name. It retrieves the distinguished name and DNS hostname attributes for each computer object and constructs a map of Computer objects.
Returns:
- A map where the keys are the distinguished names of the computer objects and the values are pointers to Computer objects representing the retrieved computer objects.
Example usage:
domain := &Domain{LdapSession: ldapSession, DistinguishedName: "DC=example,DC=com"}
computers := domain.GetAllComputers()
for dn, computer := range computers {
fmt.Printf("Computer DN: %s, DNS Hostname: %v\n", dn, computer.DNSHostname)
}
func (*Domain) GetDomainFunctionalityLevel
func (domain *Domain) GetDomainFunctionalityLevel() (ldap_attributes.DomainFunctionalityLevel, error)
GetDomainFunctionalityLevel gets the domain’s functionality level.
func (*Domain) IsDomainFunctionalityLevelEqualTo
func (domain *Domain) IsDomainFunctionalityLevelEqualTo(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)
IsDomainFunctionalityLevelEqualTo checks if the domain’s functionality level is equal to the specified level.
func (*Domain) IsDomainFunctionalityLevelGreaterThan
func (domain *Domain) IsDomainFunctionalityLevelGreaterThan(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)
IsDomainFunctionalityLevelGreaterThan checks if the domain’s functionality level is greater than the specified level.
func (*Domain) IsDomainFunctionalityLevelGreaterThanOrEqualTo
func (domain *Domain) IsDomainFunctionalityLevelGreaterThanOrEqualTo(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)
IsDomainFunctionalityLevelGreaterThanOrEqualTo checks if the domain’s functionality level is greater than or equal to the specified level.
func (*Domain) IsDomainFunctionalityLevelLowerThan
func (domain *Domain) IsDomainFunctionalityLevelLowerThan(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)
IsDomainFunctionalityLevelLowerThan checks if the domain’s functionality level is lower than the specified level.
func (*Domain) IsDomainFunctionalityLevelLowerThanOrEqualTo
func (domain *Domain) IsDomainFunctionalityLevelLowerThanOrEqualTo(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)
IsDomainFunctionalityLevelLowerThanOrEqualTo checks if the domain’s functionality level is lower than or equal to the specified level.
type LdapSessionInterface
type LdapSessionInterface interface {
Connect() (bool, error)
ReConnect() (bool, error)
Close()
// Query functions
Query(searchBase string, query string, attributes []string, scope int) ([]*ldap.Entry, error)
QueryWholeSubtree(searchBase string, query string, attributes []string) ([]*ldap.Entry, error)
QueryBaseObject(searchBase string, query string, attributes []string) ([]*ldap.Entry, error)
QuerySingleLevel(searchBase string, query string, attributes []string) ([]*ldap.Entry, error)
QueryChildren(searchBase string, query string, attributes []string) ([]*ldap.Entry, error)
// Domain functions
GetDomain(distinguishedName string) (*Domain, error)
}
type User
type User struct {
// LdapSession is the LDAP session object
LdapSession LdapSessionInterface
// DistinguishedName is the distinguished name of the user
DistinguishedName string
// sAMAccountName is the sAMAccountName of the user
SamAccountName string
}