2019-07-10 12:37:58 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import sys
|
|
|
|
from scapy.all import *
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
iface = sys.argv[1]
|
|
|
|
|
|
|
|
e = Ether(src="00:00:0a:00:00:03", dst='00:00:0a:00:00:01')
|
|
|
|
|
|
|
|
i = IP(src = "10.0.0.1", dst = "10.1.1.1")
|
|
|
|
u = UDP(dport=80, sport=80)
|
|
|
|
d = "V4-OK"
|
|
|
|
|
|
|
|
pkg = e / i / u / d
|
|
|
|
|
|
|
|
packet_rebuild = packet.__class__(str(pkg))
|
|
|
|
print("pkg = {}".format(pkg.__repr__()))
|
2019-07-10 12:40:03 +00:00
|
|
|
print("checksum = {}".format(packet_rebuild[UDP].chksum))
|
2019-07-10 12:37:58 +00:00
|
|
|
|
|
|
|
sendp(pkg, iface=iface, verbose=True)
|