<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASensitive_IP_addresses%2Fsummary</id>
	<title>Module:Sensitive IP addresses/summary - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASensitive_IP_addresses%2Fsummary"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sensitive_IP_addresses/summary&amp;action=history"/>
	<updated>2026-05-11T22:44:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Sensitive_IP_addresses/summary&amp;diff=146717&amp;oldid=prev</id>
		<title>imported&gt;Mr. Stradivarius: Protected &quot;Module:Sensitive IP addresses/summary&quot;: High-risk Lua module: used in the MediaWiki interface, e.g. MediaWiki:Blockiptext via Template:Sensitive IP addresses ([Edit=Require administrator access] (indefi...</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sensitive_IP_addresses/summary&amp;diff=146717&amp;oldid=prev"/>
		<updated>2016-11-23T09:28:42Z</updated>

		<summary type="html">&lt;p&gt;Protected &amp;quot;&lt;a href=&quot;/research/Module:Sensitive_IP_addresses/summary&quot; title=&quot;Module:Sensitive IP addresses/summary&quot;&gt;Module:Sensitive IP addresses/summary&lt;/a&gt;&amp;quot;: &lt;a href=&quot;/index.php?title=WP:High-risk_templates&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:High-risk templates (page does not exist)&quot;&gt;High-risk Lua module&lt;/a&gt;: used in the MediaWiki interface, e.g. &lt;a href=&quot;/research/MediaWiki:Blockiptext&quot; title=&quot;MediaWiki:Blockiptext&quot;&gt;MediaWiki:Blockiptext&lt;/a&gt; via &lt;a href=&quot;/index.php?title=Template:Sensitive_IP_addresses&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Template:Sensitive IP addresses (page does not exist)&quot;&gt;Template:Sensitive IP addresses&lt;/a&gt; ([Edit=Require administrator access] (indefi...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local mSIPA_API = require(&amp;#039;Module:Sensitive IP addresses/API&amp;#039;)&lt;br /&gt;
local yesno = require(&amp;#039;Module:Yesno&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Strips a suffix from a CIDR string if the suffix is of a given bitLength.&lt;br /&gt;
-- bitLength must be either 32 or 128.&lt;br /&gt;
-- This is intended to allow CIDR strings to be represented as a single IP&lt;br /&gt;
-- address if this can be done unambiguously.&lt;br /&gt;
local function stripCIDRSuffix(cidr, bitLength)&lt;br /&gt;
	assert(bitLength == 32 or bitLength == 128, &amp;#039;bitLength was not 32 or 128&amp;#039;)&lt;br /&gt;
	local pattern = &amp;#039;/&amp;#039; .. bitLength .. &amp;#039;$&amp;#039;&lt;br /&gt;
	cidr = cidr:gsub(pattern, &amp;#039;&amp;#039;)&lt;br /&gt;
	return cidr&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Takes an array of CIDR ranges and returns a new array with ranges&lt;br /&gt;
-- appropriate for printing.&lt;br /&gt;
local function prettifyRanges(ranges, bitLength)&lt;br /&gt;
	local ret = {}&lt;br /&gt;
	for i, cidr in ipairs(ranges) do&lt;br /&gt;
		ret[i] = stripCIDRSuffix(cidr, bitLength)&lt;br /&gt;
	end&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Turns an array of CIDR ranges into its string representation.&lt;br /&gt;
local function stringifyRanges(ranges, bitLength, separator)&lt;br /&gt;
	if not ranges then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	ranges = prettifyRanges(ranges, bitLength)&lt;br /&gt;
	return table.concat(ranges, separator)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._table(options)&lt;br /&gt;
	-- Return a wikitext table summarizing all the sensitive IP ranges&lt;br /&gt;
	-- and the entities they belong to.&lt;br /&gt;
&lt;br /&gt;
	-- Load dependencies&lt;br /&gt;
	local lang = mw.language.getContentLanguage()&lt;br /&gt;
&lt;br /&gt;
	-- Set up options&lt;br /&gt;
	options = options or {}&lt;br /&gt;
	local rangeSeparator = options.rangeseparator or &amp;#039;, &amp;#039;&lt;br /&gt;
	local showNotes = yesno(options.notes)&lt;br /&gt;
	local nColumns = showNotes and 3 or 4&lt;br /&gt;
&lt;br /&gt;
	-- Get the entity data&lt;br /&gt;
	local data = mSIPA_API.query{entities={&amp;#039;all&amp;#039;}}&lt;br /&gt;
	if data[&amp;#039;error&amp;#039;] then&lt;br /&gt;
		error(string.format(&amp;#039;%s: %s&amp;#039;, data[&amp;#039;error&amp;#039;].code, data[&amp;#039;error&amp;#039;].info))&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Make the table root&lt;br /&gt;
	local root = mw.html.create(&amp;#039;table&amp;#039;)&lt;br /&gt;
	if options.class then&lt;br /&gt;
		root:addClass(options.class)&lt;br /&gt;
	end&lt;br /&gt;
	if options.style then&lt;br /&gt;
		root:cssText(options.style)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add main header&lt;br /&gt;
	if options.mainheader then&lt;br /&gt;
		root:tag(&amp;#039;tr&amp;#039;):tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:attr(&amp;#039;colspan&amp;#039;, nColumns)&lt;br /&gt;
			:cssText(options.cellstyle)&lt;br /&gt;
			:wikitext(options.mainheader)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add column headers&lt;br /&gt;
	local headerRow = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
	headerRow&lt;br /&gt;
		:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
			:cssText(options.cellstyle)&lt;br /&gt;
			:wikitext(&amp;#039;[[IPv4]]&amp;#039;)&lt;br /&gt;
			:done()&lt;br /&gt;
		:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
			:cssText(options.cellstyle)&lt;br /&gt;
			:wikitext(&amp;#039;[[IPv6]]&amp;#039;)&lt;br /&gt;
			:done()&lt;br /&gt;
		:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
			:cssText(options.cellstyle)&lt;br /&gt;
			:wikitext(&amp;#039;Description&amp;#039;)&lt;br /&gt;
	if showNotes then&lt;br /&gt;
		headerRow:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
			:cssText(options.cellstyle)&lt;br /&gt;
			:wikitext(&amp;#039;Notes&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add data cells&lt;br /&gt;
	for i, id in ipairs(data.sensitiveips[&amp;#039;entity-ids&amp;#039;]) do&lt;br /&gt;
		local entityData = data.sensitiveips.entities[id]&lt;br /&gt;
		if not options.reason or options.reason == entityData.reason then&lt;br /&gt;
			local dataRow = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			dataRow&lt;br /&gt;
				:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
					:cssText(options.cellstyle)&lt;br /&gt;
					:wikitext(stringifyRanges(&lt;br /&gt;
						entityData.ipv4Ranges,&lt;br /&gt;
						32,&lt;br /&gt;
						rangeSeparator&lt;br /&gt;
					))&lt;br /&gt;
					:done()&lt;br /&gt;
				:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
					:cssText(options.cellstyle)&lt;br /&gt;
					:wikitext(stringifyRanges(&lt;br /&gt;
						entityData.ipv6Ranges,&lt;br /&gt;
						128,&lt;br /&gt;
						rangeSeparator&lt;br /&gt;
					))&lt;br /&gt;
					:done()&lt;br /&gt;
				:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
					:cssText(options.cellstyle)&lt;br /&gt;
					:wikitext(lang:ucfirst(entityData.description))&lt;br /&gt;
			if showNotes then&lt;br /&gt;
				dataRow:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
					:cssText(options.cellstyle)&lt;br /&gt;
					:wikitext(entityData.notes)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return tostring(root)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.table(frame)&lt;br /&gt;
	local args = require(&amp;#039;Module:Arguments&amp;#039;).getArgs(frame, {&lt;br /&gt;
		frameOnly = true&lt;br /&gt;
	})&lt;br /&gt;
	return p._table(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Mr. Stradivarius</name></author>
	</entry>
</feed>