py3mschap
First of all I hereby acknowledge this is not my original work. This repo
is based on work of jamiesun.net@gmail.com, original repo is
https://github.com/talkincode/pymschap.
Why I decided to fork it and rename it
- I needed python3 pip package
- repo is left without much of care, where I need my own code base with possibility to extend it
- I have quite bad experience with pr->fix->pip cycle flow
What you can expect here
If everything is running ok, probably some more from radius related mechanisms implemented in my simple radius testing mini-server raok. This module will be used there and via pip3 maintained for further improvements.
Original example provided by Jamie
def verify_radius_request(ms_chap_response,authenticator_challenge,username,userpwd,secret,authenticator):
import six
from pymschap import mschap, mppe
result = {}
if len(ms_chap_response)!=50:
raise Exception("Invalid MSCHAPV2-Response attribute length")
# if isinstance(userpwd, six.text_type):
# userpwd = userpwd.strip().encode('utf-8')
nt_response = ms_chap_response[26:50]
peer_challenge = ms_chap_response[2:18]
nt_resp = mschap.generate_nt_response_mschap2(
authenticator_challenge,
peer_challenge,
username,
userpwd,
)
if nt_resp == nt_response:
auth_resp = mschap.generate_authenticator_response(
userpwd,
nt_response,
peer_challenge,
authenticator_challenge,
username
)
result['MS-CHAP2-Success'] = auth_resp
result['MS-MPPE-Encryption-Policy'] = '\x00\x00\x00\x01'
result['MS-MPPE-Encryption-Type'] = '\x00\x00\x00\x06'
mppeSendKey, mppeRecvKey = mppe.mppe_chap2_gen_keys(userpwd, nt_response)
send_key, recv_key = mppe.gen_radius_encrypt_keys(
mppeSendKey,
mppeRecvKey,
secret,
authenticator)
result['MS-MPPE-Send-Key'] = send_key
result['MS-MPPE-Recv-Key'] = recv_key
else:
result['Reply-Message'] = "E=691 R=1 C=%s V=3 M=<password error>" % ('\0' * 32)
return result
Metadata
Release files for py3mschap 0.2.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py3mschap-0.2.post1.tar.gz | 17.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py3mschap-0.2.post1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.2 kB
Release files / py3mschap-0.2.post1.tar.gz
| Download URL | py3mschap-0.2.post1.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f91d1124fa4f70d92d271411572443773323151bfc339f7358533541c3f38d3
|
|
BLAKE2b-256 checksum How to use checksums |
f7822079c63512a8a02f16037394ee5c3981445b2d5231717fcc7bc4b3d69c34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.5
|
Release files / py3mschap-0.2.post1-py3-none-any.whl
| Download URL | py3mschap-0.2.post1-py3-none-any.whl |
|---|---|
| Size | 20.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33551fd54202d5d47671da7c6120776e88d556e98c1e3cd17e087376ce37d2ba
|
|
BLAKE2b-256 checksum How to use checksums |
178165b3b31194bdaa5b527d7537472b54cfef66c38dd120f6862e587c4e7524
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.5
|