Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from socket import *
- import struct
- s = socket(AF_INET, SOCK_RAW, IPPROTO_UDP)
- data = 'string'
- sport = 4711 # arbitrary source port
- dport = 45134 # arbitrary destination port
- length = 8+len(data);
- checksum = 0
- udp_header = struct.pack('!HHHH', sport, dport, length, checksum)
- s.sendto(udp_header+data, ('', 0));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement