python - Spoofing bytes of a UDP checksum over network -


i'm trying play security tool using scapy spoof ascii characters in udp checksum. can it, when hardcode bytes in hex notation. can't convert ascii string word binary notation. works send bytes of "he" (first 2 chars of "hello world"): sr1(ip(dst=server)/udp(dport=53, chksum=0x4865)/dns(rd=1,qd=dnsqr(qname=query)),verbose=0)

but whenever try use variable of test2 instead of 0x4865, dns packet not transmitted on network. should create binary ascii:

test2 = bin(int(binascii.hexlify('he'),16))

sr1(ip(dst=server)/udp(dport=53, chksum=test2)/dns(rd=1,qd=dnsqr(qname=query)),verbose=0)

when print test2 variable shows correct binary notation representation.

how convert string such he shows in checksum notation accepted scapy, of 0x4865 ??

i able working removing bin(). works:

test2 = int(binascii.hexlify('he'),16)


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -