|
@@ -420,6 +420,9 @@ class Statistics:
|
|
plt.xticks(x, my_xticks, rotation='vertical', fontsize=5)
|
|
plt.xticks(x, my_xticks, rotation='vertical', fontsize=5)
|
|
plt.tight_layout()
|
|
plt.tight_layout()
|
|
|
|
|
|
|
|
+ # limit the number of xticks
|
|
|
|
+ plt.locator_params(axis='x', nbins=20)
|
|
|
|
+
|
|
plt.bar(x, graphy, width, align='center', linewidth=2, color='red', edgecolor='red')
|
|
plt.bar(x, graphy, width, align='center', linewidth=2, color='red', edgecolor='red')
|
|
out = self.pcap_filepath.replace('.pcap', '_plot-ip-src' + file_ending)
|
|
out = self.pcap_filepath.replace('.pcap', '_plot-ip-src' + file_ending)
|
|
plt.savefig(out, dpi=500)
|
|
plt.savefig(out, dpi=500)
|
|
@@ -448,6 +451,9 @@ class Statistics:
|
|
plt.xticks(x, my_xticks, rotation='vertical', fontsize=5)
|
|
plt.xticks(x, my_xticks, rotation='vertical', fontsize=5)
|
|
plt.tight_layout()
|
|
plt.tight_layout()
|
|
|
|
|
|
|
|
+ # limit the number of xticks
|
|
|
|
+ plt.locator_params(axis='x', nbins=20)
|
|
|
|
+
|
|
plt.bar(x, graphy, width, align='center', linewidth=2, color='red', edgecolor='red')
|
|
plt.bar(x, graphy, width, align='center', linewidth=2, color='red', edgecolor='red')
|
|
out = self.pcap_filepath.replace('.pcap', '_plot-ip-dst' + file_ending)
|
|
out = self.pcap_filepath.replace('.pcap', '_plot-ip-dst' + file_ending)
|
|
plt.savefig(out, dpi=500)
|
|
plt.savefig(out, dpi=500)
|
|
@@ -492,12 +498,15 @@ class Statistics:
|
|
plt.xlim([0, len(graphx)])
|
|
plt.xlim([0, len(graphx)])
|
|
plt.grid(True)
|
|
plt.grid(True)
|
|
|
|
|
|
- # IPs on x-axis
|
|
|
|
|
|
+ # timestamp on x-axis
|
|
x = range(0, len(graphx))
|
|
x = range(0, len(graphx))
|
|
my_xticks = graphx
|
|
my_xticks = graphx
|
|
plt.xticks(x, my_xticks, rotation='vertical', fontsize=5)
|
|
plt.xticks(x, my_xticks, rotation='vertical', fontsize=5)
|
|
plt.tight_layout()
|
|
plt.tight_layout()
|
|
|
|
|
|
|
|
+ # limit the number of xticks
|
|
|
|
+ plt.locator_params(axis='x', nbins=20)
|
|
|
|
+
|
|
plt.bar(x, graphy, width, align='center', linewidth=2, color='red', edgecolor='red')
|
|
plt.bar(x, graphy, width, align='center', linewidth=2, color='red', edgecolor='red')
|
|
out = self.pcap_filepath.replace('.pcap', '_plot-interval-pkt-count' + file_ending)
|
|
out = self.pcap_filepath.replace('.pcap', '_plot-interval-pkt-count' + file_ending)
|
|
plt.savefig(out, dpi=500)
|
|
plt.savefig(out, dpi=500)
|
|
@@ -520,12 +529,15 @@ class Statistics:
|
|
plt.xlim([0, len(graphx)])
|
|
plt.xlim([0, len(graphx)])
|
|
plt.grid(True)
|
|
plt.grid(True)
|
|
|
|
|
|
- # IPs on x-axis
|
|
|
|
|
|
+ # timestamp on x-axis
|
|
x = range(0, len(graphx))
|
|
x = range(0, len(graphx))
|
|
my_xticks = graphx
|
|
my_xticks = graphx
|
|
plt.xticks(x, my_xticks, rotation='vertical', fontsize=5)
|
|
plt.xticks(x, my_xticks, rotation='vertical', fontsize=5)
|
|
plt.tight_layout()
|
|
plt.tight_layout()
|
|
|
|
|
|
|
|
+ # limit the number of xticks
|
|
|
|
+ plt.locator_params(axis='x', nbins=20)
|
|
|
|
+
|
|
plt.bar(x, graphy, width, align='center', linewidth=2, color='red', edgecolor='red')
|
|
plt.bar(x, graphy, width, align='center', linewidth=2, color='red', edgecolor='red')
|
|
out = self.pcap_filepath.replace('.pcap', '_plot-interval-ip-src-ent' + file_ending)
|
|
out = self.pcap_filepath.replace('.pcap', '_plot-interval-ip-src-ent' + file_ending)
|
|
plt.savefig(out, dpi=500)
|
|
plt.savefig(out, dpi=500)
|
|
@@ -548,12 +560,15 @@ class Statistics:
|
|
plt.xlim([0, len(graphx)])
|
|
plt.xlim([0, len(graphx)])
|
|
plt.grid(True)
|
|
plt.grid(True)
|
|
|
|
|
|
- # IPs on x-axis
|
|
|
|
|
|
+ # timestamp on x-axis
|
|
x = range(0, len(graphx))
|
|
x = range(0, len(graphx))
|
|
my_xticks = graphx
|
|
my_xticks = graphx
|
|
plt.xticks(x, my_xticks, rotation='vertical', fontsize=5)
|
|
plt.xticks(x, my_xticks, rotation='vertical', fontsize=5)
|
|
plt.tight_layout()
|
|
plt.tight_layout()
|
|
|
|
|
|
|
|
+ # limit the number of xticks
|
|
|
|
+ plt.locator_params(axis='x', nbins=20)
|
|
|
|
+
|
|
plt.bar(x, graphy, width, align='center', linewidth=2, color='red', edgecolor='red')
|
|
plt.bar(x, graphy, width, align='center', linewidth=2, color='red', edgecolor='red')
|
|
out = self.pcap_filepath.replace('.pcap', '_plot-interval-ip-dst-ent' + file_ending)
|
|
out = self.pcap_filepath.replace('.pcap', '_plot-interval-ip-dst-ent' + file_ending)
|
|
plt.savefig(out, dpi=500)
|
|
plt.savefig(out, dpi=500)
|
|
@@ -572,16 +587,18 @@ class Statistics:
|
|
plt.title("Destination IP Cumulative Entropy")
|
|
plt.title("Destination IP Cumulative Entropy")
|
|
plt.xlabel('Timestamp')
|
|
plt.xlabel('Timestamp')
|
|
plt.ylabel('Entropy')
|
|
plt.ylabel('Entropy')
|
|
- width = 0.5
|
|
|
|
plt.xlim([0, len(graphx)])
|
|
plt.xlim([0, len(graphx)])
|
|
plt.grid(True)
|
|
plt.grid(True)
|
|
|
|
|
|
- # IPs on x-axis
|
|
|
|
|
|
+ # timestamp on x-axis
|
|
x = range(0, len(graphx))
|
|
x = range(0, len(graphx))
|
|
my_xticks = graphx
|
|
my_xticks = graphx
|
|
plt.xticks(x, my_xticks, rotation='vertical', fontsize=5)
|
|
plt.xticks(x, my_xticks, rotation='vertical', fontsize=5)
|
|
plt.tight_layout()
|
|
plt.tight_layout()
|
|
|
|
|
|
|
|
+ # limit the number of xticks
|
|
|
|
+ plt.locator_params(axis='x', nbins=20)
|
|
|
|
+
|
|
plt.plot(x, graphy, 'r')
|
|
plt.plot(x, graphy, 'r')
|
|
out = self.pcap_filepath.replace('.pcap', '_plot-interval-ip-dst-cum-ent' + file_ending)
|
|
out = self.pcap_filepath.replace('.pcap', '_plot-interval-ip-dst-cum-ent' + file_ending)
|
|
plt.savefig(out, dpi=500)
|
|
plt.savefig(out, dpi=500)
|
|
@@ -590,26 +607,30 @@ class Statistics:
|
|
# Aidmar
|
|
# Aidmar
|
|
def plot_interval_ip_src_cum_ent(file_ending: str):
|
|
def plot_interval_ip_src_cum_ent(file_ending: str):
|
|
plt.gcf().clear()
|
|
plt.gcf().clear()
|
|
|
|
+
|
|
result = self.stats_db._process_user_defined_query(
|
|
result = self.stats_db._process_user_defined_query(
|
|
"SELECT timestamp, ipSrcCumEntropy FROM interval_statistics ORDER BY timestamp")
|
|
"SELECT timestamp, ipSrcCumEntropy FROM interval_statistics ORDER BY timestamp")
|
|
graphx, graphy = [], []
|
|
graphx, graphy = [], []
|
|
for row in result:
|
|
for row in result:
|
|
graphx.append(row[0])
|
|
graphx.append(row[0])
|
|
graphy.append(row[1])
|
|
graphy.append(row[1])
|
|
|
|
+
|
|
plt.autoscale(enable=True, axis='both')
|
|
plt.autoscale(enable=True, axis='both')
|
|
plt.title("Source IP Cumulative Entropy")
|
|
plt.title("Source IP Cumulative Entropy")
|
|
plt.xlabel('Timestamp')
|
|
plt.xlabel('Timestamp')
|
|
plt.ylabel('Entropy')
|
|
plt.ylabel('Entropy')
|
|
- width = 0.5
|
|
|
|
plt.xlim([0, len(graphx)])
|
|
plt.xlim([0, len(graphx)])
|
|
plt.grid(True)
|
|
plt.grid(True)
|
|
|
|
|
|
- # IPs on x-axis
|
|
|
|
|
|
+ # timestamp on x-axis
|
|
x = range(0, len(graphx))
|
|
x = range(0, len(graphx))
|
|
my_xticks = graphx
|
|
my_xticks = graphx
|
|
plt.xticks(x, my_xticks, rotation='vertical', fontsize=5)
|
|
plt.xticks(x, my_xticks, rotation='vertical', fontsize=5)
|
|
plt.tight_layout()
|
|
plt.tight_layout()
|
|
|
|
|
|
|
|
+ # limit the number of xticks
|
|
|
|
+ plt.locator_params(axis='x',nbins=20)
|
|
|
|
+
|
|
plt.plot(x, graphy, 'r')
|
|
plt.plot(x, graphy, 'r')
|
|
out = self.pcap_filepath.replace('.pcap', '_plot-interval-ip-src-cum-ent' + file_ending)
|
|
out = self.pcap_filepath.replace('.pcap', '_plot-interval-ip-src-cum-ent' + file_ending)
|
|
plt.savefig(out, dpi=500)
|
|
plt.savefig(out, dpi=500)
|