3

我正在尝试使用 Scapy 向我的 RADIUS 服务器发送一个简单的 RADIUS 访问请求,但 Scapy 无法捕获响应。我已经使用 tcpdump 和 Scapy 嗅探来验证客户端是否确实收到了 access-accept。

这是我的设置:

数据包:(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个终端:

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

2号航站楼

>>> 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()值与发送的数据包的值进行比较,并验证这recPkt.answeres(sentPkt)是真的。为了满足这些检查,我做了以下事情:

>>> a = sniff(iface='eth0', filter='udp and port 1812')
♥&gt;>> 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 中运行一个简单的测试并尝试单步执行该程序,据我所知,sr()似乎完全错过了响应,随后从未对其进行任何处理。

4

0 回答 0