tonyseek / openvpn-status

Parse OpenVPN status logs in Python
https://openvpn-status.readthedocs.io
MIT License
83 stars 31 forks source link

common_name duplicates not showing #2

Closed Ghilteras closed 7 years ago

Ghilteras commented 8 years ago

in case a common_name is used by multiple clients it's impossible to get a genuine number of clients connected because common_name is counted only once:

i.e. let's parse something like this:

OpenVPN CLIENT LIST Updated,Thu Jan 28 14:15:31 2016 Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since vpn-client,10.0.0.1:11221,890239,5325189,Thu Jan 28 13:20:48 2016 vpn-client,10.0.0.2:41657,1048186061,1049108189,Thu Jan 28 10:41:04 2016 vpn-client,10.0.0.3:1194,10897049,3779940,Thu Jan 28 08:17:40 2016 vpn-client,10.0.0.4:62337,22944717,18576517,Thu Jan 28 08:13:24 2016

with open('/foo/bar') as file: file = prova.read() clients = parse_status(file) print len(clients.client_list)

I would expect an output of 4, but I get 1 because the common_name is not unique, so how do we extract the lists of clients connected in this case

tonyseek commented 7 years ago

Thanks for your feedback. It is a design fault. I will fix it in next release.