Python PAM module using ctypes, py3/py2
Project description
python-pam
==========
Python pam module supporting py3 (and py2)
Commandline example:
```
[david@Scott python-pam]$ python pam.py
Username: david
Password:
0 Success
[david@Scott python-pam]$ python2 pam.py
Username: david
Password:
0 Success
```
Inline examples:
```
[david@Scott python-pam]$ python
Python 3.4.1 (default, May 19 2014, 17:23:49)
[GCC 4.9.0 20140507 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pam
>>> p = pam.pam()
>>> p.authenticate('david', 'correctpassword')
True
>>> p.authenticate('david', 'badpassword')
False
>>> p.authenticate('david', 'correctpassword', service='login')
True
>>> p.authenticate('david', 'correctpassword', service='unknownservice')
False
>>> p.authenticate('david', 'correctpassword', service='login', resetcreds=True)
True
>>> p.authenticate('david', 'correctpassword', encoding='latin-1')
True
>>> print('{} {}'.format(p.code, p.reason))
0 Success
>>> p.authenticate('david', 'badpassword')
False
>>> print('{} {}'.format(p.code, p.reason))
7 Authentication failure
>>>
```
==========
Python pam module supporting py3 (and py2)
Commandline example:
```
[david@Scott python-pam]$ python pam.py
Username: david
Password:
0 Success
[david@Scott python-pam]$ python2 pam.py
Username: david
Password:
0 Success
```
Inline examples:
```
[david@Scott python-pam]$ python
Python 3.4.1 (default, May 19 2014, 17:23:49)
[GCC 4.9.0 20140507 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pam
>>> p = pam.pam()
>>> p.authenticate('david', 'correctpassword')
True
>>> p.authenticate('david', 'badpassword')
False
>>> p.authenticate('david', 'correctpassword', service='login')
True
>>> p.authenticate('david', 'correctpassword', service='unknownservice')
False
>>> p.authenticate('david', 'correctpassword', service='login', resetcreds=True)
True
>>> p.authenticate('david', 'correctpassword', encoding='latin-1')
True
>>> print('{} {}'.format(p.code, p.reason))
0 Success
>>> p.authenticate('david', 'badpassword')
False
>>> print('{} {}'.format(p.code, p.reason))
7 Authentication failure
>>>
```
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
python-pam-1.8.3.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for python_pam-1.8.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6306cd996ee35870a4a94bf042c5e428ff34ad454168807ecc89437ef78719ab |
|
MD5 | 39d9068d608826a732da7cb1a29353be |
|
BLAKE2b-256 | 52554468d72883ccf46ad800f6b06543ac994de49ae0aa63b037fb939c4f9228 |