Skip to main content

No project description provided

Project description

ADmanage

The provided script is a Python program that interacts with an Active Directory (AD) server using the LDAP protocol. It allows you to perform various operations on DNS entries and AD objects (users, groups and computers).

get_DNSentries

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.get_DNSentries()
ad_client.disconnect()
print(result)

get_DNSentry

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.get_DNSentry('quad9')
ad_client.disconnect()
print(result)

add_DNSentry

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.add_DNSentry('quad9', '149.112.112.112')
ad_client.disconnect()
print(result)

modify_DNSentry

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.modify_DNSentry('quad9', '9.9.9.9')
ad_client.disconnect()
print(result)

del_DNSentry

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.del_DNSentry('quad9')
ad_client.disconnect()
print(result)

get_ADobjects

Searches for and returns all user, group, and computer objects.

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.get_ADobjects()
ad_client.disconnect()
print(result)

get_ADobject

Searches for and returns a specific AD object based on its sAMAccountName value.

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.get_ADobject('Administrator')
ad_client.disconnect()
print(result)

add_ADobject

Adds users, computers, or groups to the AD server.

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.add_ADobject('OU=test,DC=cobblepot59,DC=int', {'objectClass': 'user', 'givenName': 'Jack', 'sn': 'Bower', 'password': 'Password1'})
ad_client.disconnect()
print(result)
from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.add_ADobject('OU=test,DC=cobblepot59,DC=int', {'objectClass': 'computer', 'cn': 'jbower-pc'})
ad_client.disconnect()
print(result)
from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.add_ADobject('OU=test,DC=cobblepot59,DC=int', {'objectClass': 'group', 'cn': '24hChrono'})
ad_client.disconnect()
print(result)

del_ADobject

Deletes a specified AD object.

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.del_ADobject('jbower')
ad_client.disconnect()
print(result)
from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.del_ADobject('jbower-pc$')
ad_client.disconnect()
print(result)

get_member

Retrieves the members of a specified group.

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.get_member('Administrators')
ad_client.disconnect()
print(result)

get_memberOf

Retrieves the groups to which a user belongs.

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.get_memberOf('Administrator')
ad_client.disconnect()
print(result)

add_ADobject_to_group

Adds an AD object to a group.

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.add_ADobject_to_group('jbower', 'test')
ad_client.disconnect()
print(result)

del_ADobject_from_group

Removes an AD object from a group.

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.del_ADobject_from_group('jbower', 'test')
ad_client.disconnect()
print(result)

modify_ADobject_attributes

Modifies attributes of a specified AD object.

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.modify_ADobject_attributes('jbower', {'mail': 'jack.bower@cobblepot59.int'})
ad_client.disconnect()
print(result)

reset_password

Resets the password of a user (works with SSL bind).

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.reset_password('jbower', 'Password2')
ad_client.disconnect()
print(result)

enable_ADobject

Enables a user or computer account.

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.enable_ADobject('jbower')
ad_client.disconnect()
print(result)

disable_ADobject

Disables a user or computer account.

from ADmanage import ADclient

ad_client = ADclient(domain='cobblepot59.int', username='Administrator', password='Password1', dc_ip='ldap.cobblepot59.int', base_dn='DC=cobblepot59,DC=int', secure=True)
result = ad_client.disable_ADobject('jbower-pc$')
ad_client.disconnect()
print(result)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

admanage-0.9.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

ADmanage-0.9-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file admanage-0.9.tar.gz.

File metadata

  • Download URL: admanage-0.9.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for admanage-0.9.tar.gz
Algorithm Hash digest
SHA256 32c96d2960d7b275d2875bea56c9e19437f7e4648871df607af6dabeac0a2fb6
MD5 668bdb3f84cb38bf8a4be0bafc50d28e
BLAKE2b-256 cbf0ec46367a8d2ffd12be218942c1bf65d27ac5a4a041e8dcae1cb26cb82ee2

See more details on using hashes here.

File details

Details for the file ADmanage-0.9-py3-none-any.whl.

File metadata

  • Download URL: ADmanage-0.9-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for ADmanage-0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 3168dc23dec8843e2ab7cc4b7f0b9db26ee0f7e238254efb45e34a365d8b492a
MD5 ffad67f1169c71f3dc1a4dd0474b9442
BLAKE2b-256 b05469d04f566b1614ce0992c5ad58b8d369a73a4b3c7962a9da2a91a0ce8f44

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page