./TrafficAnalyzer_Report.sh -h
#======================================================================================= © 2016-2018 Martineau v1.09
#
# Scan Traffic Analyzer database
#
# TrafficAnalyzer [help | -h] ['ip='{[ip_address[,...] | hostname[...]]}] ['app='{category_name[,...]}] ['app='{application_name[,...]}]
# ['date='[yyyy/mm/dd[,...]]] ['time='[hh:mm:ss[,...]]] ['sqldb='{database}] ['backup'] ['nofilter'] ['email'] ['mode=or'] ['noscript']
# ['count'] ['sortby='column]
#
# TrafficAnalyzer
# Will list the script's DEFAULT Category entries in the Traffic Analyzer database containing 'Social' AND 'Instant'
# TrafficAnalyzer count
# Will count the script's DEFAULT Category entries in the Traffic Analyzer database containing 'Social' AND 'Instant'
# and will only display the result count. No records are displayed on screen.
# TrafficAnalyzer nofilter
# Will list ALL entries in the Traffic Analyzer database.
# TrafficAnalyzer nofilter sortby=app
# Will list ALL entries in the Traffic Analyzer database sorted by column Application name
# TrafficAnalyzer nofilter email
# Will list ALL entries in the Traffic Analyzer database and will send an email with the results
# TrafficAnalyzer cat=VoIP,Social
# Case sensitive; Will list Category entries in the Traffic Analyzer database for 'VoIP' AND 'Social'
# TrafficAnalyzer app=Facebook,Netflix mode=or
# Case sensitive; Will list Application entries in the Traffic Analyzer database containing either 'Facebook' OR 'Netflix'
# TrafficAnalyzer date=2017/02/30
# Will list entries in the Traffic Analyzer database created on '30th Feb 2017'
# NOTE: The date specification can be an abbreviation e.g. '2017/02' for records created in 'Feb 2017'
# TrafficAnalyzer ip=10.88.8.123,192.168.1.99
# Will list entries in database for two devices - either '10.88.8.123' or '192.168.1.99'
# NOTE: Only MAC addresses are stored in the database so if the devices are not 'reserved/static'
# then the report could be inaccurate.
# TrafficAnalyzer ip=10.88.8.123, 192.168.1.120-192.168.1.123, CAMERAS
# Will list database entries for five devices, plus all IPs for 'CAMERAS' entry in '/jffs/configs/IPGroups'
# TrafficAnalyzer time=09:
# Will list entries in the Traffic Analyzer database created between '09:00' to '09:59'
# NOTE: A full time specification can be used e.g. '12:05:30' but the report may never find a match!
# TrafficAnalyzer backup
# The current Traffic Analyzer database will be backed up to '/opt/var/Traffic Analyzer/'
# TrafficAnalyzer sqldb=/opt/var/TrafficAnalyzer/TrafficAnalyzer.db-Backup-20180401-060000
# The report/queries will be extracted from the archive/backup database '/opt/var/TrafficAnalyzer/TrafficAnalyzer.db-Backup-20180401-060000'
# TrafficAnalyzer purgeallreset
# The current Traffic Analyzer History database is PURGED of ALL history!!!!! (NOTE: a backup is taken first ;-)