用Scapy修改Radius数据包

时间:2019-09-08 15:29:02

标签: python scapy radius

我想更改Radius数据包中的一些avp值。 据我所知,如果您更改某些参数,例如src_ip(在标头中具有特定的大小和面积),则应该更改值。 但是我的问题是关于更改某些具有可变长度的有效载荷。 因此,如果我这样更改avp的值:

cap = rdpcap('radius_test3.pcapng')
cap[0][Radius][4].value=b'John.McGuirk.new'

并将其保存在新的pcap文件中

new_cap = PcapWriter("radius_test2.pcap", append=True)
new_cap.write(cap[0])
new_cap.close()

因此文件将损坏,因为我将值更改为更长的大小:


radius


所以我想也许我也应该更改'len'参数,但是又有错误:

cap[0][Radius][4].len+=4 # 4bytes added to length of new value

enter image description here


我还添加了Radius图层'lenl,但又出错了!

cap[0][Radius].len+=4

enter image description here


可以提供帮助的更多信息:


enter image description here


0 个答案:

没有答案