Sponsored Content
Special Forums IP Networking How to block domains that match a keyword? Post 303009978 by milhan on Saturday 23rd of December 2017 04:31:20 PM
Old 12-23-2017
How to block domains that match a keyword?

I want to know, for internet access, if there is an easy way to filter domain names, on your Linux box, that match certain key(s) without using squid. For example, if you want to block example.com you add the following lines in your /etc/hosts file:
Code:
0.0.0.0  www.example.com
0.0.0.0  example.com
::0      www.example.com
::0      example.com

this will only block the domain example.com. However,
Code:
0.0.0.0  *ample*
0.0.0.0  *ample*
::0      *ample*
::0      *ample*

won't work. I am basically trying to block all domains which contain specific keywords which I provide. Is there a way to get this keyword-match domain filtering work without using squid? Thanks.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

multiple domains

Hello, I have 3 domains virtually hosted "name based" the first one "domain1.com" has its ServerName entered as domain1.com. this domain will load in a browser by www.domain1.com or simply domain1.com. the next two domains "domain2.com" and "domain3.com" ServerNames are listed as domain2.com and... (2 Replies)
Discussion started by: ericg
2 Replies

2. UNIX for Dummies Questions & Answers

blocking domains

Dear All , Kindly note I have sun solaries 7 . I want to block a domain who keep sending emails to my domain and users . thanks (1 Reply)
Discussion started by: tamemi
1 Replies

3. Shell Programming and Scripting

Match keyword on string and substitute under vi

Hi guys, with sed when I need to make a substitution inside a line containing a specific keyword, I usually use: sed '/keyword/ s/cat/dog/g' This will substitute "cat" with "dog" on those lines containing "keyword". Now I want to use this inside vi, for several reason that I cannot... (2 Replies)
Discussion started by: lycaon
2 Replies

4. Shell Programming and Scripting

delete block of lines when pattern does not match

I have this input file that I need to remove lines which represents more than 30 days of processing. Input file: On 11/17/2009 at 12:30:00, Program started processing...argc=7 Total number of bytes in file being processed is 390 Message buffer of length=390 was allocated successfully... (1 Reply)
Discussion started by: udelalv
1 Replies

5. Shell Programming and Scripting

SED, match a line block

Hello, I want to do a simple substitution using sed but I can't find a solution. Basically, from a Apache conf file, I would like to remove everything included between the <VirtualHost> and </VirtualHost> e.g SSLMutex file:/var/run/ssl_mutex <VirtualHost _default_:443> # A lot of config that... (5 Replies)
Discussion started by: RobertFord
5 Replies

6. UNIX for Dummies Questions & Answers

Sub domains from report

Hi, I have a report containing severals organization's email address. The address contain several sub domains, and i need to pull those out. mail domain ( example.com) .................. The report column contain mail address in this format : john1@sub1.example.com... (2 Replies)
Discussion started by: john_prince
2 Replies

7. Shell Programming and Scripting

Using sed to pattern match within a particular multiline block and take action

Hi all, This is my first post, so please go easy if I broke some rules. Not accustomed to posting in forums... :) I'm looking for help on pattern matching within a multiline block and looking to highlight blocks/block-ids that do NOT contain a particular pattern. For example an input file... (5 Replies)
Discussion started by: tirodad
5 Replies

8. Shell Programming and Scripting

Search for a Keyword in file and replace another keyword or add at the end of line

Hi I want to implement something like this: if( keyword1 exists) then check if(keyword2 exists in the same line) then replace keyword 2 with New_Keyword else Add New_Keyword at the end of line end if eg: Check for Keyword JUNGLE and add/replace... (7 Replies)
Discussion started by: dashing201
7 Replies

9. IP Networking

VLANs and their domains

Hey everyone. I work in a data center, and I'm working on getting my CCNA. Now when I read articles on the idea of VLAN's it makes sense. Especially if you have multiple switches daisy chained in multiple locations. My two main questions though are that most of these examples use PC's as examples... (2 Replies)
Discussion started by: Lost in Cyberia
2 Replies

10. Shell Programming and Scripting

awk to match keyword and return matches and unique fields

Trying to use awk to find a keyword and return the matches in the row, but also $1 and $2, which are the unique id's, but they only appear once. Thank you :). file name 31 Index Chromosomal Position Gene Inheritance 122 2106725 TSC2 AD 124 2115481 TSC2 AD 121 2105400 TSC2 AD... (6 Replies)
Discussion started by: cmccabe
6 Replies
AMPLE.HTML(5)							    User Manual 						     AMPLE.HTML(5)

NAME
ample.html - html template for Ample DESCRIPTION
This file, by default /etc/ample/ample.html, is read by Ample at startup and used as a base for it's HTML pages. These pages are rendered whenever a webbrowser connects and requests a list of available songs and directories (typically done by connecting to http://server:port/index.html). The file is divided into three sections, the header, the middle and the footer. The header and the footer are the same on each page gener- ated while the "middle" is copied into the final HTML document once for each file or directory that is going to be listed. Although this may sound confusing, it will probably become much more evident once you look at the example below. Variables are written in uppercase and enclosed within "at" signs (example: @NAME@) and are replaced dynamically when the page is con- structed. Some variables can exist anywhere in the document and some can only exist in the "middle" section, see the information about each variable for details. EXAMPLE
<!-- Beginning of header --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head> <title>@SERVERNAME@</title> </head><body> <center> <p><h1>@SERVERNAME@</h1></p> <p><h2>Tracks currently available in @PATH@</h2></p> <p><font size="-1">[ <a href="index.m3u">playlist for this dir</a> | <a href="rindex.m3u">recursive playlist</a> ] </font></p> <p><font size="-1"> [ <a href="../index.html">Up one level</a> ] </font></p> <div align="center"> <table border="1" cellspacing="0" cellpadding="0" bordercolor="#000000"> <tr><td> <b>TYPE</b> </td><td> <b>URL</b> </td></tr> <!-- End of header --> @BEGIN@ <!-- Beginning of "middle" --> <tr><td> @TYPE@ </td><td> <a href="@URL@">@NAME@</a> </td></tr> <!-- End of "middle" --> @END@ <!-- Beginning of footer --> </table> </div> <p align="right"><font size="-1"> powered by Ample, for more information, see the <a href="http://ample.sourceforge.net">project homepage</a> </font></p> </center> </body> </html> <!-- End of footer --> SUMMARY OF VARIABLES
SPECIAL - Only used once BEGIN END GLOBAL - Can be used anywhere SERVERNAME PORT PATH NON-GLOBAL - Can only be used in the "middle" section NAME URL LENGTH TITLE SIZE TYPE SPECIAL VARIABLES
These can only be used once. BEGIN This variable (when placed in the beginning of a new line) marks the end of the header section and the start of the "middle" sec- tion. END This variable (when placed in the beginning of a new line) marks the end of the "middle" section and the start of the footer sec- tion. GLOBAL VARIABLES
These can be used anywhere. SERVERNAME The name of the server as given in ample.conf(5). PORT The port that the server is listening to. PATH The current path the user is viewing. NON-GLOBAL VARIABLES These can only be used in the "middle" section. NAME The name of the song or directory. URL The URL of the song or directory. LENGTH The song length (in seconds) or blank if it is a directory. TITLE The title of the song or "DIR" if it is a directory. SIZE The file size or blank if it is a directory. TYPE "FILE" if it is a file or "DIR" if it is a directory. AUTHOR
David Hardeman <david@2gen.com> SEE ALSO
ample(1), ample.conf(5) Ample JANUARY 2002 AMPLE.HTML(5)
All times are GMT -4. The time now is 02:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy