我有一个字符串字符存储在一个名为“值”的变量中。该字符串基本上是从0到255的数字的列表。我将其用作Scapy数据包的有效负载(如下)。请注意,在变量“值”中,字节\ x7f后跟\ x80,\ 0x81,依此类推。但是,在Scapy Raw负载中,\ xc2字符在\ x7f之后的字符之间复制(请参见下文)。为什么要添加\ xc2?
值 '\ x00 \ x01 \ x02 \ x03 \ x04 \ x05 \ x06 \ x07 \ x08 \ t \ n \ x0b \ x0c \ r \ x0e \ x0f \ x10 \ x11 \ x12 \ x13 \ x14 \ x15 \ x16 \ x17 \ x18 \ x19 \ x1a \ x1b \ x1c \ x1d \ x1e \ x1f!“#$%&\'()* +,-。/ 0123456789:; <=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ [\] ^ _
abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0¡¢£¤¥¦§¨©ª«¬\xad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ' rawpacket = Raw(load=value) rawpacket <Raw load='\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_
abcdefghijklmnopqrstuvwxyz {|}〜\ x7f \ xc2 \ x80 \ xc2 \ x81 \ xc2 \ x82 \ xc2 \ x83 \ xc2 \ x84 \ xc2 \ x85 \ xc2 \ x86 \ xc2 \ x87 \ xc2 \ x88 \ xc2 \ x89 x8a \ xc2 \ x8b \ xc2 \ x8c \ x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 \ xa8 \ xc3 \ xa9 \ xc3 \ xaa \ xc3 \ xab \ xc3 \ xac xc3 \ xad \ xc3 \ xae \ xc3 \ xaf \ xc3 \ xb0 \ xc3 \ xb1 \ xc3 \ xb2 \ xc3 \ xb3 \ xc3 \ xb4 \ xc3 \ xb5 \ xc3 \ xb6 \ xc3 \ xb7 \ xc3 \ xb8 \ xc3 \ xa3 xb9 \ xc3 \ xba \ xc3 \ xbb \ xc3 \ xbc \ xc3 \ xbd \ xc3 \ xbe \ xc3 \ xbf'|>
答案 0 :(得分:0)
遇到了类似的问题。标签 b
解决了这个问题。
data = b'\x00\x01\xff ...'