Entropy et al

entropy math

Introduction

In traffic mining the entropy is some giveaway about the nature of the L7 part of the packet. The plugin entropy supplies certain information which can be useful as a preprocessing for classifiers.

Preparation

First, restore T2 into a pristine state by removing all unnecessary or older plugins from the plugin folder ~/.tranalyzer/plugins:

t2build -e -y

Are you sure you want to empty the plugin folder '/home/wurst/.tranalyzer/plugins' (y/N)? yes
Plugin folder emptied

Then compile the core (tranalyzer2) and the following plugins:

t2build tranalyzer2 basicFlow basicStats tcpStates entropy txtSink

...
BUILD SUCCESSFUL

If you did not create a separate data and results directory yet, please do it now in another bash window, that facilitates your workflow:

mkdir ~/data ~/results

The sample PCAPs used in this tutorial can be downloaded here:

Please save them in your ~/data folder.

Now you are all set!

Entropy, but WTF is our question?

The Shannon information entropy is define by the expectation value of the logarithm of the random data distribution Pi given an alphabet of size M: S >  =  < lnP >  =  − 1/ln(M) ⋅ ∑iPi ⋅ ln(Pi) In our case M of 256 would be convenient, as it is normally the minimum size of information in layer 7 payloads. Sure, it can go down to the bit, and it would require much less samples if we choose M = 2, but let’s start practical and easy to implement, right? So 8 bit, M = 256.

Now we like to know what is the minimum number of samples n, we need to include in our estimation, given a certain confidence interval c. Andrew D. Back, Daniel Angus & Janet Wiles states for distributions according to Zipf-Mandelbrot distributions, which you can find in physical and social data sets: n = 8/n02 ⋅ ln(2/(1−d)) The first factor denotes … and the second factor the influence of the confidence interval. The latter calculates for d=0.75 to 2.1. If we want to improve the estimate up to 0.9 then a factor of 10 more data has to be sampled. This sounds acceptable, but if you use the script netstat located in the scripts directory then you realize that nearly 45% of all flows in the wild contain one packet, mostly with very little content. Oups!

The real bad news is the first factor where n0 is inverse proportional to the size of the selected alphabet, and then squared, which is worse.

n02 which evaluated for English text, alphabet 36, in the area of 10−8. So in our case way more. So most of the flows you will collect don’t even qualify to calculate a reasonable entropy. Damn!!

Now, what do we really need the entropy for? Do we want to distinguish subtle distributions of empirical data sets to a certain confidence level, or are we interested in a certain question? But what is the question? Yes you know the answer: 42.

In traffic mining or admin applications we were just interested in assessing the following three categories:

  1. text based output
  2. binary protocol content, e.g. bitfield, or number based, where all numbers can appear
  3. encrypted content

Let’s assume for 1 & 2 we have an easy measure which works in practice, such as the ratio of certain character distribution. Now let’s focus on 3. Now we scrap Zipf’s distribution law, Mr Zipf won’t like it, also some researchers might want to shoot me, but I need to produce a measure which helps me in everyday life. So shut up Zipf, these are not the data samples you are looking for.

Out data, e.g. when it comes to encrypted content out distribution should be uniformly distributed. And there is no ranking, all symbols have the same rights, we are living in a democracy. Then n comes down to the order of 1000.

In practice you may apply a threshold to the resulting entropy, which is close enough to 1. If the samples are really random and unique, then you might come down to 101. But if you are only interested in a rough estimate. Otherwise you need minimum M samples, so in our case 256 per flow, and a threshold of 0.96. But this is only empirical, and depends highly on the underlying statisical nature of the data. So for text data with a zipf distribution the estimation will require more samples per flow.

But what about compression? Can you distinguish compression from encryption using the Shannon entropy? I say no, what do you say? If you a practical try them both on the plugin discussed in the next chapter.

Entropy plugin

The current entropy plugin is built upon a 8 bit alphabet and a simple Anteater assumption about the data of interest.

Now move to the entropy code base directory and look into entropy.h:

entropy

vi src/entropy.h

...
/* ========================================================================== */
/* ------------------------ USER CONFIGURATION FLAGS ------------------------ */
/* ========================================================================== */

#define ENT_NORM    1      // 1: Normalized entropy, 0: # bits
#define ENT_NBITS   8      // N bit word, vocabulary: 2^N
#define ENT_ALPHAD  0      // 1: print alphabet distribution in flow file

/* +++++++++++++++++++++ ENV / RUNTIME - conf Variables +++++++++++++++++++++ */

#define ENT_HPKTIG  0      // Ignore first N packets
#define ENT_HEAD    0      // Start word of entropy calc in packet payload
#define ENT_TAIL    1500   // Position in packet until entropy is calculated
#define ENT_THRESL  8      // Threshold for minimal payload length in flow
#define ENT_THRESH  8192   // Threshold for maximal payload length in flow

/* ========================================================================== */
/* ------------------------- DO NOT EDIT BELOW HERE ------------------------- */
/* ========================================================================== */
...

ENT_NORM defines whether the entropy is normalized to 1 or denotes the number of bits necessary to descripe the payload patter. ENT_NBITS defines the number of bits in a word and ENT_ALPHAD enables the output of the total distribution in the flow file. All theses parameters require recompilation. The following ones don’t.

ENT_HEAD and ENT_TAIL denote the start and the end position in the payload/packet to be added into the statistical distribution. Comes in handy if certain uninteresting parts of each packet should be excluded.

ENT_THRESL and ENT_THRESH denote the minimal and maximal length relative to ENT_HEAD of the flow payload respectively. Hence, small flow which result in a bad estimation of the entropy can be excluded. And all flows can be normalized to a maximum amount of words in order to produce the same precision for the entropy estimation.

t2conf entropy -D ENT_THRESL=256 && t2build entropy

Note, that all variables below the ENV / RUNTIME marker can be changed without compiling or can be defined by environmental variables.

t2 -r ~/data/skypeu.pcap -w ~/results

================================================================================
Tranalyzer 0.9.4 (Anteater), Cobra. PID: 76092, Prio: 0, SID: 666
================================================================================
Date: 1751734698.000739553 sec (Sat 05 Jul 2025 18:58:18 CEST)
[INF] Creating flows for L2, IPv4, IPv6
Active plugins:
    01: basicFlow, 0.9.4
    02: basicStats, 0.9.4
    03: tcpStates, 0.9.4
    04: entropy, 0.9.4
    05: txtSink, 0.9.4
[INF] IPv4 Ver: 6, Rev: 02072025, Range Mode: 0, subnet ranges loaded: 7237865 (7.24 M)
[INF] IPv6 Ver: 6, Rev: 02072025, Range Mode: 0, subnet ranges loaded: 1419083 (1.42 M)
Processing file: /home/user/data/skypeu.pcap
Link layer type: Ethernet [EN10MB/1]
Snapshot length: 68
Dump start: 1146661308.742778000 sec (Wed 03 May 2006 13:01:48 GMT)
[WRN] snapL2Length: 68 - snapL3Length: 54 - IP length in header: 60
Dump stop : 1146690263.003348000 sec (Wed 03 May 2006 21:04:23 GMT)
Total dump duration: 28954.260570000 sec (8h 2m 34s)
Finished processing. Elapsed time: 0.002149221 sec
Finished unloading flow memory. Time: 0.002167506 sec
Percentage completed: 100.00%
Number of processed packets: 8656 (8.66 K)
Number of processed bytes: 580072 (580.07 K)
Number of raw bytes: 673514 (673.51 K)
Number of pcap bytes: 718592 (718.59 K)
Number of IPv4 packets: 8656 (8.66 K) [100.00%]
Number of A packets: 4344 (4.34 K) [50.18%]
Number of B packets: 4312 (4.31 K) [49.82%]
Number of A bytes: 291096 (291.10 K) [50.18%]
Number of B bytes: 288976 (288.98 K) [49.82%]
<A packet load>: 67.01
<B packet load>: 67.02
--------------------------------------------------------------------------------
basicStats: Flow max(pktload): 11
basicStats: Flow max(b/s), pkts: 1797 (1.80 Kb/s), 2166 (2.17 K)
basicStats: Biggest L3 flow talker: 192.168.201.243: 2178 (2.18 K) [25.16%] packets
basicStats: Biggest L3 flow talker: 192.168.201.243: 25679 (25.68 K) [4.43%] bytes
tcpStates: Aggregated tcpStatesAFlags=0x02
entropy: NValFlows, min, ave, max: 0, 0.989385, 0.989663, 0.989902
--------------------------------------------------------------------------------
Headers count: min: 3, max: 3, avg: 3.00
Number of TCP packets: 8656 (8.66 K) [100.00%]
Number of TCP bytes: 580072 (580.07 K) [100.00%]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Number of processed      flows: 4
Number of processed IPv4 flows: 4 [100.00%]
Number of processed A    flows: 2 [50.00%]
Number of processed B    flows: 2 [50.00%]
Number of request        flows: 2 [50.00%]
Number of reply          flows: 2 [50.00%]
Total   A/B    flow asymmetry: 0.00
Total req/rply flow asymmetry: 0.00
Number of processed A+B packets/A+B flows: 2164.00 (2.16 K)
Number of processed A   packets/A   flows: 2172.00 (2.17 K)
Number of processed   B packets/  B flows: 2156.00 (2.16 K)
Number of processed total packets/s: 0.30
Number of processed A+B   packets/s: 0.30
Number of processed A     packets/s: 0.15
Number of processed   B   packets/s: 0.15
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<Number of processed flows/s>: 0.00
<Bandwidth>: 186 b/s
<Snapped bandwidth>: 160 b/s
<Raw bandwidth>: 186 b/s
Max number of flows in memory: 2 [0.00%]
Memory usage: 0.01 GB [0.02%]
Aggregated flowStat=0x0400000a00004000
[WRN] L3 SnapLength < Length in IP header
[WRN] L4 header snapped
[INF] IPv4 flows

In the end report we can see an indication of possible encrypted payload as the overall minimal entropy is always higher than 0.989. In the flow The other measures of text or binary are pretty low. They would be higher if it were compressed. Now, look at the $avePktSize, $pktps, $bytps and $pktAsm columns… Guys, this definitely looks like voice. Look at the (Encrypted) Traffic Mining - A Statistical Approach tutorial to get more hints to help you decide whether these flows are encrypted voice or not.

tcol ~/results/skypeu_flows.txt

%dir  flowInd  flowStat            timeFirst             timeLast              duration       numHdrDesc  numHdrs  hdrDesc       srcMac             dstMac             ethType  vlanID  srcIP            srcIPCC  srcIPOrg            srcPort  dstIP            dstIPCC  dstIPOrg            dstPort  l4Proto  pktsSnt  pktsRcvd  padBytesSnt  l7BytesSnt  l7BytesRcvd  minL7PktSz  maxL7PktSz  avgL7PktSz  stdL7PktSz  minIAT  maxIAT    avgIAT      stdIAT     pktps     bytps     pktAsm        bytAsm        tcpStatesAFlags  PyldEntropy  PyldChRatio  PyldBinRatio
A     1        0x0400000a00004000  1146661308.742778000  1146661429.630237000  120.887459000  1           3        eth:ipv4:tcp  00:13:d4:f3:ab:dd  00:13:d4:f3:a9:53  0x0800           192.168.201.243  07       "!Private network"  59189    192.168.201.242  07       "!Private network"  51523    6        2178     2162      0            25679       25528        0           967         11.79017    25.51763    0       5.527808  0.0555039   0.1386972  18.01676  212.4207  0.003686636   0.002948816   0x02             0.9899017    0.3886364    0.04
B     1        0x0400000a00004001  1146661308.742876000  1146661429.630226000  120.887350000  1           3        eth:ipv4:tcp  00:13:d4:f3:a9:53  00:13:d4:f3:ab:dd  0x0800           192.168.201.242  07       "!Private network"  51523    192.168.201.243  07       "!Private network"  59189    6        2162     2178      0            25528       25679        0           562         11.80759    20.90248    0       5.48688   0.05591461  0.1394785  17.88442  211.1718  -0.003686636  -0.002948816  0x02             0.9893942    0.3752277    0.04553734
A     2        0x0400000a00004000  1146690149.215032000  1146690262.965388000  113.750356000  1           3        eth:ipv4:tcp  00:13:d4:f3:ab:dd  00:13:d4:f3:a9:53  0x0800           192.168.201.243  07       "!Private network"  59189    192.168.201.242  07       "!Private network"  51523    6        2166     2150      0            25565       25414        0           967         11.80286    25.57787    0       5.527773  0.05251632  0.1254197  19.0417   224.7466  0.003707136   0.002962004   0x02             0.9898577    0.3875686    0.04021938
B     2        0x0400000a00004001  1146690149.215081000  1146690263.003348000  113.788267000  1           3        eth:ipv4:tcp  00:13:d4:f3:a9:53  00:13:d4:f3:ab:dd  0x0800           192.168.201.242  07       "!Private network"  51523    192.168.201.243  07       "!Private network"  59189    6        2150     2166      0            25414       25565        0           562         11.82047    20.948      0       5.48683   0.0529248   0.1263116  18.89474  223.3446  -0.003707136  -0.002962004  0x02             0.9893849    0.375        0.04578755

Now let’s have a look at the distribution per flow. Switch on ENT_ALPHAD, recompile and rerun T2.

t2conf entropy -D ENT_ALPHAD=1 && t2build entropy

t2 -r ~/data/skypeu.pcap -w ~/results

Now you see the distribution of the byte alphabet. Pretty even, right? Should be the same for perfect compression.

tcol ~/results/skypeu_flows.txt

%dir  flowInd  flowStat            timeFirst             timeLast              duration       numHdrDesc  numHdrs  hdrDesc       srcMac             dstMac             ethType  vlanID  srcIP            srcIPCC  srcIPOrg            srcPort  dstIP            dstIPCC  dstIPOrg            dstPort  l4Proto  pktsSnt  pktsRcvd  padBytesSnt  l7BytesSnt  l7BytesRcvd  minL7PktSz  maxL7PktSz  avgL7PktSz  stdL7PktSz  minIAT  maxIAT    avgIAT      stdIAT     pktps     bytps     pktAsm        bytAsm        tcpStatesAFlags  PyldEntropy  PyldChRatio  PyldBinRatio  NumBin0  Corr  PyldLen  PyldHisto
A     1        0x0400000a00004000  1146661308.742778000  1146661429.630237000  120.887459000  1           3        eth:ipv4:tcp  00:13:d4:f3:ab:dd  00:13:d4:f3:a9:53  0x0800           192.168.201.243  07       "!Private network"  59189    192.168.201.242  07       "!Private network"  51523    6        2178     2162      0            25679       25528        0           967         11.79017    25.51763    0       5.527808  0.0555039   0.1386972  18.01676  212.4207  0.003686636   0.002948816   0x02             0.9899017    0.3886364    0.04          0        0     2200     7;8;12;8;8;14;6;7;9;9;7;13;6;10;15;7;5;9;4;7;10;7;8;8;13;14;6;6;8;8;6;8;13;10;13;4;9;9;13;10;9;4;7;7;9;8;9;10;10;9;11;5;6;9;13;11;7;2;7;13;10;8;11;8;9;11;7;4;7;7;7;9;6;4;3;10;6;12;9;10;8;14;8;15;14;9;9;6;10;12;6;14;16;8;8;8;9;6;9;9;9;8;8;5;9;7;5;9;7;10;6;10;8;9;8;10;12;4;7;7;13;9;9;9;6;6;12;13;7;4;9;4;7;10;7;4;12;8;13;13;7;10;10;10;8;12;8;5;10;12;9;9;10;12;3;6;11;7;10;3;8;4;10;8;2;11;8;9;8;9;7;6;10;13;10;9;8;6;11;9;6;10;8;9;11;7;5;3;10;6;7;15;7;2;14;7;10;6;9;6;10;6;17;7;8;9;12;11;5;16;3;9;9;9;9;9;8;7;7;6;9;9;8;12;6;9;10;9;11;7;10;6;6;7;7;15;9;12;4;3;11;9;9;6;13;15;12;11;7;9;4;9;8;7;8;11
B     1        0x0400000a00004001  1146661308.742876000  1146661429.630226000  120.887350000  1           3        eth:ipv4:tcp  00:13:d4:f3:a9:53  00:13:d4:f3:ab:dd  0x0800           192.168.201.242  07       "!Private network"  51523    192.168.201.243  07       "!Private network"  59189    6        2162     2178      0            25528       25679        0           562         11.80759    20.90248    0       5.48688   0.05591461  0.1394785  17.88442  211.1718  -0.003686636  -0.002948816  0x02             0.9893942    0.3752277    0.04553734    0        0     2196     13;9;9;7;9;13;10;12;7;11;5;2;7;5;10;15;11;11;12;6;12;8;10;12;5;9;9;13;6;7;5;15;5;13;10;12;10;10;9;11;12;7;6;9;7;14;6;8;16;8;7;3;5;5;12;8;6;9;9;8;13;10;11;10;13;5;2;8;9;7;10;7;9;7;7;3;8;7;10;7;6;4;7;9;9;10;10;8;16;10;7;4;8;11;10;14;15;9;7;8;7;13;11;8;8;9;3;11;5;3;11;7;12;10;5;10;7;9;4;10;10;11;7;7;7;7;5;7;8;8;8;9;12;6;8;12;7;12;12;9;10;9;10;5;9;11;9;9;9;7;5;7;8;9;4;6;9;10;4;7;2;10;9;10;7;10;8;6;10;6;8;10;13;8;12;12;5;4;5;12;8;11;4;11;5;9;10;11;7;9;7;6;9;6;9;12;4;12;8;7;7;10;12;8;10;11;15;16;13;5;12;5;5;11;6;5;10;12;3;7;12;8;11;7;10;4;10;11;12;3;8;4;4;9;9;9;14;5;6;9;9;7;8;13;12;7;11;6;12;5;9;9;7;9;9;6
A     2        0x0400000a00004000  1146690149.215032000  1146690262.965388000  113.750356000  1           3        eth:ipv4:tcp  00:13:d4:f3:ab:dd  00:13:d4:f3:a9:53  0x0800           192.168.201.243  07       "!Private network"  59189    192.168.201.242  07       "!Private network"  51523    6        2166     2150      0            25565       25414        0           967         11.80286    25.57787    0       5.527773  0.05251632  0.1254197  19.0417   224.7466  0.003707136   0.002962004   0x02             0.9898577    0.3875686    0.04021938    0        0     2188     7;8;12;8;8;14;6;7;9;9;7;13;6;10;15;7;5;9;4;7;10;7;8;8;13;14;6;6;8;8;6;8;12;10;13;4;9;9;13;10;9;4;7;7;9;8;9;10;10;9;11;5;6;9;12;11;7;2;7;13;10;8;11;8;9;11;7;4;7;7;7;9;6;4;3;10;6;12;9;10;8;14;8;15;14;9;9;6;10;12;6;14;16;8;7;8;9;6;9;9;9;7;8;5;9;7;4;9;7;10;6;10;8;9;8;10;12;4;7;7;12;9;9;8;6;6;12;13;7;4;9;4;7;10;7;4;12;8;13;13;7;10;10;10;8;12;7;5;10;12;9;9;9;12;3;6;11;7;10;3;8;4;10;8;2;11;8;9;8;9;7;6;10;13;10;9;8;6;11;9;6;10;7;9;11;7;5;3;10;6;7;15;7;2;14;7;10;6;9;6;10;6;17;7;8;9;12;11;5;16;3;9;9;9;9;9;8;7;7;6;8;9;8;12;6;9;10;9;11;7;9;6;6;7;7;15;9;12;4;3;11;9;9;6;13;15;12;11;7;9;4;9;8;7;8;11
B     2        0x0400000a00004001  1146690149.215081000  1146690263.003348000  113.788267000  1           3        eth:ipv4:tcp  00:13:d4:f3:a9:53  00:13:d4:f3:ab:dd  0x0800           192.168.201.242  07       "!Private network"  51523    192.168.201.243  07       "!Private network"  59189    6        2150     2166      0            25414       25565        0           562         11.82047    20.948      0       5.48683   0.0529248   0.1263116  18.89474  223.3446  -0.003707136  -0.002962004  0x02             0.9893849    0.375        0.04578755    0        0     2184     13;9;9;7;9;13;10;12;7;11;5;2;7;5;10;14;11;11;12;6;12;8;10;12;5;9;9;13;6;7;5;15;5;13;10;12;10;10;9;11;12;7;6;9;7;14;6;8;16;8;7;3;5;5;12;8;6;9;9;8;12;10;11;10;13;5;2;8;9;6;10;7;9;7;7;3;8;7;10;7;6;4;7;9;9;10;9;8;15;10;6;4;8;11;10;14;15;9;7;8;7;13;11;8;8;9;3;11;5;3;11;7;12;10;5;10;7;9;4;10;10;11;7;7;7;7;5;7;8;8;8;9;12;6;8;12;7;12;12;9;10;9;10;4;9;11;9;9;9;7;5;7;8;9;4;6;9;10;4;7;2;9;9;10;7;9;8;6;10;6;8;10;13;8;12;12;5;4;5;12;8;11;4;11;5;9;10;10;7;9;7;6;9;6;9;12;4;12;8;7;7;10;12;8;10;11;15;16;13;5;12;5;5;10;5;5;10;12;3;7;12;8;11;7;10;4;10;11;12;3;8;4;4;9;9;9;14;5;6;9;9;7;8;13;12;7;11;6;12;5;9;9;7;9;9;6

Let’s run the anonymized pcap annoloc2.pcap we had in earlier tutorials with the same configuration:

t2 -r ~/data/annoloc2.pcap -w ~/results

================================================================================
Tranalyzer 0.9.4 (Anteater), Cobra. PID: 76371, Prio: 0, SID: 666
================================================================================
Date: 1751734945.000235528 sec (Sat 05 Jul 2025 19:02:25 CEST)
[INF] Creating flows for L2, IPv4, IPv6
Active plugins:
    01: basicFlow, 0.9.4
    02: basicStats, 0.9.4
    03: tcpStates, 0.9.4
    04: entropy, 0.9.4
    05: txtSink, 0.9.4
[INF] IPv4 Ver: 6, Rev: 02072025, Range Mode: 0, subnet ranges loaded: 7237865 (7.24 M)
[INF] IPv6 Ver: 6, Rev: 02072025, Range Mode: 0, subnet ranges loaded: 1419083 (1.42 M)
...
--------------------------------------------------------------------------------
basicStats: Flow max(pktload): 1480 (1.48 K)
basicStats: Flow max(b/s), pkts: 19015999488 (19.02 Gb/s), 2
basicStats: Biggest L2 flow talker: 00:d0:02:6d:78:00: 57 [0.00%] packets
basicStats: Biggest L2 flow talker: 00:d0:02:6d:78:00: 2622 (2.62 K) [0.00%] bytes
basicStats: Biggest L3 flow talker: 138.212.189.38 (JP): 23601 (23.60 K) [1.94%] packets
basicStats: Biggest L3 flow talker: 138.212.189.38 (JP): 33731054 (33.73 M) [52.64%] bytes
tcpStates: Aggregated tcpStatesAFlags=0xdf
entropy: NValFlows, min, ave, max: 16625, 0.101410, 0.415083, 0.638390
--------------------------------------------------------------------------------
...

See? NValFlows = 16625 in the end report, hence 16625 flows are not eligible to be fit for entropy calculation, as we need minimum 256 bytes, actually more, see chapter above.

So if you look into the flow file you see 0 entries in the distribution, because the content was removed.

tcol ~/results/annoloc2_flows.txt

%dir  flowInd  flowStat            timeFirst          timeLast           duration   numHdrDesc  numHdrs  hdrDesc                                                                                              srcMac                               dstMac             ethType  ethVlanID  srcIP                                    srcIPCC  srcIPOrg                          srcPort  dstIP                                    dstIPCC  dstIPOrg                          dstPort  l4Proto  numPktsSnt  numPktsRcvd  numBytesSnt  numBytesRcvd  minPktSz  maxPktSz  avePktSize  stdPktSize  minIAT  maxIAT    aveIAT        stdIAT        pktps       bytps         pktAsm         bytAsm         tcpStatesAFlags  PyldEntropy  PyldChRatio  PyldBinRatio  PyldLen  PyldHisto
A     265      0x0400000000004000  1022171701.709116  1022171701.709116  0.000000   1           3        eth:ipv4:tcp                                                                                         00:d0:02:6d:78:00                    00:50:fc:0e:21:56  0x0800              209.171.12.143                           ca       "TELUS Communications Inc"        4987     138.212.185.230                          jp       "ASAHI KASEI CORPORATION"         41250    6        1           0            0            0             0         0         0           0           0       0         0             0             0           0             1              0              0xc3             -1           -1           -1            0        0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0
A     447      0x0400000000004000  1022171701.721366  1022171701.721366  0.000000   1           3        eth:ipv4:tcp                                                                                         00:d0:02:6d:78:00                    00:50:fc:3b:62:78  0x0800              217.41.129.13                            gb       "BT Infrastructure Layer"         58872    138.212.187.186                          jp       "ASAHI KASEI CORPORATION"         80       6        1           0            0            0             0         0         0           0           0       0         0             0             0           0             1              0              0xc3             -1           -1           -1            0        0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0
A     392      0x0400000000004000  1022171701.716998  1022171701.716998  0.000000   1           3        eth:ipv4:tcp                                                                                         00:d0:02:6d:78:00                    00:50:bf:59:85:48  0x0800              36.242.181.230                           jp       "SoftBank Corp"                   4685     138.212.188.67                           jp       "ASAHI KASEI CORPORATION"         1214     6        1           1            0            0             0         0         0           0           0       0         0             0             0           0             0              0              0x03             -1           -1           -1            0        0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0
...

If we extract all flows with payload and look at the distribution and the entropy. What kind of protocols do we have here?

tawk '$PyldLen > 256 || hdr()' ~/results/annoloc2_flows.txt | tcol

%dir  flowInd  flowStat            timeFirst             timeLast              duration      numHdrDesc  numHdrs  hdrDesc        srcMac             dstMac             ethType  vlanID  srcIP            srcIPCC  srcIPOrg                            srcPort  dstIP            dstIPCC  dstIPOrg                            dstPort  l4Proto  pktsSnt  pktsRcvd  padBytesSnt  l7BytesSnt  l7BytesRcvd  minL7PktSz  maxL7PktSz  avgL7PktSz  stdL7PktSz  minIAT  maxIAT    avgIAT      stdIAT      pktps      bytps     pktAsm        bytAsm        tcpStatesAFlags  PyldEntropy  PyldChRatio  PyldBinRatio  NumBin0  Corr          PyldLen  PyldHisto
A     2905     0x0400000200004000  1022171704.133733000  1022171711.602997000  7.469264000   1           3        eth:ipv4:icmp  00:01:03:24:09:88  00:d0:02:6d:78:00  0x0800           138.212.187.74   jp       "!ASAHI KASEI CORPORATION"          0        200.196.92.46    br       "LVLT-3549"                         0        1        13       0         0            551         0            37          44          42.38462    3.268788    0       2.921851  0.5745587   1.007593    1.740466   73.76898  1             1             0x00             0.6038611    0.3878205    0.2307692     202      0.3221154     312      52;0;0;0;0;0;0;16;3;1;3;3;0;0;0;0;0;13;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;3;5;4;0;0;4;0;10;0;13;0;0;0;1;1;1;0;0;0;0;0;0;0;0;0;0;4;4;5;0;0;0;13;0;0;0;0;14;1;1;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;13;0;0;0;0;0;1;0;0;0;0;0;0;0;1;1;1;0;0;0;0;0;0;0;13;0;0;0;0;0;0;1;1;1;0;0;0;0;0;0;0;0;0;0;0;0;13;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;1;14;0;0;0;1;1;1;0;0;13;0;0;0;13;0;0;0;0;0;0;0;3;3;4;3;13;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;1;1;0;0;0;1;1;1;0;0;0;0;13;0;0;0;0
A     4555     0x0400000200004000  1022171708.303627000  1022171716.404597000  8.100970000   1           3        eth:ipv4:icmp  00:01:03:24:09:88  00:d0:02:6d:78:00  0x0800           138.212.187.74   jp       "!ASAHI KASEI CORPORATION"          0        206.134.241.215  us       "AMAZON-02"                         0        1        14       0         0            588         0            37          44          42          3.427509    0       2.027147  0.5786408   0.9681696   1.728188   72.5839   1             1             0x00             0.6038085    0.2946429    0.1666667     201      0.297619      336      56;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;14;14;0;0;0;0;0;0;1;1;1;1;0;0;0;1;0;1;1;0;1;4;4;3;1;1;5;1;10;0;3;4;17;4;3;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;14;0;0;0;0;14;0;0;0;0;1;1;1;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;0;0;1;0;0;0;0;0;0;0;0;0;0;1;1;0;0;0;0;0;0;0;0;0;0;14;0;0;0;14;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;4;0;4;16;0;2;2;0;0;0;0;0;0;2;0;2;3;1;4;4;0;0;14;0;0;0;0;0;15;0;0;15;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;14;0;0;0;0;0;0;1;1;1;15;0;0;0;0
A     6407     0x0400000200004000  1022171714.250699000  1022171720.304397000  6.053698000   1           3        eth:ipv4:udp   00:04:76:0f:59:7a  00:d0:02:6d:78:00  0x0800           138.212.191.105  jp       "!ASAHI KASEI CORPORATION"          2270     215.47.27.47     us       "DNIC-AS-00749"                     53       17       25       25        0            941         941          37          38          37.64       0.498153    0       3.933408  0.242148    0.8931671   4.129707   155.4422  0             0             0x00             0.2460202    0.07333333   0.8366666     206      0.3416667     300      225;25;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;1;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;0;0;1;0;0;1;0;1;0;0;1;1;1;1;1;0;0;0;0;1;0;0;0;1;0;0;0;1;1;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;1;0;1;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;1;0;0;2;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;1;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;1;0;1;0;0;0;0;0;1;0;1;0;0;0;0;0;1;0;0;0;0;0;1;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;1;0;1;0;0;0;1;2;0;0;0;0;1;0;0;0;0;0;1;0;0;0;0;0;0;0;1;1;1;0;0;1;0;1;1;0;0;0;0
B     6407     0x0400000200004001  1022171714.336366000  1022171720.389966000  6.053600000   1           3        eth:ipv4:udp   00:d0:02:6d:78:00  00:04:76:0f:59:7a  0x0800           215.47.27.47     us       "DNIC-AS-00749"                     53       138.212.191.105  jp       "!ASAHI KASEI CORPORATION"          2270     17       25       25        0            941         941          37          38          37.64       0.498153    0       3.932915  0.242144    0.8931028   4.129774   155.4447  0             0             0x00             0.2460201    0.07333333   0.7533333     206      0.3416667     300      225;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;1;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;0;0;1;0;0;1;0;1;0;0;1;1;1;1;1;0;0;0;0;1;0;0;0;1;0;0;0;1;1;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;1;0;1;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;1;0;0;2;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;1;25;0;0;0;0;0;0;1;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;1;0;1;0;0;0;0;0;1;0;1;0;0;0;0;0;1;0;0;0;0;0;1;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;1;0;1;0;0;0;1;2;0;0;0;0;1;0;0;0;0;0;1;0;0;0;0;0;0;0;1;1;1;0;0;1;0;1;1;0;0;0;0
A     4180     0x0400000200004000  1022171707.217208000  1022171722.726327000  15.509119000  1           3        eth:ipv4:udp   00:50:da:37:f6:03  00:d0:02:6d:78:00  0x0800           138.212.191.75   jp       "!ASAHI KASEI CORPORATION"          1040     138.212.18.252   jp       "AKNWS-NET Asahi Kasei Networks C"  53       17       44       45        0            1892        8034         40          52          43          4.539552    0       13.95775  0.3524799   2.118386    2.837041   121.9927  -0.01123596   -0.6187789    0x00             0.2352592    0            0.842803      210      0.1979167     528      353;89;1;1;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;39;5;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;1;1;1;1;1;1;1;1;1;1;1;0;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1
...

So, that’s it for now. Try the pcap faf-exercise.pcap and find out whether it is encrypted or compressed content.

Conclusion

The entropy plugin will evolve in the future, as not everything trick of the Anteater is not implemented yet. Don’t forget to reset entropy config.

t2conf --reset entropy && t2build entropy

Have fun!