from scapy.all import *
from datasketch import MinHash

# read in raw pcaps
packet1 = rdpcap("./normal1.pcap")
packet2 = rdpcap("./normal2.pcap")

# instantiate object
foo = MinHash()
bar = MinHash()

# convet to strings, encode in utf8, and update the hash
for packet in packet1:
	foo.update((str(packet).encode('utf8')))

for packet in packet2:
	bar.update((str(packet).encode('utf8')))

print("similarity = ", foo.jaccard(bar))

@@ -69,22 +69,22 @@
 w pcaps%0A
-packet
+normal
 1 = rdpc
@@ -104,22 +104,22 @@
 .pcap%22)%0A
-packet
+normal
 2 = rdpc
@@ -140,16 +140,75 @@
 pcap%22)%0A%0A
+mal1 = rdpcap(%22./mal1.pcap%22)%0Amal2 = rdpcap(%22./mal2.pcap%22)%0A%0A
 # instan
@@ -220,19 +220,21 @@
  object%0A
-foo
+hash1
  = MinHa
@@ -238,19 +238,57 @@
 nHash()%0A
-bar
+hash2 = MinHash()%0Ahash3 = MinHash()%0Ahash4
  = MinHa
@@ -368,87 +368,221 @@
  in 
-packet1:%0A%09foo.update((str(packet).encode('utf8')))%0A%0Afor packet in packet2:%0A%09bar
+normal1:%0A%09hash1.update((str(packet).encode('utf8')))%0A%0Afor packet in normal2:%0A%09hash2.update((str(packet).encode('utf8')))%0A%0Afor packet in mal1:%0A%09hash3.update((str(packet).encode('utf8')))%0A%0Afor packet in mal2:%0A%09hash4
 .upd
@@ -623,16 +623,26 @@
 %0Aprint(%22
+norm-norm 
 similari
@@ -653,22 +653,133 @@
  %22, 
-foo.jaccard(bar
+hash1.jaccard(hash2))%0Aprint(%22norm-mal similarity = %22, hash1.jaccard(hash3))%0Aprint(%22mal-mal similarity = %22, hash3.jaccard(hash4
 ))%0A

edit hash