Moduuli:Ipcheck

Wikipediasta
Siirry navigaatioon Siirry hakuun

Tämän moduulin ohjeistuksen voi tehdä sivulle Moduuli:Ipcheck/ohje

-- Moduuli luo väärinkäyttösuodatinta varten seurantalinkin usein estetyille IP:lle.

local ipcheck = {};
function ipcheck.ipcheck(frame)
	local timestamp = frame:preprocess( "{{REVISIONTIMESTAMP}}");	
	local revisionuser = frame:preprocess( "{{REVISIONUSER}}");	
	local link_str_1="<span class='af_tests' >[https://tools.wmflabs.org/fiwiki-tools/AF1 AF1]</span>";
	local link_str_2="<span class='af_tests' >[https://tools.wmflabs.org/fiwiki-tools/AF2 AF2]</span>";	

	local short_ip={string.match( revisionuser,  "^([0-9]+[.][0-9]+[.][0-9]+[.])")};
	if short_ip then
		local short_ip=short_ip[1];
		local iplist=ipcheck._getIpGroups();
		for _,v in pairs(iplist) do
	    	if v == short_ip then
	    		return link_str_1;
	    	end
		end

		local iplist=ipcheck._getIpList();
		for _,v in pairs(iplist) do
	    	if v == revisionuser then
	    		return link_str_1;
	    	end
		end
	else 
		local user_matches=ipcheck._getUserMatches();
		for _,v in pairs(user_matches) do
			local user_test=string.find( revisionuser,  v);
			if user_test then
				return link_str_2;
			end
		end
	end
	return ":" .. revisionuser ..":" .. timestamp ..":" ;
end

function ipcheck._getUserMatches()
	local iplist={
		"Zache"
	};
	return iplist;
end

function ipcheck._getIpGroups()
	local iplist={
		"62.148.100.",
		"91.153.64.",
		"137.163.16.",
		"137.163.18.",
		"194.100.50."
	};
	return iplist;
end

function ipcheck._getIpList()
	local iplist={
		"Zache",
		"91.153.64.176",
		"194.100.27.19",
		"185.120.51.241", 
		"31.172.155.197", 
		"31.172.157.46",
		"31.172.157.70",
		"31.172.157.80",
		"31.172.158.142",
		"31.172.158.6",
		"37.16.124.17",
		"37.35.17.22",
		"46.163.249.200",
		"46.163.255.10",
		"46.23.169.98",
		"62.106.62.95",
		"62.106.63.90",
		"62.121.55.194",
		"62.183.142.12",
		"62.183.149.235",
		"62.183.149.239",
		"62.183.182.253",
		"62.183.188.122",
		"62.183.250.194",
		"62.197.182.161",
		"62.197.182.7",
		"62.236.215.16",
		"62.44.246.1",
		"62.78.97.138",
		"62.80.150.202",
		"77.105.91.86",
		"77.109.232.164",
		"77.109.232.165",
		"77.109.239.137",
		"79.141.146.132",
		"80.223.27.15",
		"80.246.166.130",
		"80.246.167.130",
		"80.246.169.130",
		"80.248.103.57",
		"80.248.113.212",
		"80.95.139.146",
		"80.95.139.66",
		"81.175.160.250",
		"81.209.26.4",
		"81.209.102.102",
		"81.209.105.102",
		"81.209.107.103",
		"82.116.226.36",
		"82.116.226.37",
		"82.116.249.73",
		"82.116.249.75",
		"82.128.139.224",
		"82.128.139.239",
		"82.128.139.240",
		"82.141.96.3",
		"82.141.97.194",
		"82.141.100.12",
		"82.141.106.90",
		"82.197.2.14",
		"82.197.2.9",
		"82.197.31.180",
		"82.197.31.188",
		"82.215.206.24",
		"83.146.208.237",
		"83.146.217.226",
		"83.146.246.48",
		"83.148.193.226",
		"83.148.194.30",
		"83.148.248.114",
		"83.148.248.21",
		"83.148.248.84",
		"84.251.150.153",
		"84.34.16.82",
		"85.131.56.203",
		"85.157.207.194",
		"85.157.248.131",
		"85.194.217.234",
		"85.194.217.252",
		"85.194.217.253",
		"86.115.240.34",
		"86.115.240.50",
		"86.115.250.9",
		"86.115.255.22",
		"86.60.142.216",
		"88.85.148.241",
		"88.85.149.66",
		"89.190.0.94",
		"89.190.1.203",
		"89.236.126.131",
		"91.150.5.250",
		"91.150.44.26",
		"91.153.197.205",
		"91.155.142.110",
		"91.157.180.55",
		"91.217.116.81",
		"109.204.130.158",
		"109.204.229.70",
		"137.163.19.128",
		"137.163.31.146",
		"137.163.31.151",
		"137.163.31.153",
		"137.163.31.165",
		"143.51.145.244",
		"143.51.145.6",
		"143.51.146.3",
		"143.51.147.131",
		"143.51.147.68",
		"143.51.147.70",
		"178.16.178.228",
		"178.16.178.237",
		"185.25.200.151",
		"185.25.200.155",
		"185.38.2.2",
		"192.130.44.31",
		"192.194.253.92",
		"192.89.32.217",
		"192.89.77.167",
		"192.89.77.224",
		"192.98.76.12",
		"193.106.11.171",
		"193.106.11.212",
		"193.106.11.239",
		"193.106.11.246",
		"193.106.11.248",
		"193.110.110.4",
		"193.111.119.208",
		"193.111.119.212",
		"193.111.119.213",
		"193.111.119.214",
		"193.111.119.216",
		"193.111.119.217",
		"193.142.2.12",
		"193.143.239.108",
		"193.143.239.98",
		"193.167.65.94",
		"193.167.81.242",
		"193.184.119.2",
		"193.185.137.35",
		"193.208.186.40",
		"193.211.223.178",
		"193.229.146.4",
		"194.100.240.189",
		"194.111.70.137",
		"194.111.70.34",
		"194.111.70.50",
		"194.111.119.63",
		"194.111.172.10",
		"194.117.170.245",
		"194.137.151.1",
		"194.137.195.5",
		"194.137.195.6",
		"194.157.14.226",
		"194.157.37.59",
		"194.157.67.82",
		"194.157.230.97",
		"194.197.54.63",
		"194.197.62.31",
		"194.211.118.1",
		"194.211.118.16",
		"194.211.118.17",
		"194.211.118.18",
		"194.215.43.161",
		"194.215.159.125",
		"194.252.61.120",
		"194.252.152.9",
		"194.8.226.186",
		"194.8.227.17",
		"194.8.227.35",
		"194.89.114.42",
		"194.89.228.100",
		"194.89.228.107",
		"195.156.48.170",
		"195.156.81.3",
		"195.156.95.194",
		"195.156.146.1",
		"195.156.173.250",
		"195.156.204.42",
		"195.156.244.135",
		"195.165.32.178",
		"195.236.123.25",
		"195.236.123.53",
		"195.236.123.56",
		"195.237.116.129",
		"195.237.116.132",
		"195.237.116.133",
		"195.237.116.139",
		"195.237.116.152",
		"195.237.116.176",
		"195.255.102.2",
		"195.95.208.130",
		"195.95.208.223",
		"212.116.63.206",
		"212.146.14.144",
		"212.146.14.146",
		"212.146.45.78",
		"212.146.61.123",
		"212.213.213.66",
		"212.213.216.212",
		"212.226.141.129",
		"212.246.123.180",
		"212.50.143.2",
		"212.50.193.180",
		"212.50.194.114",
		"212.50.197.56",
		"212.50.199.170",
		"212.50.202.94",
		"212.50.205.235",
		"212.50.208.119",
		"212.50.208.22",
		"212.50.209.126",
		"212.50.210.135",
		"212.50.210.8",
		"212.66.207.102",
		"212.68.10.39",
		"212.86.14.210",
		"212.86.15.124",
		"212.86.17.90",
		"213.130.228.254",
		"213.130.234.253",
		"213.138.128.49",
		"213.138.128.50",
		"213.139.172.180",
		"213.139.172.181",
		"213.139.172.247",
		"213.139.172.250",
		"213.139.172.40",
		"213.139.191.111",
		"213.139.191.112",
		"213.139.191.27",
		"213.139.191.55",
		"213.141.111.161",
		"213.141.126.56",
		"213.143.166.232",
		"213.143.167.4",
		"213.143.171.194",
		"213.214.155.25",
		"213.216.201.44",
		"213.216.217.194",
		"213.250.99.194",
		"213.255.161.141",
		"213.255.161.142",
		"213.255.162.241",
		"213.255.164.57",
		"213.255.165.216",
		"213.255.165.60",
		"213.255.166.12",
		"213.255.169.140",
		"213.255.169.189",
		"213.255.169.34",
		"213.255.177.44",
		"213.255.188.98",
		"213.28.140.29",
		"217.130.247.195",
		"217.152.60.84",
		"217.152.60.85",
		"217.152.116.140",
		"217.152.133.246",
		"217.152.133.247",
		"217.152.133.248"
		};
	return iplist;
end

return ipcheck;