Code:
./WebHistory_Report.sh date=2019/05
Processing '/jffs/.sys/WebHistory/WebHistory.db' database....please wait!
(WebHistory_Report.sh): 24268 v1.12 Web History starting.....
NOTE: Columns in white are eligible for filters; red text indicates a match on the filters requested; (URLs are Xshell5/MobaXterm hyperlinks)
Filter by Date, AND by current hour ==> '2019-05|10:'
YYYY/MM/DD HH:MM:SS MAC address Host Name IP address URL
2019/05/02 10:00:26 AC:XX:XX:XX:XX:XX HP-Envy14 10.88.8.114 http://tps613.doubleverify.com
2019/05/02 10:00:28 AC:XX:XX:XX:XX:XX HP-Envy14 10.88.8.114 http://i.simpli.fi
<snip>
As previously stated, prior to
v384.11 the original pre-reqs for the script was the
Entware 'sqlite3' utility, consequently users had
Entware installed, and this requires a USB disk to be mounted, hence custom scripts can safely use the
Entware filesystem for permanent storage (of potentially large files).
However, I have now added the option for you to override the
'missing' Entware filesystem and specify the directory of your choice - with of course limitations i.e. '/
tmp' is currently not allowed.
e.g.
Code:
./WebHistory_Report.sh backup=/mnt/RT-AC68U
(WebHistory_Report.sh): 18044 '/jffs/.sys/WebHistory/WebHistory.db' backup completed successfully
Also I have added the ability to filter by
MAC, and optionally create a .
csv file.
Code:
./WebHistory_Report.sh date=2019/05 report=web.csv mac=xx:xx:xx:xx:xx
Processing '/jffs/.sys/WebHistory/WebHistory.db' database....please wait!
(WebHistory_Report.sh): 32752 v1.12 Web History starting.....
NOTE: Columns in white are eligible for filters; red text indicates a match on the filters requested; (URLs are Xshell5/MobaXterm hyperlinks)
Filter by Date, AND by MAC, AND by current hour ==> '2019-05|xx:xx:xx:xx:xx|11:'
Report file (.csv format): 'web.csv'
YYYY/MM/DD HH:MM:SS MAC address Host Name IP address URL
2019/05/08 11:00:19 xx:xx:xx:xx:xx HP-Envy14 10.88.8.114 http://20.client-channel.google.com
2019/05/08 11:02:36 xx:xx:xx:xx:xx HP-Envy14 10.88.8.114 http://15.client-channel.google.com
2019/05/08 11:49:02 xx:xx:xx:xx:xx HP-Envy14 10.88.8.114 http://webapps.stackexchange.com
NOTE: If there are many records in the database, and you wish to create a .
csv file, then either of two preferred
fast methods should be used.
i.e. having created the .
csv, then using
grep/awk/sed etc. will allow filtering at
greater speed than displaying the records on the screen.
e.g.
SQL can write
18,458 raw records to the
.csv file
in less than 1 second, and if the script is used (without displaying the records on screen) to format the timestamp field then it still only takes
less than 2 seconds!
Method 1 simply dumps the database records
as-is, with the corresponding column headers:
Code:
./WebHistory_Report.sh report=web.csv noscript nofilter
(WebHistory_Report.sh): 11682 v1.12 Web History starting.....
NOTE: Columns in white are eligible for filters; red text indicates a match on the filters requested; (URLs are Xshell5/MobaXterm hyperlinks)
Filter ALL i.e. no filter ==> ''
Report file (.csv format): 'web.csv'
Total Records = 18458
real 0m 0.89s
user 0m 0.41s
sys 0m 0.49s
Code:
wc -l web.csv
18458 web.csv
Method 2 will convert the timestamp into a more human-friendly format (without column headers)
Code:
./WebHistory_Report.sh report=web.csv nodisplay nofilter
(WebHistory_Report.sh): 4531 v1.12 Web History starting.....
NOTE: Columns in white are eligible for filters; red text indicates a match on the filters requested; (URLs are Xshell5/MobaXterm hyperlinks)
Filter ALL i.e. no filter ==> ''
Report file (.csv format): 'web.csv'
YYYY/MM/DD HH:MM:SS MAC address Host Name IP address URL
***No Display of records on screen requested***
Summary: Result count = 18458
real 0m 1.53s
user 0m 1.03s
sys 0m 0.50s
Code:
wc -l web.csv
18458 web.csv
Please download
v1.12