Research Article

Identifying IoT Devices Based on Spatial and Temporal Features from Network Traffic

Algorithm 1

The algorithm for data preprocessing.
Input: raw network traffic pcap files
Output: Samples_Data
Use SplitCap tool to convert raw pcap files into Flows with the same 5-tuple
information, , , …, , represents the last Flow in raw pcap
(1)for eachdo
(2),
(3)ifthen
(4)   Get the top 10 packets in
(5)  for each in do
(6)   if bytes then
(7)     Get the first 250 bytes in
(8)   else
(9)     Get all bytes in +
(10)    Set the MAC address field and IP address field in to 0
(11)    
(12)  end for
(13)else
(14)   Get all packets in
(15)  for each in do
(16)   if bytes then
(17)     Get the first 250 bytes in
(18)   else
(19)     Get all bytes in +
(20)   Set the MAC address field and IP address field in to 0
(21)   
(22)  end for
(23)  for; ; do
(24)   
(25)  .append()
(26)end for
(27)Return