0
scapy로 TCP 패킷을 분석하고 싶습니다. 그리고 pkt.sprintf ('% Raw.load %')를 사용하여 tcp 데이터를 추출합니다. 하지만 출력 문자열의 길이가 잘못되었습니다. 그러나 '\'는 이스케이프 된 문자 대신 str으로 간주됩니다. 따라서 '\ x11'은 ASCII 문자 대신 4 개의 다른 문자열로 간주됩니다.scapy.sprintf의 출력이 원시 문자열입니까? 길이가 잘못된 이유는 무엇입니까?
from scapy.all import *
def findTCPdata(pkt):
raw = pkt.sprintf("%Raw.load%")
print raw
print 'length of TCP data: '+ str(len(raw))
def main():
pkts = rdpcap('XXX.pcap')
for pkt in pkts:
findTCPdata(pkt)
if __name__ == '__main__':
main()
각 TCP 데이터의 길이 대신에 화면에 값 (53,52,46,52) 17이어야한다 : 여기
내 코드이다. 4 TCP 데이터는 다음과 같습니다'U\x11\x04\x92\x02\x03\x1e\[email protected]\x03\xf8q=e\xcb\x15\r'
'U\x11\x04\x92\x02\x03.\[email protected]\x03\xf8q=e\xcb\xb8\x05'
'U\x11\x04\x92\x02\x03X\[email protected]\x03\xf8q=e\xcbiO'
'U\x11\x04\x92\x02\x03n\[email protected]\x03\xf8q=e\xcb\xdb\xe3'
이 나를 problem.Thank 당신을 해결 도와주세요!