pyradius / pyrad

Python RADIUS Implementation
BSD 3-Clause "New" or "Revised" License
294 stars 186 forks source link

TypeError: unsupported operand type(s) for ^: 'int' and 'str' in packet.py #192

Open liujing2048 opened 9 months ago

liujing2048 commented 9 months ago

hello, i am use python 3.6 and pyrad 2.4 In a docker environment I use RADPERF (similar to RADClient in Freradius) tools for Pyrad to test the pressure test, and then there will be the following problems

radius-1 | Traceback (most recent call last): radius-1 | File "main.py", line 4, in radius-1 | start_socket() radius-1 | File "/var/radius/mypyrad.py", line 238, in start_socket radius-1 | srv.Run() radius-1 | File "/usr/local/lib/python3.6/site-packages/pyrad/server.py", line 339, in Run radius-1 | self._ProcessInput(fdo) radius-1 | File "/usr/local/lib/python3.6/site-packages/pyrad/server.py", line 314, in _ProcessInput radius-1 | self._HandleAuthPacket(pkt) radius-1 | File "/usr/local/lib/python3.6/site-packages/pyrad/server.py", line 222, in _HandleAuthPacket radius-1 | self.HandleAuthPacket(pkt) radius-1 | File "/var/radius/mypyrad.py", line 85, in HandleAuthPacket radius-1 | password = get_password(pkt) radius-1 | File "/var/radius/mypyrad.py", line 53, in get_password radius-1 | return pkt.PwDecrypt(pkt['Password'][0]) # pap radius-1 | File "/usr/local/lib/python3.6/site-packages/pyrad/packet.py", line 712, in PwDecrypt radius-1 | pw += bytes((hash[i] ^ buf[i],)) radius-1 | TypeError: unsupported operand type(s) for ^: 'int' and 'str'

What I want to add is: 1)During the test, the command used is: echo "User-Name = user_test,User-Password = 123" | radperf -c 3000 -x -s 192.168.88.101:1812 auth vpdn 2)Not every test will occur, but the chance of appearing is very high

How can I fix this error myself? Thanks