@@ -1528,6 +1528,7 @@ def parse_options(self,
15281528 IDENTITIES = None ,
15291529 IDENTITIES_MSCHAPv2 = None ,
15301530 servicetype = None ,
1531+ mschapdomain = None ,
15311532 extra_attributes = []):
15321533 """
15331534 This provides a tiny RADIUS daemon that answers Access-Request messages.
@@ -1545,10 +1546,12 @@ def parse_options(self,
15451546 {"username": b"HashNT"}. The HashNT can be obtained
15461547 using MD4le(). If IDENTITIES is provided, this will be calculated.
15471548 :param servicetype: the Service-Type to answer.
1549+ :param mschapdomain: the MS-CHAP-DOMAIN to answer if MS-CHAP* is used.
15481550 :param extra_attributes: a list of extra Radius attributes
15491551 """
15501552 self .secret = bytes_encode (secret )
15511553 self .servicetype = servicetype
1554+ self .mschapdomain = mschapdomain
15521555 self .extra_attributes = extra_attributes
15531556 if not IDENTITIES :
15541557 IDENTITIES = {}
@@ -1678,17 +1681,27 @@ def make_reply(self, req):
16781681 AuthenticatorChallenge ,
16791682 UserName ,
16801683 )
1681- succ = MS_CHAP2_Success (
1682- Ident = response .Ident ,
1683- String = "S=%s" % auth_string .hex ().upper ()
1684- )
16851684 rad .attributes .append (
16861685 RadiusAttr_Vendor_Specific (
16871686 vendor_id = 311 ,
1688- vendor_type = 26 ,
1689- value = succ ,
1687+ vendor_type = "MS-CHAP2-Success" ,
1688+ value = MS_CHAP2_Success (
1689+ Ident = response .Ident ,
1690+ String = "S=%s" % auth_string .hex ().upper ()
1691+ )
16901692 )
16911693 )
1694+ if self .mschapdomain is not None :
1695+ rad .attributes .append (
1696+ RadiusAttr_Vendor_Specific (
1697+ vendor_id = 311 ,
1698+ vendor_type = "MS-CHAP-Domain" ,
1699+ value = MS_CHAP_Domain (
1700+ Ident = response .Ident ,
1701+ String = self .mschapdomain ,
1702+ )
1703+ )
1704+ )
16921705 else :
16931706 raise Scapy_Exception (
16941707 "Authentication method not provided or unsupported !"
0 commit comments