import csv

hashMap = dict()
downloadedMap = dict()

#balancedLabels.csv created with balancedHashList.py
with open('balancedLabels.csv') as labels:
	csvIn = csv.reader(labels)
	for hash in csvIn:
		hashMap[hash[0]] = hash[1]

#byte entropy histograms (beh) directory created with downloadbeh.py
#downloaded.csv created with `ls ./behDir > downloaded.csv`
with open('downloaded.csv') as downloads:
	for hashline in downloads:
		hash = hashline.rstrip()
		family = hashMap[hash]
		if family in downloadedMap:
			downloadedMap[family] += 1
		else:
			downloadedMap[family] = 0

for family in downloadedMap:
	print family + ',' + str(downloadedMap[family])
