@pjs
You give me far too much credit, mate, but thank you for the flowers
There are two things i changed since the time i glued that hacky stuff together which you might want to take into consideration.
1) I canned WGet in favour of cURL
Reason a:
WGet is too old, it can't do what i needed it to do and is still not working with https: sites (probably needs a recompile with AmiSSL4), unless one circumvents the savety by using --no-check-certificate
Reason b:
cURL doesn't have that limitations
2) I hacked together an AREXX script, which will take care of the randomly changed/updated files of HOSTS, pci.ids and ca-bundle.crt.
- It checks for new versions of said files and only if they were changed/updated downloads and installs them (faster and more economical than fully downloading an already installed file - makes it faster on reboots, aswell)
- It will update all instances of said files in their corresponding destinations (user enhancable/changable, albeit not user friendly - one has to add personal destinations to the corresponding lines, respectively add those lines to the script)
- It will write a really small text file to T: (four lines) where the user can check if the files has been updated...or not.
Without the need to load the files.
It looks like this:
Wednesday 21.02.2018 08:10:00
curl_ca_bundle.crt --> UPDATED! --- Installed: 20180102 --- Web: 20180117
hosts --> UPDATED! --- Installed: 20180202 --- Web: 20180220
pci.ids --> Not Updated! --- Reason: No Additions! --- Installed: 20180219 --- Web: 20180219
Known Bugs:
- It sometimes "freezes" the workbench for some minutes on the first boot...seems to be the HOSTS file not being updated on the first run, or rather a bug in the script...investigating.
I haven't released it anywhere due to it's "special" nature of use and the above mentioned "bug". Works great for my everyday use, though.
And it doesn't clutter up the network-startup sequence with dozens of lines, looks clean
Quote:
; $VER: Network-Startup 53.2 (01.06.2011)
AddNetInterface QUIET DEVS:NetInterfaces/~(#?.info)
; Add below this line applications that need a running network
Date SERVER 192.168.178.1 >NIL:
SetClock SAVE
rx Tools:System/Scripts/WBLUpdater.rx
I also use it to amend my personal IP-List to the HOSTS file, so i can access all my LAN stuff with names instead of IP addresses.
If anyone wants to look at it, use it, fix bugs, enhance it or make fun of my AREXX scripting...here it is
* WBLUpdater.rx $VER: WBLUpdater.rx 1.03 (31.12.2017) */
/* This script checks for installed versions of below mentioned files and updates
them, if needed, automatically. It does this by checking both the web based
and installed file dates and acts accordingly. (If a file is not installed,
it will do that too.
Note to self: It's called "Web based Lists Updater" <- What a name! :-D
Supported file list: curl-ca-bundle.crt, HOSTS, pci.ids
1.0: Initial versions to make it "just" run
1.01: Complete rewrite, because the initial version was crap :-)
1.02: Added log file (T:) to reflect the status
1.03: Added more information to the log
TODO:
- Check for the existance of files first and, if missing, install it right away
without the need of going through the check loops.
- Enhance log for corrupted files (check day for sane dates from 1-31)
- Rewrite to use variables for pathes and filenames
- Add a macro for the month conversion via CALL() (possible, see variables?) */
ADDRESS COMMAND 'date >> T:WBLUpdater.log'
/* Month conversion index */
months="Jan01Feb02Mar03Apr04May05Jun06Jul07Aug08Sep09Oct10Nov11Dec12"
/* cURL_ca_bundle
Pulling the web based file date*/
ADDRESS COMMAND 'curl -r84-104 -s --cacert DEVS:curl-ca-bundle.crt "https://curl.haxx.se/ca/cacert.pem" >T:cURL_ca_bundle_date'
OPEN(curlca,'T:curl_ca_bundle_date','R')
date_munged=READLN(curlca)
CLOSE(curlca)
ADDRESS COMMAND 'Delete T:curl_ca_bundle_date'
/* Converting the month */
date_day=SUBWORD(date_munged,2,1)
date_munged_month=SUBWORD(date_munged,1,1)
month_idx=INDEX(months,date_munged_month)
IF month_idx > 0 THEN
date_month=SUBSTR(months,month_idx+3,2)
date_year=SUBWORD(date_munged,4,1)
date_web=COMPRESS(date_year date_month date_day)
/* Pulling the installed file date */
OPEN(curlca,'DEVS:curl-ca-bundle.crt','R')
READLN(curlca)
READLN(curlca)
READLN(curlca)
date_munged=SUBWORD(READLN(curlca),9,4)
CLOSE(curlca)
/* Converting the month */
date_day=SUBWORD(date_munged,2,1)
date_munged_month=SUBWORD(date_munged,1,1)
month_idx=INDEX(months,date_munged_month)
IF month_idx > 0 THEN
date_month=SUBSTR(months,month_idx+3,2)
date_year=SUBWORD(date_munged,4,1)
date_installed=COMPRESS(date_year date_month date_day)
/* Updating the file and copying it to the known places where it's used from */
IF date_web > date_installed THEN DO
ADDRESS COMMAND 'curl -s --cacert DEVS:curl-ca-bundle.crt "https://curl.haxx.se/ca/cacert.pem" -o DEVS:curl-ca-bundle.crt'
ADDRESS COMMAND 'copy DEVS:curl-ca-bundle.crt Tools:Internet/Netsurf/Resources/ca-bundle'
ADDRESS COMMAND 'copy DEVS:curl-ca-bundle.crt Tools:Internet/YAM/Resources/ca-bundle.crt'
ADDRESS COMMAND 'echo "curl_ca_bundle.crt --> UPDATED!" --- Installed:' date_installed ' --- Web:' date_web '>> T:WBLUpdater.log'
END
ELSE
ADDRESS COMMAND 'echo "curl_ca_bundle.crt --> NOT updated!" --- Reason: No additions! --- Installed:' date_installed ' --- Web:' date_web '>> T:WBLUpdater.log'
/* HOSTS
Pulling the web based file date */
ADDRESS COMMAND 'curl -r127-142 -s --cacert DEVS:curl-ca-bundle.crt "https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts" >T:hosts_date'
OPEN(hosts,'T:hosts_date','R')
date_munged=READLN(hosts)
CLOSE(hosts)
ADDRESS COMMAND 'Delete T:hosts_date'
/* Converting the month */
date_day=SUBWORD(date_munged,2,1)
date_munged_month=SUBSTR(date_munged,1,3)
month_idx=INDEX(months,date_munged_month)
IF month_idx > 0 THEN
date_month=SUBSTR(months,month_idx+3,2)
date_year=SUBWORD(date_munged,3,1)
date_web=COMPRESS(date_year date_month date_day)
/* Pulling the installed file date */
OPEN(hosts,'DEVS:Internet/HOSTS','R')
READLN(hosts)
READLN(hosts)
READLN(hosts)
date_munged=SUBWORD(READLN(hosts),3,3)
CLOSE(hosts)
/* Converting the month */
date_day=SUBWORD(date_munged,2,1)
date_munged_month=SUBSTR(date_munged,1,3)
month_idx=INDEX(months,date_munged_month)
IF month_idx > 0 THEN
date_month=SUBSTR(months,month_idx+3,2)
date_year=SUBWORD(date_munged,3,1)
date_installed=COMPRESS(date_year date_month date_day)
/* Updating the file and adding the known local ip addresses */
IF date_web > date_installed THEN DO
ADDRESS COMMAND 'curl -s --cacert DEVS:curl-ca-bundle.crt "https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts" -o DEVS:Internet/HOSTS'
ADDRESS COMMAND 'type Tools:Internet/Network/IP-List >> DEVS:Internet/HOSTS'
ADDRESS COMMAND 'echo "hosts --> UPDATED!" --- Installed:' date_installed ' --- Web:' date_web '>> T:WBLUpdater.log'
END
ELSE
ADDRESS COMMAND 'echo "hosts --> NOT updated!" --- Reason: No additions! --- Installed:' date_installed ' --- Web:' date_web '>> T:WBLUpdater.log'
/* pci.ids
Pulling the web based file date */
ADDRESS COMMAND 'curl -r56-65 -s --cacert DEVS:curl-ca-bundle.crt "https://pci-ids.ucw.cz/v2.2/pci.ids" >T:pci.ids_date'
OPEN(pci.ids,'T:pci.ids_date','R')
date_web=COMPRESS(READLN(pci.ids),'-')
CLOSE(pci.ids)
ADDRESS COMMAND 'Delete T:pci.ids_date'
/* Pulling the installed file date */
OPEN(pci.ids,'DEVS:pci.ids','R')
READLN(pci.ids)
READLN(pci.ids)
READLN(pci.ids)
READLN(pci.ids)
date_installed=COMPRESS(SUBWORD(READLN(pci.ids),2,1),'-')
CLOSE(pci.ids)
/* Updating the file and copying it to the known places where it's used from */
IF date_web > date_installed THEN DO
ADDRESS COMMAND 'curl -s --cacert DEVS:curl-ca-bundle.crt "https://pci-ids.ucw.cz/v2.2/pci.ids" -o DEVS:pci.ids'
ADDRESS COMMAND 'echo "pci.ids --> UPDATED!" --- Installed:' date_installed ' --- Web:' date_web '>> T:WBLUpdater.log'
END
ELSE
ADDRESS COMMAND 'echo "pci.ids --> NOT updated!" --- Reason: No additions! --- Installed:' date_installed ' --- Web:' date_web '>> T:WBLUpdater.log'
EXIT