Created
April 9, 2014 20:10
-
-
Save nmathewson/10309480 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import binascii | |
bad_keys = set() | |
for line in open("vk.txt"): | |
fp = line.split(",")[2].strip() | |
bad_keys.add(binascii.a2b_hex(fp.lower())) | |
bad = None | |
bw_bad = bw_good = n_bad = n_good = 0 | |
for line in open("mc.txt"): | |
if line.startswith('r '): | |
k = binascii.a2b_base64(line.split()[2] + "=") | |
bad = (k in bad_keys) | |
if bad: | |
n_bad += 1 | |
else: | |
n_good += 1 | |
if line.startswith('w Bandwidth='): | |
bw = int(line[len('w Bandwidth='):].split()[0]) | |
if bad is None: | |
print "WTF" | |
elif bad: | |
bw_bad += bw | |
else: | |
bw_good += bw | |
bad = None | |
print "n_bad = %d/%d == %d%%."%(n_bad, n_good+n_bad, (n_bad*100.0)/(n_good+n_bad)) | |
print "bw_bad = %d/%d == %d%%."%(bw_bad, bw_good+bw_bad, (bw_bad*100.0)/(bw_good+bw_bad)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment