我试图使用Scapy发送一个简单的RADIUS访问请求到我的RADIUS服务器,但Scapy无法捕获响应。 我用tcpdump和Scapy sniff来validation访问接受实际上是由客户端接收的。
这是我的设置:
数据包:( AVP是一个定制的图层)
<IP frag=0 proto=udp dst=10.200.202.19 |<UDP sport=10999 dport=radius |<Radius code=Access-Request authenticator='W\xe8\xe1\x81FD\xdalR,\x9e8?\x8e\xda&' |<AVP type=User-Name data='testing' |<AVP type=User-Password data=',\xea\x84p\x8b\x8e\x8bo\x1c\xa5P\x9cR\xea\xb5M' |<AVP type=NAS-IP-Address data='127.0.1.1' |<AVP type=NAS-Port data='0' |>>>>>>>
客户端的2个terminal:
1号航站楼
usesr:~$ sudo tcpdump -i eth0 'udp and port 1812' tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes ****SEND PACKET FROM OTHER TERMINAL**** 18:05:47.567307 IP radclient.10999 > radserver.radius: RADIUS, Access Request (1), id: 0x00 length: 61 18:05:47.568041 IP radserver.radius > radclient.10999: RADIUS, Access Accept (2), id: 0x00 length: 20
terminal2
>>> sr(pkt, iface='eth0', filter='udp and port 1812', timeout=5) Begin emission: .Finished to send 1 packets. . Received 2 packets, got 0 answers, remaining 1 packets (<Results: TCP:0 UDP:0 ICMP:0 Other:0>, <Unanswered: TCP:0 UDP:1 ICMP:0 Other:0>)
我在Scapy源代码中挖了一下,注意到在寻找响应时,我们做了两件事情,比较接收到的数据包的hashret()
值和发送的数据包的hashret()
值,然后validationrecPkt.answeres(sentPkt)
是真的。 为了满足这些检查,我做了以下工作:
>>> a = sniff(iface='eth0', filter='udp and port 1812') ♥>>> a <Sniffed: TCP:1 UDP:2 ICMP:0 Other:0> >>> a.summary() Ether / IP / TCP 10.200.202.191:ssh > 10.200.201.242:51044 PA / Raw Ether / IP / UDP 10.200.202.191:10999 > 10.200.202.19:radius / Raw Ether / IP / UDP 10.200.202.19:radius > 10.200.202.191:10999 / Raw / Padding >>> a[1].hashret() '\x00\x08\x00\x00\x00\xac\x11' >>> a[2].hashret() '\x00\x08\x00\x00\x00\xac\x11' >>> a[2].answers(a[1]) 1
在这之后,我开始在eclipse中运行一个简单的testing,并试图通过程序,从我可以告诉, sr()
似乎完全错过了响应,随后从不做任何处理。