Skip to main content
# pymschap

python mschap


# Example


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 pymschap 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pymschap 0.1
File Interpreter ABI Platform Actions
pymschap-0.1-py2-none-any.whl Python 2 none any Details for pymschap-0.1-py2-none-any.whl

Release files / pymschap-0.1-py2-none-any.whl

Download URL pymschap-0.1-py2-none-any.whl
Size 17.7 kB
Tags Python 2
SHA-256 checksum
How to use checksums
63b303593814d7756f67708b222342c9fb3d6562c6507c50937032d46678276c
BLAKE2b-256 checksum
How to use checksums
bea354f53d14d1381dabdbf9ce93ede9e223edac067e59d0db6666af88dba7dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pymschap 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page