def iplayer_from_raw(raw, linktype=1):
 if (linktype == 1):
  try:
   pkt = dpkt.ethernet.Ethernet(raw)
   return pkt.data
  except dpkt.NeedData:
   pass
 elif (linktype == 101):
  return dpkt.ip.IP(raw)
 else:
  raise CuckooProcessingError('unknown PCAP linktype')

def iplayer_from_raw ( raw , linktype = 1 ) : if ( linktype == 1 ) : try : pkt = dpkt . ethernet . Ethernet ( raw ) return pkt . data except dpkt . NeedData : pass elif ( linktype == 101 ) : return dpkt . ip . IP ( raw ) else : raise CuckooProcessingError ( 'unknown PCAP linktype' )
converts a raw packet to a dpkt packet regarding of link type .