From 1110aaff07edd87f0ae991d8bc9b0f9b5c571e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Fri, 8 Dec 2023 20:17:44 +0100 Subject: new research --- prog/icmpft/fft.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 prog/icmpft/fft.py (limited to 'prog/icmpft/fft.py') diff --git a/prog/icmpft/fft.py b/prog/icmpft/fft.py new file mode 100755 index 0000000..d39244a --- /dev/null +++ b/prog/icmpft/fft.py @@ -0,0 +1,23 @@ +#!/usr/bin/python3 +from sys import stdin +from struct import unpack +profile = stdin.buffer.read() +hosts = {} +for resp in [profile[i:i+32] for i in range(0, len(profile), 32)]: + ssec, snsec, rsec, rusec = unpack("!LLLL", resp[0:16]) + ipaddr = resp[16:32] + if ipaddr not in hosts: + hosts[ipaddr] = {} + stime = ssec*1000000000+snsec + rtime = rsec*1000000000+rusec + hosts[ipaddr][stime] = rtime-stime +from numpy.fft import rfft +import numpy as np +import matplotlib +matplotlib.use("GTK3Cairo") +from matplotlib import pyplot as plt +for host in hosts: + N = 10 + fft = np.convolve(np.absolute(rfft(list(hosts[host].values()))), np.ones(N)/N, mode='valid') + plt.plot(list(range(len(fft))), fft) + plt.show() -- cgit v1.2.3