Commit 3677ab28 authored by Ad Schellevis's avatar Ad Schellevis

(captiveportal, new) add some additional info to "captiveportal list_clients <zone>" command

parent 644e864e
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
list connected clients for a captive portal zone list connected clients for a captive portal zone
""" """
import sys import sys
import time
import ujson import ujson
from lib.db import DB from lib.db import DB
...@@ -55,11 +56,15 @@ if parameters['output_type'] != 'json': ...@@ -55,11 +56,15 @@ if parameters['output_type'] != 'json':
'userName': 'username', 'userName': 'username',
'ipAddress': 'ip_address', 'ipAddress': 'ip_address',
'macAddress': 'mac_address', 'macAddress': 'mac_address',
'total_bytes': 'total_bytes' 'total_bytes': 'total_bytes',
'idletime' : 'idletime',
'totaltime': 'totaltime'
} }
print '%(sessionId)-30s %(userName)-20s %(ipAddress)-20s %(macAddress)-20s %(total_bytes)-20s' % heading print '%(sessionId)-30s %(userName)-20s %(ipAddress)-20s %(macAddress)-20s %(total_bytes)-15s %(idletime)-10s %(totaltime)-10s' % heading
for item in response: for item in response:
item['total_bytes'] = (item['bytes_out'] + item['bytes_in']) item['total_bytes'] = (item['bytes_out'] + item['bytes_in'])
print '%(sessionId)-30s %(userName)-20s %(ipAddress)-20s %(macAddress)-20s %(total_bytes)-20s' % item item['idletime'] = time.time() - item['last_accessed']
item['totaltime'] = time.time() - item['startTime']
print '%(sessionId)-30s %(userName)-20s %(ipAddress)-20s %(macAddress)-20s %(total_bytes)-15s %(idletime)-10d %(totaltime)-10d' % item
else: else:
print(ujson.dumps(response)) print(ujson.dumps(response))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment