def __init__(self, family, type_, distr): self.socket = socket.socket(family, type_) if type_ == socket.SOCK_STREAM: self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) start = time.time() self.mm = dream.MorphingMatrix(dream.get_csc_from_mm("https_to_tor.mtx")) self.dst_distr = distr end = time.time() print "Dst distribution: sum = %f | len = %d" % (sum(self.dst_distr), len(self.dst_distr)) print "Time to load morphing matrix : %f" % (end - start)
plt.savefig('%s_%s.png' % (name, MODE.lower())) plt.clf() """Plot diagram every <element> packets.""" TEST_N = [500, 2000, 8000, 16000, 50000, 100000, 500000] if (MODE == 'SC'): # HTTPS S->C prob. distr. https_custm = get_prob_distr_from_file(SC_HTTPS_PROB_DISTR_FILENAME, "https_gain") # Tor S->C prob. distr. tor_custm = get_prob_distr_from_file(SC_TOR_PROB_DISTR_FILENAME, "tor_gain") # S->C morphing matrix mm_csc = dream.get_csc_from_mm(SC_MORPHING_MATRIX_FILENAME) elif (MODE == 'CS'): # HTTPS C->S prob. distr. https_custm = get_prob_distr_from_file(CS_HTTPS_PROB_DISTR_FILENAME, "https_gain") # Tor C->S prob. distr. tor_custm = get_prob_distr_from_file(CS_TOR_PROB_DISTR_FILENAME, "tor_gain") # C->S morphing matrix mm_csc = dream.get_csc_from_mm(CS_MORPHING_MATRIX_FILENAME) else: print "STOP... HAMMER TIME" sys.exit(1) mm = dream.MorphingMatrix(mm_csc) y_axis_sampling = [] y_axis_morphing = []
plt.clf() """Plot diagram every <element> packets.""" TEST_N = [500, 2000, 8000, 16000, 50000, 100000, 500000] if (MODE == 'SC'): # HTTPS S->C prob. distr. https_custm = get_prob_distr_from_file(SC_HTTPS_PROB_DISTR_FILENAME, "https_gain") # Tor S->C prob. distr. tor_custm = get_prob_distr_from_file(SC_TOR_PROB_DISTR_FILENAME, "tor_gain") # S->C morphing matrix mm_csc = dream.get_csc_from_mm(SC_MORPHING_MATRIX_FILENAME) elif (MODE == 'CS'): # HTTPS C->S prob. distr. https_custm = get_prob_distr_from_file(CS_HTTPS_PROB_DISTR_FILENAME, "https_gain") # Tor C->S prob. distr. tor_custm = get_prob_distr_from_file(CS_TOR_PROB_DISTR_FILENAME, "tor_gain") # C->S morphing matrix mm_csc = dream.get_csc_from_mm(CS_MORPHING_MATRIX_FILENAME) else: print "STOP... HAMMER TIME" sys.exit(1) mm = dream.MorphingMatrix(mm_csc)