-
Notifications
You must be signed in to change notification settings - Fork 0
/
kismet-device-vendors.py
27 lines (20 loc) · 981 Bytes
/
kismet-device-vendors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("../data/processing/sumMacVendors.csv", delimiter=";")
grouped = df.groupby('name')
vendorCount = grouped['name'].count().reset_index(name ='count')
# move all MACs with only one device to "other"
otherRows = vendorCount[vendorCount['count'] <= 1]
# remove all rows with only one device
vendorCountWithoutOthers = vendorCount.drop(otherRows.index)
# add "other" row to dataframe
vendorCountWithoutOthers.loc[len(vendorCountWithoutOthers)] = {'name': 'other devices', 'count': otherRows.count()['count']}
# create the pie chart
plt.figure(figsize=(10, 8))
explode = (0.1, 0, 0, 0, 0.2, 0, 0.3, 0.2, 0.15)
plt.pie(vendorCountWithoutOthers['count'], labels=vendorCountWithoutOthers['name'], startangle=140, explode=explode)
plt.legend(vendorCountWithoutOthers['name'], loc='upper left', bbox_to_anchor=(1, 1))
plt.title('Device vendors (Bluetooth and WiFi)')
plt.axis('equal')
# show the pie chart
plt.show()