<s> """<STR_LIT>""" <EOL> import binascii <EOL> import ctypes <EOL> import struct <EOL> class UDP ( ctypes . Structure ) : <EOL> """<STR_LIT>""" <EOL> _fields_ = [ ( '<STR_LIT>' , ctypes . c_ushort ) , <EOL> ( '<STR_LIT>' , ctypes . c_ushort ) , <EOL> ( '<STR_LIT>' , ctypes . c_ushort ) , <EOL> ( '<STR_LIT>' , ctypes . c_ushort ) , <EOL> ( '<STR_LIT>' , ctypes . c_char_p ) ] <EOL> udp_header_size = <NUM_LIT:8> <EOL> def __init__ ( self , packet , layers = <NUM_LIT:0> ) : <EOL> fields = struct . unpack ( "<STR_LIT>" , packet [ : self . udp_header_size ] ) <EOL> self . src_port = fields [ <NUM_LIT:0> ] <EOL> self . dst_port = fields [ <NUM_LIT:1> ] <EOL> self . len = fields [ <NUM_LIT:2> ] <EOL> self . sum = fields [ <NUM_LIT:3> ] <EOL> self . payload = ctypes . c_char_p ( binascii . hexlify ( packet [ self . udp_header_size : ] ) ) <EOL> def __str__ ( self ) : <EOL> packet = '<STR_LIT>' <EOL> packet = packet % ( self . src_port , self . dst_port , ( len ( self . payload ) / <NUM_LIT:2> ) ) <EOL> return packet <EOL> def __len__ ( self ) : <EOL> return self . udp_header_size + len ( self . payload ) </s>
