Giter Site home page Giter Site logo

pymacad's Introduction

Build Status codecov.io

pymacad

Acknowledgments

This python package is based on KerbMinder (http://github.com/pmbuko/KerbMinder).

pymacad.ad

I would suggest to use from pymacad import ad -- then call using ad.xxx

### Example

>>> from pymacad import ad
>>> ad.bound()
False
>>> ad.accessible('TEST.COM')
False
>>> ad.accessible('FTI.IO')
True

Functions

ad.bound()

checks if computer is bound to AD

  • returns True or False
  • raises subprocess.CalledProcessError

ad.principal(user)

gets principal from AD. If no user is specified, uses the current user.

  • Returns principal
  • Raises NotBound, NotReachable or subprocess.CalledProcessError

ad.accessible(domain)

checks if domain can be joined.

  • Returns True or False
  • raises subprocess.CalledProcessError

ad.searchnodes()

returns a list of available directories

ad.adnode()

returns the first Active Directory node or None

ad.get_domain_dns()

returns the DNS of domain, or raises NotBound

ad.membership(user)

Returns a list of groups belonging to this user Raises NotBound

ad.realms()

Returns a list of Kerberos realms, or NotBound

ad.smb_home()

Returns the home URL of the user, or an empty string.

Exceptions

  • pymacad.ad.NotReachable
  • pymacad.ad.NotBound
  • subprocess.CalledProcessError

pymacad's People

Contributors

ftiff avatar kylecrawshaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

kylecrawshaw

pymacad's Issues

ad.principal('missinguser') results in a traceback

>>> ad.principal('missinguser')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/pymacad/ad/__init__.py", line 56, in principal
    output = _cmd_dscl_search(user_path)
  File "/Library/Python/2.7/site-packages/pymacad/ad/__init__.py", line 25, in _cmd_dscl_search
    stderr=subprocess.STDOUT)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['dscl', '/Search', 'read', '/Users/missinguser', 'AuthenticationAuthority']' returned non-zero exit status 56

Should probably catch the error in case of typo or user not in AD.

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.