def _detailed_status(self, status): avg_amp = float('{0:.2f}'.format(status['avg_amp'])) pkt_in_bytes = utils.format_unit(status['packets_in_bytes']) modes = () for mode_pair in status['modes']: mode = mode_pair[0] mode_count = mode_pair[1] if mode == 1 or mode == 2: mode_str = 'SYMMETRIC (1 or 2): ' elif mode == 3: mode_str = 'CLIENT (3): ' elif mode == 4: mode_str = 'SERVER (4): ' elif mode == 5: mode_str = 'BROADCAST (5): ' elif mode == 6: mode_str = 'CONTROL (6): ' elif mode == 7: mode_str = 'PRIVATE/MONLIST (7): ' else: mode_str = 'UNKNOWN (%s): ' % (mode) count = utils.sep_thousand(mode_count) mode_str += count modes += (mode_str, ) stats = [ ['Average amplification', utils.sep_thousand(avg_amp)], ['Traffic IN/OUT', pkt_in_bytes], ['NTP modes distribution', modes], ] return stats
def _detailed_status(self, status): avg_amp = float('{0:.2f}'.format(status['avg_amp'])) pkt_in_bytes = utils.format_unit(status['packets_in_bytes']) targets = () for target in status['st']: target_str = target[0] + ': ' + utils.sep_thousand(target[1]) targets += (target_str, ) stats = [ ['Average amplification', utils.sep_thousand(avg_amp)], ['Traffic IN/OUT', pkt_in_bytes], ['SSDP search targets', targets], ] return stats
def _detailed_status(self, status): avg_amp = float('{0:.2f}'.format(status['avg_amp'])) top_amps = tuple(x[0] + ' -- amplification: ' + str(x[1]) + 'x, response size: ' + utils.format_unit(x[2]) for x in status['top5_amp_domains']) top_domains = tuple(x[0] + ' -- use count: ' + utils.sep_thousand(x[1]) + ', amplification: ' + str(x[2]) + 'x' for x in status['top5_domains']) stats = [ ['Average DNS amplification', utils.sep_thousand(avg_amp)], ['Top domains by amp', top_amps], ['Most common domains', top_domains], ] return stats
def _detailed_status(self, status): avg_amp = float('{0:.2f}'.format(status['avg_amp'])) pkt_in_bytes = utils.format_unit(status['packets_in_bytes']) stats = [ ['Average amplification', utils.sep_thousand(avg_amp)], ['Traffic IN/OUT', pkt_in_bytes], ] return stats