This file is indexed.

/usr/lib/nanoweb/modules/mod_blockadm.php is in nanoweb 2.2.9-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
<?php

/*

Nanoweb ip blocking administration helper module
================================================

Copyright (C) 2002-2005 Vincent Negrier aka. sIX <six@aegis-corp.org>

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 2, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

class mod_blockadm {

	var $modtype = "url";
	var $modname = "ip address blocking admin helper";
	var $urls = array("/blockadm");
	
	function adm_allowed() {

		global $conf, $remote_ip;
		
		foreach ($conf["global"]["blockadmallowip"] as $allowed) if (($remote_ip === $allowed) || ((substr($remote_ip, 0, strlen($allowed) - 1) . "*") === $allowed)) return true;

		return false;
	
	}
	
	function url(&$rq_err, &$out_coutenttype, &$add_headers) {

		global $query_string;
		
		if ($this->adm_allowed()) {

			$rq_err = 200;
			$out_contenttype = "text/plain";
			
			parse_str($query_string, $params);

			if (!$params["addr"]) {

				return "ERROR: you must specify an IP address to block or unblock";

			}

			if (strtolower($params["dur"]) == "perm") {

				$type = "PERM";
				$expires = 0;

			} else {

				$type = "TEMP";
				$expires = time() + ($params["dur"] ? $params["dur"] : 3600);

			}

			switch (strtolower($params["act"])) {

				case "unblock":
				
				nw_unblock_ip_address($params["addr"], "mod_blockadm");
				
				$msg = "mod_blockadm : unblocked IP address ".$params["addr"];
				
				break;

				
				case "block":
				default:

				nw_block_ip_address($params["addr"], $type, "mod_blockadm", $expires);
				
				$msg = "mod_blockadm : blocked IP address ".$params["addr"]." (".strtolower($type).")";

				break;
			
			}
			
			return $msg;

		} else {

			$rq_err = 404;

			return false;
		
		}
		
	}

}

?>