#!/bin/sh curl https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts |grep '^0\.0\.0\.0' | awk '{print "local-zone: \""$2"\" redirect\nlocal-data: \""$2" A 0.0.0.0\""}' > ads.conf #### local-zone: "apps.id.net" redirect local-data: "apps.id.net A 0.0.0.0" #### #!/usr/bin/perl use strict; use warnings; use LWP::Simple; my $url = "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"; open(my $file, '>', 'ads.conf') or die "wtfile?"; for (split /^/, get ($url)) { if ($_ =~ /0\.0\.0\.0/ and $_ !~ /#/){ $_ =~ s/0\.0\.0\.0 //; $_ =~ s/\n//; print $file "local-zone: \"" . $_ . "\" redirect\nlocal-data: \"" . $_ . " A 0.0.0.0\"\n"; } } close $file; #### #!/usr/bin/perl use strict; use warnings; use LWP::Simple; my $url = "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"; open(my $file, '>', 'ads.conf') or die "wtfile?"; for (split /^/, get ($url)) { if ($_ =~ /^\Q0.0.0.0\E (.*)$/){ print $file "local-zone: \"" . $1 . "\" redirect\nlocal-data: \"" . $1 . " A 0.0.0.0\"\n"; } #### #!/usr/bin/perl use strict; use warnings; my $_url = "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"; open(my $file, '>', 'ads.conf') or die "wtfile?"; my $var = `curl $_url` or die "wturl?"; while($var =~ /(\n0\.0\.0\.0)(\s)([\w\.]+?)\s+/g){ print $file "local-zone: \"" . $3 . "\" redirect\nlocal-data: \"" . $3 . " A 0.0.0.0\"\n"; } close $file;