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.4.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file python-pam-1.8.4.tar.gz
.
File metadata
- Download URL: python-pam-1.8.4.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
c856d9c89fedb33951dd8a95727ae57c6887b02d065bbdffd2fd9dbc0183909b
|
|
MD5 |
4bfa4c8a94ee9dc9718a83ba56e4907c
|
|
BLAKE2b-256 |
0116544d01cae9f28e0292dbd092b6b8b0bf222b528f362ee768a5bed2140111
|
File details
Details for the file python_pam-1.8.4-py2.py3-none-any.whl
.
File metadata
- Download URL: python_pam-1.8.4-py2.py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
8439b470b564ac558585b5a3ffce0fce48d1eeebdff19add48279c33de7da0e0
|
|
MD5 |
0aab0a11ea224e77b2232d9f06ebd45d
|
|
BLAKE2b-256 |
2ba02e2dfdbf74170bc3576a11d47bbeee7cfbb083c0a1cbfcf70a533adce62f
|