Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
176 user(s) are online (160 user(s) are browsing Forums)

Members: 0
Guests: 176

more...

Support us!

Headlines

 
  Register To Post  

A little speed up....
Not too shy to talk
Not too shy to talk


See User information
Given the nature of the modern web, it seems like many
sites drown visitors with adverts, tracking scripts, etc
etc. Of course, Oddity his quite vulnerable to all this.

Raziel suggested using the "hosts" file in AmigaOS to
sidetrack all those scripts. He also found a site where
they maintain hosts files that will block those web
denizens:

https://github.com/StevenBlack/hosts

Raziel, that smart guy (!!), also came up with a WGet
command line to download the hosts file to your Amiga.

Here's how I hacked all that into my Amiga...

First, get the latest WGet from OSDepot and put it in your
C: dir so you can do the downloading:

http://os4depot.net/index.php?functio ... utility/misc/wget-bin.lha

Then make a copy of your original hosts file, just in case
you want to access all the spammers and web spies (aka
FaceCult) from time to time:

copy DEVS:Internet/hosts DEVS:Internet/hosts.orig

Next, add these lines to your S:network-startup after the
line with "AddNetInterface":

-------------------------

download install latest clean host names file
 wget 
---no-check-certificate https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn-social/hosts -Odevs:Internet/hosts.clean
 
if WARN
  RequestChoice 
"Error" "Failed to download clean hosts file" "Bugger!" type warning
 
else
  
set hostsSize `FILESIZE devs:internet/hosts format "%l"`
  if 
$hostsSize GT 20000 VAL
   
;echo "clean hosts file in use"
   
c:copy devs:Internet/hosts.clean devs:Internet/hosts clone
  endif
  unset 
hostsSize
 
endif

-------------------------

What those lines will do is download the latest & greatest
"clean" hosts file to your Amiga every time you boot up.
Furthermore, they will check to see if you are using the
"clean" file at time and make sure the new version is in
use.

Finally, I set up another little CLI script to toggle my
Amiga between these two hosts files. Just open Notepad and
save these lines to a file ("ToggleCleanHostsFile.cli"?):

-------------------------

set hostsSize `FILESIZE devs:internet/hosts format "%l"`
 if 
$hostsSize GT 20000 VAL
  
clean in use
  
set userPick `requestchoice "ToggleHostFile" "Clean hosts file in use" "OK, leave it|Copy in Original" TIMEOUTSECS 5`
  if 
$userPick eq 0
   c
:copy devs:Internet/hosts.orig devs:Internet/hosts clone
   
rx "address RINGHIO 'RINGHIO APP=TOGGLEHOSTS TITLE=Toggle_hosts: Orig hosts file installed'"
  
endif
 else
  ; 
orig in use
  
set userPick `requestchoice "ToggleHostFile" "Original hosts file in use" "OK, leave it|Copy in Clean" TIMEOUTSECS 5`
  if 
$userPick eq 0
   c
:copy devs:Internet/hosts.clean devs:Internet/hosts clone
   
rx "address RINGHIO 'RINGHIO APP=TOGGLEHOSTS TITLE=Toggle_hosts: Clean hosts file installed'"
  
endif
 endif 
 unset 
hostsSize
 
unset userPick

-------------------------

Then you just go into and WBInfo on this CLI script file
and set these things to make it run with a double-click or
from AmiDock:

"Script" bit =          checked
"Default Tool" =        C:Execute 
"Start from:" =         Shell
"Prompt for input:" =   not checked

Then you can drag'n'drop this icon into AmiDock and you
have a simple way to check which host file you're running
and to switch it with one click.

Just to give you a sense for what difference I found this
change makes, here are some times for fully (almost)
loading a webpage:

http://www.autoblog.com/news/?icid=autoblog|news|latest
original hosts file = 22.5 secs
clean hosts file = 11.7 secs

"Almost" = without blocking the spammer hosts, there are
often sockets that constantly appear to be left open -
watching whether you're seeing the adverts?

One other little fringe benefit with this hack: when you
quit Oddity, you run into far fewer DSI's and "child
process unresponsive" messages.

Have fun,

PJS


Go to top
Re: A little speed up....
Just can't stay away
Just can't stay away


See User information
Thanks !

But what if I already have some hosts set (to reach other home computers) ? They will be deleted

--
AmigaONE X1000 and Radeon RX 560
Go to top
Re: A little speed up....
Not too shy to talk
Not too shy to talk


See User information
It should be possible to append the new hosts file onto your original, which will then retain your existing hosts setup.

(NOTE: I haven't tried this...)
Try something like this alternative to the copy line in the network-startup script:

c:Type devs:Internet/hosts.clean >>devs:Internet/hosts

Go to top
Re: A little speed up....
Not too shy to talk
Not too shy to talk


See User information
Hey guys,

Yeah, this little trick, as coded, isn't going help any
local hosts you might have set up. But who does such
things? ;D

I guess adding the Join command after downloading the new
hosts file could concatenate the "clean" hosts to your
original file... I think. hmmm

...or you could use your router to set up your local hosts
for all LAN machines. ;)

Thanks,

PJS

Go to top
Re: A little speed up....
Just can't stay away
Just can't stay away


See User information
I may be doing something wrong but none of your script works :

In Network-startup

http://www.amiga-ng.org/resources/ScriptsErrors.jpg

The second script to test the host file :

http://www.amiga-ng.org/resources/ScriptsErrors2.jpg

http://www.amiga-ng.org/resources/ScriptsErrors3.jpg

--
AmigaONE X1000 and Radeon RX 560
Go to top
Re: A little speed up....
Not too shy to talk
Not too shy to talk


See User information
Indeed! There's something messed up with the simple
texts and how they're getting pasted or copied back off
these webpages.

:/

At this link you'll find a proper LHA file with the two
texts - the excerpt to add into S:Network-Startup and the
Toggle script (with icon!):

http://www.pjsa.net/hostsTricks.lha

That should make things easier... ;)

Good luck,

PJS

Go to top
Re: A little speed up....
Just can't stay away
Just can't stay away


See User information
Thanks !

It works but I only get an empty host file (0 byte). Weird.

I tried the wget command in a cli and I also get an empty file.

Go to top
Re: A little speed up....
Not too shy to talk
Not too shy to talk


See User information
@K-L

At the risk of being difficult, did you install the
latest WGet from OS4Depot (URL above)?

What about going to the guy's page and making sure you
can download the linked files. Maybe Le Republique doesn't
want you blocking spammers? ;)

Otherwise, I just don't know what to say.

I've been running this for a month or two and its been
work rather well.

hmmm....

PJS


Go to top
Re: A little speed up....
Just can't stay away
Just can't stay away


See User information
I found the culprit : wget OS4 1.12

68k version of wget works flawlessly but the OS4 versions gives me 0 byte files. I get the same result when using wget OS4 with SmTube.

I'll have to find an older version of wget OS4.

--
AmigaONE X1000 and Radeon RX 560
Go to top
Re: A little speed up....
Not too shy to talk
Not too shy to talk


See User information
Wow!

You were running the "1.12rev2" version from OS4Depot?
If so, maybe you should start a new thred on this here
so kas1e sees it and can maybe help.

Is this happening on OS4.1 FE or?

I wonder whether there's some OS dependency at issue.

hmmm...

PJS

Go to top
Re: A little speed up....
Just can't stay away
Just can't stay away


See User information
Yep, the latest version (1.12rev2) on AmigaOS 4.1 Final Eidtion Update 1.

Same result both on my Sam440 and my X1000.

I'll try to contact Diego or Kas1e

--
AmigaONE X1000 and Radeon RX 560
Go to top
Re: A little speed up....
Home away from home
Home away from home


See User information
@K-L,pjs
To be honest i do not remember if it me port that, but as homepage point out on http://amiga.sourceforge.net/, then probably 6 years ago i just upload it with Diego's bless. Currently http://amiga.sourceforge.net/ offline, so we can't check if there was something new after ..

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: A little speed up....
Just can't stay away
Just can't stay away


See User information
Here is the culprit :

Resolving raw.githubusercontent.com... 151.101.120.133
Connecting to raw
.githubusercontent.com|151.101.120.133|:443... connected.
OpenSSLerror:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure
Unable to establish SSL connection
.


I'm using AmiSSL 4.1 (latest version).

Edited : ok, solved with setenv amissl/ssl_client_version tls1


Edited by K-L on 2018/2/16 21:45:41
Go to top
Re: A little speed up....
Home away from home
Home away from home


See User information
@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! --- Installed20180102 --- Web20180117
hosts              
--> UPDATED! --- Installed20180202 --- Web20180220
pci
.ids            --> Not Updated! --- ReasonNo Additions! --- Installed20180219 --- Web20180219


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 $VERWBLUpdater.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

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project