pbook 1.0

Last updated:

0 purchases

pbook 1.0 Image
pbook 1.0 Images
Add to Cart

Description:

pbook 1.0

PBook ===== LDAP phone book written in Python. Output examples --------------- Default search result: pbookjohnFirstname:JohnLastname:DoeE−mail:[email protected]:+44123456789123Title:PlaceholdernameCity:LondonUsername:jdoeDefaultsearchresultsusingpatternsearchfilterrecognition: pbook 789 First name: John Last name: Doe E-mail: [email protected] Telephone: +44123456789 123 Title: Placeholder name City: London User name: jdoe Default search result using LDAP field name decoration: pbook−djohngivenName:Johnsn:Doemail:[email protected]:+44123456789123title:Placeholdernamel:Londonuid:jdoeSearchresultusingcustomsearchfilter: pbook -S 'title=place*' First name: John Last name: Doe E-mail: [email protected] Telephone: +44123456789 123 Title: Placeholder name City: London User name: jdoe Search result using the `name` search template: pbook−snamedoeFirstname:JohnLastname:DoeE−mail:[email protected]:+44123456789123Title:PlaceholdernameCity:LondonUsername:jdoeSearchresultusingthe‘multicolumn‘template: pbook -t multicolumn john Last name | First name | E-mail | Telephone -----------+------------+--------------------------------+---------------------- Doe | John | [email protected] | +44123456789, 123 Requirements ------------ * Python 2.7 * Python LDAP module (http://www.python-ldap.org) Installation ------------ In order to install pbook, just download the code, make sure all dependencies are installed (see [Requirements](https://github.com/jtyr/pbook#requirements) above) and configure it: gitclonehttps://github.com/jtyr/pbook.git cd pbook chmod+x./pbook # edit the pbook.conf file ./pbook−c./pbook.confjohnOrit′spossibletousethePythonsetupscript: git clone https://github.com/jtyr/pbook.git cdpbook python ./setup.py install You can't use 'macro parameter character #' in math modeYou can't use 'macro parameter character #' in math mode pbook john Configuration ------------- Look at the `pbook.conf` for a full configuration example. The configuration can be defined globally (`/etc/pbook.conf`), per user (`~/.pbook`) or specified by an option on the command line (`pbook -c /path/to/pbook.conf john`). The configuration file is composed of the following 6 sections: **connection** In this section we configure the LDAP server connection. Server name, port and connection protocol is determined from the `uri` parameter. Password can be either defined in clear text or, if the value is set to `-1`, the user will be prompted. The recommended approach is to configure `ldapsearch` correctly first, and then re-use the parameters in this section. Example of the `ldapsearch` command: ldapsearch−Hldaps://ldap.example.com−Duid=jdoe,ou=Users,dc=example,dc=com−bou=Users,dc=example,dc=com−Wuid=jdoeFromthiscommandtheconfigurationwouldbe:[connection]uri=ldaps://ldap.example.com:636basedn=ou=Users,dc=example,dc=combinddn=uid=jdoe,ou=Users,dc=example,dc=compassword=−1∗∗searchtemplate∗∗InthissectionweconfiguretheLDAPsearchfilter.Thedefaultsearchfilterisdefinedby‘default‘(e.g.‘default=nane‘)orbythecommandlineoption‘−s‘(e.g.‘pbook−snamejohn‘).Exampleofsearchtemplatedefinition:[searchtemplate]default=namename=(|(givenName=∗It′salsopossibletospecifyacustomsearchfilteronthecommandlinewiththeoption‘−S‘(e.g.‘pbook−S′uid=∗∗searchpattern∗∗Ontopofthedefaultsearchfilter,thereisalsopatternsearchfilterrecognition.Thisallowstheconfigurationofaspecificsearchfilterbasedonaspecifiedsearchstring.Forexample,ifalltelephonenumbersinthecompanyhavethesameformatexceptforthelast3digits,wecandefineapatternwhichwillsearchthetelephonenumberifthesearchstringisa3−digitnumber:[searchpattern](\d3)=(telephoneNumber=+44123456\1)Thenwecansearchforaphonenumber‘+44123456789‘byexecuting‘pbook789‘.∗∗label∗∗ThissectionprovidestranslationoftheLDAPfieldsintoahumanreadableformat,whichisthenusedinthe‘pbook‘output.Forexample‘givenName=Firstname‘translatesthe‘givenName‘fieldto‘Firstname‘label.It′smandatorytohavealabelforeveryfieldusedinthetemplate(readmorebellow).Exampleoflabeldefinition:[label]givenName=Firstnamesn=LastnametelephoneNumber=Telephone∗∗template∗∗Thedefaulttemplateisspecifiedbythe‘default‘parameter(e.g.‘default=basic‘)orbythecommandlineoption‘−t‘(e.g.‘pbook−tbasicjohn‘).Templatescanbedefinedintwoforms.ThefirstofwhichisasimplelistofLDAPfieldswhichwillbetranslatedintoaline−separatedlistoflabelsandvalues.Forexamplethefollowingtemplate:[template]default=basicbasic=(givenName,sn)generatesthefollowingoutput:Firstname:JohnLastname:DoeThesecondformisusingthe‘printf‘stringformat.Forexamplethefollowingtemplate:multicolumn=generatesthefollowingoutput:John|DoeItispossibletospecifyaheaderfortheoutputbyaparameternamedthesamethetemplateitselfappendedwith‘header‘.Theheadercanrefertolabelsbythelabelnameprefixedwithtwounderscores.Theheaderfortheaboveexamplecouldlooklikethis:multicolumnheader=andtheoutputwouldthenlooklikethis:Firstname|Lastname−−−−−−−−−−−+−−−−−−−−−−−John|Doe∗∗output∗∗ThissectionisoptionalandmaycontaindefinitionofreplacementsforLDAPvalues.Inotherwords,itallowsthemanipulationofvaluescomingfromtheLDAPsearchbyusingaregularexpression.Forexample,ifwewanttodisplayonlylastthreedigitsofthe‘telephoneNumber‘,wewoulddefinethefollowingoutputreplacement:[output]telephoneNumber=.∗(\d3);\1 License ------- This software is licensed by the MIT License which can be found in the file [LICENSE](http://github.com/jtyr/pbook/blob/master/LICENSE).

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.