Example #1
0
 def get_domain(self):
     try:
         user_name = tools.DecodeString(self.get(1)[0])
         if "@" in user_name:
             return user_name[user_name.index("@") + 1:]
     except:
         return None
Example #2
0
 def get_username(self):
     try:
         return tools.DecodeString(self.get(1)[0])
     except:
         if is_debug():
             exception('Exception while trying to get username')
         return None
Example #3
0
 def get_user_name(self):
     try:
         user_name = tools.DecodeString(self.get(1)[0])
         if "@" in user_name:
             user_name = user_name[:user_name.index("@")]
         return user_name
     except:
         return None
Example #4
0
 def get_macaddr(self):
     try:
         return tools.DecodeString(self.get(31)[0]).replace("-", ":")
     except:
         return None
     else:
         #check if the mac format is deadbeefcafe
         if len(macstr) == 12 and isinstance(macstr, str):
             mac = ':'.join([
                 "%s%s" % (macstr[2 * i], macstr[2 * i + 1])
                 for i in range(0, 6)
             ])
         else:
             mac = macstr
         return mac
Example #5
0
 def testStringDecoding(self):
     self.assertEqual(tools.DecodeString(six.b('1234567890')), '1234567890')
Example #6
0
 def get_nas_portid(self):
     try:
         return tools.DecodeString(self.get(87)[0])
     except:
         return None
Example #7
0
 def get_acct_sessionid(self):
     try:
         return tools.DecodeString(self.get(44)[0])
     except:
         return None
Example #8
0
 def get_calling_stationid(self):
     try:
         return tools.DecodeString(self.get(31)[0])
     except:
         return None
Example #9
0
 def get_nas_class(self):
     try:
         return tools.DecodeString(self.get(25)[0])
     except:
         return None
Example #10
0
 def get_mac_addr(self):
     if self.client_macaddr: return self.client_macaddr
     try:
         return tools.DecodeString(self.get(31)[0]).replace("-", ":")
     except:
         return None
Example #11
0
 def get_macaddr(self):
     try:
         return tools.DecodeString(self.get(31)[0]).replace("-", ":")
     except:
         return None
Example #12
0
 def get_username(self):
     try:
         return tools.DecodeString(self.get(1)[0])
     except:
         return None