Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
derv82
GitHub Repository: derv82/wifite2
Path: blob/master/wifite/model/client.py
412 views
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
4
class Client(object):
5
'''
6
Holds details for a 'Client' - a wireless device (e.g. computer)
7
that is associated with an Access Point (e.g. router)
8
'''
9
10
def __init__(self, fields):
11
'''
12
Initializes & stores client info based on fields.
13
Args:
14
Fields - List of strings
15
INDEX KEY
16
0 Station MAC (client's MAC address)
17
1 First time seen,
18
2 Last time seen,
19
3 Power,
20
4 # packets,
21
5 BSSID, (Access Point's MAC address)
22
6 Probed ESSIDs
23
'''
24
self.station = fields[0].strip()
25
self.power = int(fields[3].strip())
26
self.packets = int(fields[4].strip())
27
self.bssid = fields[5].strip()
28
29
30
def __str__(self):
31
''' String representation of a Client '''
32
result = ''
33
for (key,value) in self.__dict__.items():
34
result += key + ': ' + str(value)
35
result += ', '
36
return result
37
38
39
if __name__ == '__main__':
40
fields = 'AA:BB:CC:DD:EE:FF, 2015-05-27 19:43:47, 2015-05-27 19:43:47, -67, 2, (not associated) ,HOME-ABCD'.split(',')
41
c = Client(fields)
42
print('Client', c)
43
44