Python Forum

Full Version: computing entropy using pickle files
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone
Happy holidays

I'm working on the ISCX VPN2016 dataset, it consists of some pcap files (each pcap is captured traffic of a specific app such as skype or youtube) and I used this code on github to convert the pcaps to pickle files. The prepro.py converts the pcap files to two pickle files, and now I have these bunch of pickles and with running the code below:

checkThePickle = open("AIMchat2.pcapng.pickle", "rb")
pkl = pickle.load(checkThePickle)
print(pkl)
It prints out something like this:

Quote:([array([ 69, 0, 0, 157, 85, 188, 64, 0, 128, 6, 215, 201, 131,
202, 240, 87, 64, 12, 24, 167, 52, 73, 1, 187, 9, 93,
46, 200, 243, 42, 197, 49, 80, 24, 250, 91, 41, 106, 0,
0, 23, 3, 2, 0, 112, 20, 144, 204, 89, 124, 163, 127,
209, 18, 226, 180, 46, 85, 57, 41, 242, 48, 241, 123, 189,
29, 163, 87, 12, 25, 194, 240, 140, 11, 140, 134, 22, 153,
216, 58, 25, 176, 71, 231, 178, 244, 157, 130, 142, 38, 97,
4, 242, 162, 142, 206, 164, 98, 204, 251, 228, 208, 222, 137,
101, 85, 85, 93, 30, 254, 70, 155, 118, 136, 244, 243, 220,
143, 222, 166, 75, 107, 49, 113, 96, 148, 93, 19, 215, 124,
163, 22, 206, 204, 27, 167, 16, 197, 189, 0, 232, 77, 139,
5, 118, 149, 163, 140, 208, 131, 193, 241, 18, 238, 159, 239,
109], dtype=uint8), array([ 69, 0, 0, 40, 183, 8, 64, 0, 100, 6, 146, 242, 64,
12, 24, 167, 131, 202, 240, 87, 1, 187, 52, 73, 243, 42,
197, 49, 9, 93, 47, 61, 80, 16, 64, 0, 124, 4, 0,
0, 0, 0, 0, 0, 0, 0], dtype=uint8),

My purpose is to compute entropy of each pcap files and now I'm wondering if I can use these pickle files for this purpose?

Any helps would be really appreciated.
I should have divide this problem, so at first I think I should remove those words shown in the output >>> array and dtype = unint8? So I added the code below, in order to remove these words, but it doesn't work.

for word in pkl:
    if word == "array" or word == "dtype=uint8":
        pkl.remove(word)
print(pkl)
(Dec-29-2019, 10:43 AM)baran01 Wrote: [ -> ]My purpose is to compute entropy of each pcap files and now I'm wondering if I can use these pickle files for this purpose?
Do you have a definition for pcap entropy that you can use?

(Dec-29-2019, 07:06 PM)baran01 Wrote: [ -> ]So I added the code below
Your original question seems to be about measuring entropy, and I'm not sure what the extra code has to do with that.

By the way, you should read the link in my signature. If you take it to heart, I imagine you'll be a much better prepared question-asker.