NoAdvert.NLM proxy server redirector

http://www.penguin.cz/~mhi/noadvert/

Please note that this page has not been update for a long time and I this project is absoultely dead. If you want to continue it, feel free to download sources and add your own features...

1. Introduction

Advertisement on the web is a really big problem. Every time you access web page with adv. banner(s) your browser downloads them. It means that your browser must connect every time to webserver and load about 50KB gif image. That is not good, even if you have fast connection. Looking for a solution?

Noadvert.NLM is HTTP/1.0 proxy server redirector for Novell NetWare 4.1+. This program blocks requests for advertisement images and sends your own image instead of adv. banner (for example "There was a banner"). Noadvert.NLM decides which URL is banner or not from rule file. You are not limited to block only advertisement, for example you can deny xxx-related sites. Or (if you want) you can stop whole proxy server.

2. License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

3. Installation

Installation is very simple:
  1. Download noadvert.nlm package from http://www.tdp.cz/martin/noadvert/ and extract it to sys:\noadvert directory on your netware server (e.g. pkunzip noadvert.zip x:\noadvert).
  2. Add "load sys:\noadvert\noadvert.nlm" to you server startup files (e.g. sys:\system\autoexec.ncf).
  3. Create configuration file sys:\etc\noadvert.cfg. You can edit example configuration file sys:\noadvert\noadvert.cfg. For more information about configurtion file syntax see chapter Configuration file
  4. Load NoAdvert.nlm from server console (load sys:\noadvert\noadvert.nlm)
  5. Then configure your browser to use new proxy server.
    Setting proxy: Netscape navigator for OS/2
  6. Try that everything works fine!

4. Configuration file

Configuration file sys:\etc\noadvert.cfg is a simple text file and you can edit it using any text editor (vi, norton editor, ...etc). Each line begining with '#' is comment, blank lines are ignored. See following table:
OptionDescription
Port [number] Specifies port on which noadvert.nlm is listening for incoming connectios.
ProxyServer [ip address] Specifies you HTTP/1.0 proxy server which will noadvert.nlm use. NoAdvert.NLM is not itself proxy server, it's only redirector.
ProxyPort [number] Specifies proxy server port. See ProxyServer option.
StatusURL http://[url] Configuration and status page URL. You can see some statistics and stop noadvert on this page.
StatusPassword [username:password] Username and password for status page. Your browser will ask you for this when you visit status page for the first time. DO NOT LEAVE THERE DEFAULT PASSWORD, CHANGE IT!
AccessLog [filename] Noadvert.NLM can log every accessed page to log file. You can use printf(1) like formatting to include date,time or IP address Accepted formatting strings are:
  • %% - '%' character
  • %a - Client's IP address (0a00001, hex)
  • %d - Day (25)
  • %m - Month (03)
  • %y - Year (03, last two digits)
  • %Y - Year (2003)
  • %h - Hour (11)
  • %n - Minute (21)
  • %s - Second (55)
Example: SYS:\NOADVERT\LOGS\%Y\%m\%d-%h.log

Note: Noadvert.NLM creates non-existing log directories or files automatically. All log file writes are cached.

Directory [dir] Noadvert's working directory.
Fail [exp] [file] This is the most interresting command. It blocks specified url [exp] and replaces it with *LOCAL* file [file]. You can use wildcards (? and *) in expression [exp] (Example: Fail http://ad.banners.net/img/* noadv.gif). If no local file is specified Noadvert.NLM sends default text/html page.
Mime [extension] [type/subtype] Specifies mime type for extension.

4. Example configuration file


# --[ My port ]-----------------------------------------------------------
Port 8081

# --[ Remote proxy ]------------------------------------------------------
ProxyServer 194.196.124.32  # Change this!
ProxyPort 8080

# --[ Status page ]-------------------------------------------------------
StatusURL http://proxy-status/
StatusPassword noadvert:secretpass

# --[ Misc ]--------------------------------------------------------------
Directory SYS:\NOADVERT
AccessLog sys:\noadvert\logs\%Y\%d\%h.log

# --[ Blocked sites ]-----------------------------------------------------
Fail http://ad.*                1x1.GIF
Fail http://ads.*               1x1.GIF


# --[ Mime types ]--------------------------------------------------------
Mime    .gif    image/gif
Mime    .jpg    image/jpeg
Mime    .jpeg   image/jpeg
Mime    .htm    text/html
Mime    .html   text/html

5. Status page

Noadvert.nlm status page
This is on-the-fly generated page. You can see some statistics here. Item "failed urls" is false because of real banners are reloaded every time you access web page, whereas noadvert's images are saved in browser cache.

When you change configuration file, you can reload it using "Reload configuration file" link from this page". You cannot change proxy server or port this way. To change proxy server or port unload and reload noadvert.nlm from server console.

You can stop whole proxy-redirector by form at the bootom of page. If you are malicious admin you can enter here some silly message for users ;-)

6. That's cool. How does it work?

Noadvert.NLM is really simple program. Source code in C has about 50KBytes. It's ordinary multi-threading NetWare Loadable Module which listens for incoming connections on specified port and forwards non-blocked HTTP requests to your neighbouring proxy-server (e.g. squid). Blocked requests are served locally. Each connection has it's own thread which is mostly blocked by read/write call function. This cause low server utilization. If you need more info, see source code. It's freely (Ooops, it's GNU) available on the web.

7. Download

If you agree with the GNU License you can download noadvert.nlm here:

noadvsrc.zip - 46k - source code in C
noadvbin.zip - 17k - binary NLM file + cfg


Date:05/16/99

Written by Martin Hinner, <mhi(at)penguin(dot)cz>.
Last updated in December 2004.
If you want to contact me, please read this page.